Rework ED_Print to be type-aware, instead of blindly assuming
everything is an integer.
This commit is contained in:
parent
7a09f37e0b
commit
2bf0fa910f
|
@ -535,7 +535,7 @@ ED_Print (progs_t * pr, edict_t *ed)
|
||||||
int l;
|
int l;
|
||||||
ddef_t *d;
|
ddef_t *d;
|
||||||
pr_type_t *v;
|
pr_type_t *v;
|
||||||
int i, j;
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
@ -556,11 +556,29 @@ ED_Print (progs_t * pr, edict_t *ed)
|
||||||
// if the value is still all 0, skip the field
|
// if the value is still all 0, skip the field
|
||||||
type = d->type & ~DEF_SAVEGLOBAL;
|
type = d->type & ~DEF_SAVEGLOBAL;
|
||||||
|
|
||||||
for (j = 0; j < type_size[type]; j++)
|
switch (type) {
|
||||||
if (v[j].integer_var)
|
case ev_entity:
|
||||||
|
case ev_integer:
|
||||||
|
case ev_func:
|
||||||
|
case ev_field:
|
||||||
|
if (!v->integer_var)
|
||||||
|
continue;
|
||||||
break;
|
break;
|
||||||
if (j == type_size[type])
|
case ev_string:
|
||||||
continue;
|
if (!PR_GetString (pr, v->string_var)[0])
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case ev_float:
|
||||||
|
if (!v->float_var)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case ev_vector:
|
||||||
|
if (!v[0].float_var && !v[1].float_var && !v[2].float_var)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PR_Error (pr, "ED_Print: Unhandled type %d\n", type);
|
||||||
|
}
|
||||||
|
|
||||||
Con_Printf ("%s", name);
|
Con_Printf ("%s", name);
|
||||||
l = strlen (name);
|
l = strlen (name);
|
||||||
|
|
Loading…
Reference in New Issue