Skip to content

Commit

Permalink
move track-only variables to track.c
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Dec 7, 2024
1 parent 9debbd1 commit 423f354
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
7 changes: 0 additions & 7 deletions src/mged/mged.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,6 @@ extern int mged_db_warn;
#define local2base (s->dbip->dbi_local2base)
#define cur_title (s->dbip->dbi_title) /* current model title */


/* default region codes defined in mover.c */
extern int item_default;
extern int air_default;
extern int mat_default;
extern int los_default;

/**
* Definitions.
*
Expand Down
6 changes: 0 additions & 6 deletions src/mged/mover.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@

#include "./mged.h"

/* default region ident codes */
int item_default = 1000; /* GIFT region ID */
int air_default = 0;
int mat_default = 1; /* GIFT material code */
int los_default = 100; /* Line-of-sight estimate */

/*
* This routine is used when the object to be moved is
* the top level in its reference path.
Expand Down
21 changes: 12 additions & 9 deletions src/mged/track.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ void crdummy(fastf_t *w, fastf_t *t, int flag);
void trcurve(fastf_t *wh, fastf_t *t);
void bottom(fastf_t *vec1, fastf_t *vec2, fastf_t *t);
void top(fastf_t *vec1, fastf_t *vec2, fastf_t *t);
void crregion(struct mged_state *s, char *region, char *op, int *members, int number, char *solidname, int maxlen);
void crregion(struct mged_state *s, char *region, char *op, const int *members, int number, char *solidname, int maxlen, int los_default, int mat_default);
static void track_itoa(struct mged_state *s, int n, char *cs, int w);


/*
* adds track given "wheel" info
*/
Expand All @@ -71,6 +70,10 @@ f_amtrack(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
MGED_CK_CMD(ctp);
struct mged_state *s = ctp->s;

int item_default = 1000; /* GIFT region ID */
int mat_default = 1; /* GIFT material code */
int los_default = 100; /* Line-of-sight estimate */

fastf_t fw[3], lw[3], iw[3], dw[3], tr[3];
char solname[12], regname[12], grpname[9], oper[3];
int i, j, memb[4];
Expand Down Expand Up @@ -451,30 +454,30 @@ f_amtrack(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
memb[0] = 1;
memb[1] = 4;
crname(s, regname, 1, sizeof(regname));
crregion(s, regname, oper, memb, 2, solname, sizeof(regname));
crregion(s, regname, oper, memb, 2, solname, sizeof(regname), los_default, mat_default);
solname[8] = regname[8] = '\0';

/* region 2 */
crname(s, regname, 2, sizeof(regname));
memb[0] = 2;
memb[1] = 3;
memb[2] = 4;
crregion(s, regname, oper, memb, 3, solname, sizeof(regname));
crregion(s, regname, oper, memb, 3, solname, sizeof(regname), los_default, mat_default);
solname[8] = regname[8] = '\0';

/* region 5 */
crname(s, regname, 5, sizeof(regname));
memb[0] = 5;
memb[1] = 8;
crregion(s, regname, oper, memb, 2, solname, sizeof(regname));
crregion(s, regname, oper, memb, 2, solname, sizeof(regname), los_default, mat_default);
solname[8] = regname[8] = '\0';

/* region 6 */
crname(s, regname, 6, sizeof(regname));
memb[0] = 6;
memb[1] = 7;
memb[2] = 8;
crregion(s, regname, oper, memb, 3, solname, sizeof(regname));
crregion(s, regname, oper, memb, 3, solname, sizeof(regname), los_default, mat_default);
solname[8] = regname[8] = '\0';

/* region 9 */
Expand All @@ -483,15 +486,15 @@ f_amtrack(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
memb[1] = 1;
memb[2] = 5;
oper[2] = WMOP_SUBTRACT;
crregion(s, regname, oper, memb, 3, solname, sizeof(regname));
crregion(s, regname, oper, memb, 3, solname, sizeof(regname), los_default, mat_default);
solname[8] = regname[8] = '\0';

/* region 10 */
crname(s, regname, 10, sizeof(regname));
memb[0] = 10;
memb[1] = 4;
memb[2] = 8;
crregion(s, regname, oper, memb, 3, solname, sizeof(regname));
crregion(s, regname, oper, memb, 3, solname, sizeof(regname), los_default, mat_default);
solname[8] = regname[8] = '\0';

/* group all the track regions */
Expand Down Expand Up @@ -870,7 +873,7 @@ top(fastf_t *vec1, fastf_t *vec2, fastf_t *t)


void
crregion(struct mged_state *s, char *region, char *op, int *members, int number, char *solidname, int maxlen)
crregion(struct mged_state *s, char *region, char *op, const int *members, int number, char *solidname, int maxlen, int los_default, int mat_default)
{
int i;
struct bu_list head;
Expand Down

0 comments on commit 423f354

Please sign in to comment.