Verify game state and configuration reference sanity
Table elements reference other table elements. Bad things happen when references dangle. ef_verify() already checks whether the referenced table elements exist. This commit makes it check whether the elements are "in use". This catches stuff like living planes on dead carriers.
This commit is contained in:
parent
b30c83cd64
commit
7da9aab5a1
1 changed files with 7 additions and 0 deletions
|
@ -122,6 +122,13 @@ verify_tabref(int type, int row, struct castr *ca, int idx, long val)
|
||||||
val, ef_nameof(tabno), ef_nelem(tabno));
|
val, ef_nameof(tabno), ef_nelem(tabno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
/* laziness: assumes TABNO is EFF_MEM */
|
||||||
|
if (val >= 0 && !empobj_in_use(tabno, ef_ptr(tabno, val))) {
|
||||||
|
verify_fail(type, row, ca, idx,
|
||||||
|
"value %ld refers to missing element of table %s",
|
||||||
|
val, ef_nameof(tabno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue