catch invalid id on restore

Another EDITLEVEL bump.
This commit is contained in:
nhmall
2024-02-28 16:15:30 -05:00
parent 1a02a2df16
commit 3edd3e5869
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 99 #define EDITLEVEL 100
/* /*
* Development status possibilities. * Development status possibilities.
+8
View File
@@ -473,6 +473,14 @@ relink_light_sources(boolean ghostly)
for (ls = gl.light_base; ls; ls = ls->next) { for (ls = gl.light_base; ls; ls = ls->next) {
if (ls->flags & LSF_NEEDS_FIXUP) { if (ls->flags & LSF_NEEDS_FIXUP) {
if (ls->type == LS_OBJECT || ls->type == LS_MONSTER) { if (ls->type == LS_OBJECT || ls->type == LS_MONSTER) {
if (!ls->id.a_uint) {
/* it was possible to get stuck in this loop on bad
* savefile data load and repeatedly prompt the player
* for a key press after displaying an impossible message.
* Consider this bad data from a savefile and panic() */
panic("relink_light_sources: id = 0, type = %d",
(int) ls->type);
}
if (ghostly) { if (ghostly) {
if (!lookup_id_mapping(ls->id.a_uint, &nid)) if (!lookup_id_mapping(ls->id.a_uint, &nid))
impossible("relink_light_sources: no id mapping"); impossible("relink_light_sources: no id mapping");