Skip to content

Commit

Permalink
Show classname in edict entity fields (from Ironwail)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler authored and vsonnier committed Jul 12, 2024
1 parent 248263d commit 466225b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Quake/pr_edict.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ PR_DoubleFormat
*/
static const char *PR_DoubleFormat (double d)
{
return abs (d - round (d)) < 0.05 ? "% 13.0f " : "% 15.1f";
return abs (d - round (d)) < 0.05 ? "% 13.0lf " : "% 15.1lf";
}

/*
Expand All @@ -284,10 +284,12 @@ Returns a string describing *data in a type specific manner
*/
static const char *PR_ValueString (int type, eval_t *val)
{
static char line[512];
char fmt[64];
static char line[512];
char fmt[64];
const char *str;
ddef_t *def;
dfunction_t *f;
dfunction_t *f;
edict_t *ed;

type &= ~DEF_SAVEGLOBAL;

Expand All @@ -297,7 +299,9 @@ static const char *PR_ValueString (int type, eval_t *val)
q_snprintf (line, sizeof (line), "%s", PR_GetString (val->string));
break;
case ev_entity:
q_snprintf (line, sizeof (line), "entity %i", NUM_FOR_EDICT (PROG_TO_EDICT (val->edict)));
ed = PROG_TO_EDICT(val->edict);
str = PR_GetString(ed->v.classname);
q_snprintf (line, sizeof(line), *str ? "entity %i (%s)" : "entity %i", NUM_FOR_EDICT(ed), PR_GetString(ed->v.classname));
break;
case ev_function:
f = qcvm->functions + val->function;
Expand Down

0 comments on commit 466225b

Please sign in to comment.