mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Make edicts command support a search string, so it only prints edicts
with matching classnames. Makes it easy to print out the type you want for debugging :)
This commit is contained in:
parent
00d409e80c
commit
a771b5bd6c
6 changed files with 23 additions and 11 deletions
|
@ -146,7 +146,7 @@ int PR_GetFieldOffset (progs_t *pr, const char *name);
|
|||
void PR_Error (progs_t *pr, const char *error, ...) __attribute__((format(printf,2,3)));
|
||||
void PR_RunError (progs_t *pr, const char *error, ...) __attribute__((format(printf,2,3)));
|
||||
|
||||
void ED_PrintEdicts (progs_t *pr);
|
||||
void ED_PrintEdicts (progs_t *pr, const char *fieldval);
|
||||
void ED_PrintNum (progs_t *pr, int ent);
|
||||
void ED_Count (progs_t *pr);
|
||||
void PR_Profile (progs_t *pr);
|
||||
|
|
|
@ -599,14 +599,26 @@ ED_PrintNum (progs_t * pr, int ent)
|
|||
For debugging, prints all the entities in the current server
|
||||
*/
|
||||
void
|
||||
ED_PrintEdicts (progs_t * pr)
|
||||
ED_PrintEdicts (progs_t *pr, const char *fieldval)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
int count;
|
||||
ddef_t *def;
|
||||
|
||||
Con_Printf ("%i entities\n", *(pr)->num_edicts);
|
||||
for (i = 0; i < *(pr)->num_edicts; i++) {
|
||||
Con_Printf ("\nEDICT %i:\n", i);
|
||||
ED_PrintNum (pr, i);
|
||||
def = ED_FindField(pr, "classname");
|
||||
|
||||
if (fieldval && fieldval[0] && def) {
|
||||
count = 0;
|
||||
for (i = 0; i < *(pr)->num_edicts; i++)
|
||||
if (strequal(fieldval, E_STRING (pr, EDICT_NUM(pr, i), def->ofs))) {
|
||||
ED_PrintNum (pr, i);
|
||||
count++;
|
||||
}
|
||||
Con_Printf ("%i entities\n", count);
|
||||
} else {
|
||||
for (i = 0; i < *(pr)->num_edicts; i++)
|
||||
ED_PrintNum (pr, i);
|
||||
Con_Printf ("%i entities\n", *(pr)->num_edicts);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1185,7 +1185,7 @@ PF_precache_model (progs_t * pr)
|
|||
void
|
||||
PF_coredump (progs_t * pr)
|
||||
{
|
||||
ED_PrintEdicts (pr);
|
||||
ED_PrintEdicts (pr, "");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -94,7 +94,7 @@ prune_edict (progs_t *pr, edict_t *ent)
|
|||
void
|
||||
ED_PrintEdicts_f (void)
|
||||
{
|
||||
ED_PrintEdicts (&sv_pr_state);
|
||||
ED_PrintEdicts (&sv_pr_state, Cmd_Argv (1));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -972,7 +972,7 @@ PF_precache_model (progs_t *pr)
|
|||
void
|
||||
PF_coredump (progs_t *pr)
|
||||
{
|
||||
ED_PrintEdicts (pr);
|
||||
ED_PrintEdicts (pr, "");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -90,7 +90,7 @@ prune_edict (progs_t *pr, edict_t *ent)
|
|||
void
|
||||
ED_PrintEdicts_f (void)
|
||||
{
|
||||
ED_PrintEdicts (&sv_pr_state);
|
||||
ED_PrintEdicts (&sv_pr_state, Cmd_Argv (1));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue