- switch em_{vert,solid,wire}offs to be unsigned

- some other twiddles to fix mixed signedness compiler warnings

And from the "Dear lazy programmers" file: After you have extern declared
a variable 5 or more times at the top a function, you would have actually
saved a lot of effort by just putting it in the header where it belonged.
Or perhaps you thought by hiding it no one else would notice you were
using global variables to pass information around. Tsk tsk.
This commit is contained in:
Daniel Dunbar 2005-07-14 22:16:38 +00:00
parent 40bfa5c7a1
commit 480b8ce10b
5 changed files with 15 additions and 16 deletions

@ -48,6 +48,7 @@ struct View3D;
// face flag
#define EM_FGON_DRAW 1
extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs;
/* ******************* editmesh.c */
extern void make_editMesh(void);
@ -96,7 +97,7 @@ extern void EM_select_face_fgon(struct EditFace *efa, int sel);
extern int EM_init_backbuf_border(short xmin, short ymin, short xmax, short ymax);
extern int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
extern int EM_init_backbuf_circle(short xs, short ys, short rads);
extern int EM_check_backbuf_border(int index);
extern int EM_check_backbuf_border(unsigned int index);
extern void EM_free_backbuf_border(void);
extern void EM_selectmode_menu(void);

@ -4080,7 +4080,6 @@ static int bbs_mesh_solid(Object *ob, DerivedMesh *dm, int facecol)
void draw_object_backbufsel(Object *ob)
{
extern int em_solidoffs, em_wireoffs, em_vertoffs; // let linker solve it... from editmesh_mods.c
int dmNeedsFree;
DerivedMesh *dm;

@ -101,7 +101,7 @@ editmesh_mods.c, UI level access, no geometry changes
/* ****************************** SELECTION ROUTINES **************** */
int em_solidoffs=0, em_wireoffs=0, em_vertoffs; // set in drawobject.c ... for colorindices
unsigned int em_solidoffs=0, em_wireoffs=0, em_vertoffs=0; // set in drawobject.c ... for colorindices
static void check_backbuf(void)
{
@ -194,7 +194,7 @@ static unsigned int *read_backbuf(short xmin, short ymin, short xmax, short ymax
/* smart function to sample a rect spiralling outside, nice for backbuf selection */
static unsigned int sample_backbuf_rect(unsigned int *buf, int size, int min, int max, short *dist)
static unsigned int sample_backbuf_rect(unsigned int *buf, int size, unsigned int min, unsigned int max, short *dist)
{
unsigned int *bufmin, *bufmax;
int a, b, rc, nr, amount, dirvec[4][2];
@ -309,7 +309,7 @@ int EM_init_backbuf_border(short xmin, short ymin, short xmax, short ymax)
return 1;
}
int EM_check_backbuf_border(int index)
int EM_check_backbuf_border(unsigned int index)
{
if(selbuf==NULL) return 1;
if(index>0 && index<=em_vertoffs)
@ -562,8 +562,8 @@ EditEdge *findnearestedge(short *dist)
{
if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
EditEdge *eed=NULL;
unsigned int *buf;
int a=1, index;
unsigned int *buf, index;
int a=1;
short mval[2], distance=255;
getmouseco_areawin(mval);
@ -647,7 +647,8 @@ static EditFace *findnearestface(short *dist)
{
if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
EditFace *efa=NULL;
int a=1, index;
int a=1;
unsigned int index;
short mval[2], distance;
calc_mesh_facedots_ext(); // shouldnt be needed each click

@ -1480,7 +1480,8 @@ void stitch_uv_tface(int mode)
MFace *mf;
TFace *tf, *tface;
Mesh *me;
unsigned int a, b, c, vtot, vtot2, tot;
int a;
unsigned int b, c, vtot, vtot2, tot;
float newuv[2], limit[2], *uv, *uv1;
struct uvvertsort *sortblock, *sb, *sb1, *sb2;
@ -1624,8 +1625,8 @@ void select_linked_tface_uv(int mode)
TFace *tface, *tf, *nearesttf=NULL;
Mesh *me;
char sel, *linkflag;
int nearestuv, i, nverts;
unsigned int a, b, c, vtot, tot, nearestv;
int a, nearestuv, i, nverts;
unsigned int b, c, vtot, tot, nearestv;
float limit[2], *uv, *uv1;
struct uvvertsort *sortblock, *sb, *sb1, *sb2;

@ -267,13 +267,13 @@ static void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves)
static void do_lasso_select_mesh(short mcords[][2], short moves, short select)
{
extern int em_solidoffs, em_wireoffs; // let linker solve it... from editmesh_mods.c
EditMesh *em = G.editMesh;
EditVert *eve;
EditEdge *eed;
EditFace *efa;
rcti rect;
int index, bbsel=0; // bbsel: no clip needed with screencoords
unsigned int index;
int bbsel=0; // bbsel: no clip needed with screencoords
lasso_select_boundbox(&rect, mcords, moves);
@ -434,7 +434,6 @@ static void do_lasso_select_lattice(short mcords[][2], short moves, short select
static void do_lasso_select_facemode(short mcords[][2], short moves, short select)
{
extern int em_vertoffs; // still bad code, let linker solve for now
Mesh *me;
TFace *tface;
rcti rect;
@ -1274,7 +1273,6 @@ void borderselect(void)
else if(G.obedit) {
/* used to be a bigger test, also included sector and life */
if(G.obedit->type==OB_MESH) {
extern int em_solidoffs, em_wireoffs; // let linker solve it... from editmesh_mods.c
EditMesh *em = G.editMesh;
EditVert *eve;
EditEdge *eed;
@ -1573,7 +1571,6 @@ void borderselect(void)
static void mesh_selectionCB(int selecting, Object *editobj, short *mval, float rad)
{
extern int em_solidoffs, em_wireoffs; // let linker solve it... from editmesh_mods.c
EditMesh *em = G.editMesh;
EditVert *eve;
EditEdge *eed;