mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 05:01:24 +00:00
[gamecode] Print array contents in pr_debug_array_view
This makes it much easier to check data in progs files.
This commit is contained in:
parent
131ad9013c
commit
4576de816d
1 changed files with 17 additions and 1 deletions
|
@ -1572,6 +1572,7 @@ pr_dump_struct (qfot_type_t *type, pr_type_t *value, void *_data,
|
||||||
dstring_appendstr (dstr, "}");
|
dstring_appendstr (dstr, "}");
|
||||||
//dasprintf (dstr, "<%s>", struct_type);
|
//dasprintf (dstr, "<%s>", struct_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pr_debug_struct_view (qfot_type_t *type, pr_type_t *value, void *_data)
|
pr_debug_struct_view (qfot_type_t *type, pr_type_t *value, void *_data)
|
||||||
{
|
{
|
||||||
|
@ -1597,9 +1598,24 @@ static void
|
||||||
pr_debug_array_view (qfot_type_t *type, pr_type_t *value, void *_data)
|
pr_debug_array_view (qfot_type_t *type, pr_type_t *value, void *_data)
|
||||||
{
|
{
|
||||||
__auto_type data = (pr_debug_data_t *) _data;
|
__auto_type data = (pr_debug_data_t *) _data;
|
||||||
|
progs_t *pr = data->pr;
|
||||||
dstring_t *dstr = data->dstr;
|
dstring_t *dstr = data->dstr;
|
||||||
|
qfot_array_t *array = &type->array;
|
||||||
|
|
||||||
dstring_appendstr (dstr, "<array>");
|
qfot_type_t *val_type = &G_STRUCT (pr, qfot_type_t, array->type);
|
||||||
|
int val_size = pr_debug_type_size (pr, val_type);
|
||||||
|
|
||||||
|
dstring_appendstr (dstr, "{");
|
||||||
|
int offset = 0;
|
||||||
|
for (int i = 0; i < array->size; i++, offset += val_size) {
|
||||||
|
pr_type_t *val = value + offset;
|
||||||
|
dasprintf (dstr, "[%d]=", array->base + i);
|
||||||
|
value_string (data, val_type, val);
|
||||||
|
if (i < array->size - 1) {
|
||||||
|
dstring_appendstr (dstr, ", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dstring_appendstr (dstr, "}");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue