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

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 99
#define EDITLEVEL 100
/*
* Development status possibilities.

View File

@@ -473,6 +473,14 @@ relink_light_sources(boolean ghostly)
for (ls = gl.light_base; ls; ls = ls->next) {
if (ls->flags & LSF_NEEDS_FIXUP) {
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 (!lookup_id_mapping(ls->id.a_uint, &nid))
impossible("relink_light_sources: no id mapping");