Fix: levltyp[] desynchronization

The "temporary?" levltyp[] array became desynchronized from the level
types enum with the addition of lava walls.  This caused all level types
past that to be given the wrong description when it was used.

Add an explicit length to the array so that future additions to the enum
should produce a compiler warning if it's not updated at the same time.
This commit is contained in:
Michael Meyer
2023-07-04 22:56:52 -07:00
committed by PatR
parent d119a91799
commit 3064228ca7
+4 -4
View File
@@ -1867,15 +1867,15 @@ wiz_map_levltyp(void)
/* temporary? hack, since level type codes aren't the same as screen /* temporary? hack, since level type codes aren't the same as screen
symbols and only the latter have easily accessible descriptions */ symbols and only the latter have easily accessible descriptions */
const char *levltyp[] = { const char *levltyp[MAX_TYPE + 2] = {
"stone", "vertical wall", "horizontal wall", "top-left corner wall", "stone", "vertical wall", "horizontal wall", "top-left corner wall",
"top-right corner wall", "bottom-left corner wall", "top-right corner wall", "bottom-left corner wall",
"bottom-right corner wall", "cross wall", "tee-up wall", "tee-down wall", "bottom-right corner wall", "cross wall", "tee-up wall", "tee-down wall",
"tee-left wall", "tee-right wall", "drawbridge wall", "tree", "tee-left wall", "tee-right wall", "drawbridge wall", "tree",
"secret door", "secret corridor", "pool", "moat", "water", "secret door", "secret corridor", "pool", "moat", "water",
"drawbridge up", "lava pool", "iron bars", "door", "corridor", "room", "drawbridge up", "lava pool", "lava wall", "iron bars", "door",
"stairs", "ladder", "fountain", "throne", "sink", "grave", "altar", "ice", "corridor", "room", "stairs", "ladder", "fountain", "throne", "sink",
"drawbridge down", "air", "cloud", "grave", "altar", "ice", "drawbridge down", "air", "cloud",
/* not a real terrain type, but used for undiggable stone /* not a real terrain type, but used for undiggable stone
by wiz_map_levltyp() */ by wiz_map_levltyp() */
"unreachable/undiggable", "unreachable/undiggable",