diff --git a/source/src/command.cpp b/source/src/command.cpp index c59cc9b8..4f7bb798 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -99,10 +99,10 @@ COMMAND(alias, ARG_2STR); // variable's and commands are registered through globals, see cube.h -int variable(const char *name, int min, int cur, int max, int *storage, void (*fun)(), bool persist) +int variable(const char *name, int minval, int cur, int maxval, int *storage, void (*fun)(), bool persist) { if(!idents) idents = new hashtable; - ident v(ID_VAR, name, min, max, storage, fun, persist, IEXC_CORE); + ident v(ID_VAR, name, minval, maxval, storage, fun, persist, IEXC_CORE); idents->access(name, &v); return cur; } @@ -303,14 +303,14 @@ char *executeret(const char *p) // all evaluation hap case ID_VAR: // game defined variables if(!w[1][0]) conoutf("%s = %d", c, *id->storage.i); // var with no value just prints its current value - else if(id->min>id->max) conoutf("variable %s is read-only", id->name); + else if(id->minval>id->maxval) conoutf("variable %s is read-only", id->name); else { int i1 = ATOI(w[1]); - if(i1min || i1>id->max) + if(i1minval || i1>id->maxval) { - i1 = i1min ? id->min : id->max; // clamp to valid range - conoutf("valid range for %s is %d..%d", id->name, id->min, id->max); + i1 = i1minval ? id->minval : id->maxval; // clamp to valid range + conoutf("valid range for %s is %d..%d", id->name, id->minval, id->maxval); } *id->storage.i = i1; if(id->fun) ((void (__cdecl *)())id->fun)(); // call trigger function if available diff --git a/source/src/command.h b/source/src/command.h index b5b83127..06925747 100644 --- a/source/src/command.h +++ b/source/src/command.h @@ -11,7 +11,7 @@ struct ident { int type; // one of ID_* above const char *name; - int min, max; // ID_VAR + int minval, maxval; // ID_VAR union { int *i; // ID_VAR @@ -31,32 +31,32 @@ struct ident ident() {} // ID_VAR - ident(int type, const char *name, int min, int max, int *i, void (*fun)(), bool persist, int context) - : type(type), name(name), min(min), max(max), fun(fun), + ident(int type, const char *name, int minval, int maxval, int *i, void (*fun)(), bool persist, int context) + : type(type), name(name), minval(minval), maxval(maxval), fun(fun), narg(0), action(NULL), executing(NULL), persist(persist), context(context) { storage.i = i; } // ID_FVAR ident(int type, const char *name, float *f, void (*fun)(), bool persist, int context) - : type(type), name(name), min(0), max(0), fun(fun), + : type(type), name(name), minval(0), maxval(0), fun(fun), narg(0), action(NULL), executing(NULL), persist(persist), context(context) { storage.f = f; } // ID_SVAR ident(int type, const char *name, char **s, void (*fun)(), bool persist, int context) - : type(type), name(name), min(0), max(0), fun(fun), + : type(type), name(name), minval(0), maxval(0), fun(fun), narg(0), action(NULL), executing(NULL), persist(persist), context(context) { storage.s = s; } // ID_ALIAS ident(int type, const char *name, char *action, bool persist, int context) - : type(type), name(name), min(0), max(0), stack(0), + : type(type), name(name), minval(0), maxval(0), stack(0), narg(0), action(action), executing(NULL), persist(persist), context(context) { storage.i = NULL; } // ID_COMMAND ident(int type, const char *name, void (*fun)(), int narg, int context) - : type(type), name(name), min(0), max(0), fun(fun), + : type(type), name(name), minval(0), maxval(0), fun(fun), narg(narg), action(NULL), executing(NULL), persist(false), context(context) { storage.i = NULL; } }; diff --git a/source/src/docs.cpp b/source/src/docs.cpp index 37263579..252cfb99 100644 --- a/source/src/docs.cpp +++ b/source/src/docs.cpp @@ -267,7 +267,7 @@ void docwritebaseref(char *ref, char *schemalocation, char *transformation) if(id.type != ID_VAR) continue; fprintf(f, "\t\t\t\t\n", xmlstringenc(name, id.name, _MAXDEFSTR)); fprintf(f, "\t\t\t\t\tTODO\n"); - fprintf(f, "\t\t\t\t\t\n", id.min>id.max ? "" : "token=\"N\"", id.min, id.max, *id.storage.i, id.min>id.max ? "readOnly=\"true\"" : ""); + fprintf(f, "\t\t\t\t\t\n", id.minval>id.maxval ? "" : "token=\"N\"", id.minval, id.maxval, *id.storage.i, id.minval>id.maxval ? "readOnly=\"true\"" : ""); fprintf(f, "\t\t\t\t\n"); }