Prevent illegal array access if GridNo = NOWHERE (#93)

This commit is contained in:
Asdow
2023-01-19 00:47:01 +02:00
committed by GitHub
parent d4abc82488
commit a55dab43b2
+5
View File
@@ -1034,6 +1034,11 @@ inline UINT16 * GetShadeTable(LEVELNODE * pNode, SOLDIERTYPE * pSoldier, SOLDIER
// Shade guy always lighter than scene default!
{
const auto GridNo = pSoldier->sGridNo;
if (GridNo == NOWHERE)
{
pShadeTable = pPaletteTable->pCurrentShade = pPaletteTable->pShades[DEFAULT_SHADE_LEVEL];
return pShadeTable;
}
UINT8 ubShadeLevel = gpWorldLevelData[GridNo].pLandHead->ubShadeLevel;
// If merc is on a roof, shade according to roof brightness
if (pSoldier->pathing.bLevel > 0 && gpWorldLevelData[GridNo].pRoofHead != NULL)