copperwater / xNetHack

Experimental features and improvements applied to NetHack 3.7-dev
Other
54 stars 15 forks source link

Fix: hanging when loading Val-loca.lua #178

Closed entrez closed 1 year ago

entrez commented 1 year ago

This level tries to generate a clear path through the ice on the left hand side of the screen, which involves retrieving the name of the terrain type and comparing it against a list of allowed types. However, the array of terrain type names had desynced from the actual list of terrain types, causing it to produce the wrong names so that it would never actually certify the path as "good to go". Fix this by resynchronizing the lists, and add an explicit length to the terrain type names list based on the enum so that it will produce a compiler error if more terrains are added in the future without fixing the terrain name list.

entrez commented 1 year ago

This was an outstanding xnh issue (sorta) with the addition of GRASS and MAGIC_PLATFORM but it didn't really affect anything since they are at the end of the list. It was only when LAVAWALL was added in the middle without fixing levltyp[] (in vanilla) that everything got shifted over and this became a problem. I opened an equivalent vanilla PR too (NetHack/NetHack#1052) since it needs it, but this one contains the xnh-specific descriptions of GRASS and MAGIC_PLATFORM as well.