From 482c2b2ac8cff51d435d20b348e668dd77386af2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 Jan 2015 23:53:56 -0500 Subject: XEEN: Fix immediate crash in outdoors rendering --- engines/xeen/interface_map.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'engines/xeen') diff --git a/engines/xeen/interface_map.cpp b/engines/xeen/interface_map.cpp index 43a467df9b..23b709d391 100644 --- a/engines/xeen/interface_map.cpp +++ b/engines/xeen/interface_map.cpp @@ -4423,25 +4423,30 @@ void InterfaceMap::drawOutdoors() { for (int idx = 0; idx < 9; ++idx) { map.getCell(TERRAIN_INDEXES1[idx]); - _outdoorList[36 + idx]._sprites = &map._wallSprites._surfaces[map._currentWall]; + SpriteResource &spr = map._wallSprites._surfaces[map._currentWall]; + _outdoorList[36 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr; } for (int idx = 0; idx < 5; ++idx) { map.getCell(TERRAIN_INDEXES2[idx]); - _outdoorList[61 + idx]._sprites = &map._wallSprites._surfaces[map._currentWall]; + SpriteResource &spr = map._wallSprites._surfaces[map._currentWall]; + _outdoorList[61 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr; } for (int idx = 0; idx < 3; ++idx) { map.getCell(TERRAIN_INDEXES3[idx]); - _outdoorList[84 + idx]._sprites = &map._wallSprites._surfaces[map._currentWall]; + SpriteResource &spr = map._wallSprites._surfaces[map._currentWall]; + _outdoorList[84 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr; } for (int idx = 0; idx < 5; ++idx) { map.getCell(TERRAIN_INDEXES4[idx]); - _outdoorList[103 + idx]._sprites = &map._wallSprites._surfaces[map._currentWall]; + SpriteResource &spr = map._wallSprites._surfaces[map._currentWall]; + _outdoorList[103 + idx]._sprites = spr.size() == 0 ? (SpriteResource *)nullptr : &spr; } map.getCell(1); - _outdoorList[108]._sprites = &map._wallSprites._surfaces[map._currentWall]; - _outdoorList[109]._sprites = &map._wallSprites._surfaces[map._currentWall]; - _outdoorList[110]._sprites = &map._wallSprites._surfaces[map._currentWall]; + SpriteResource &surface = map._wallSprites._surfaces[map._currentWall]; + _outdoorList[108]._sprites = surface.size() == 0 ? (SpriteResource *)nullptr : &surface; + _outdoorList[109]._sprites = _outdoorList[108]._sprites; + _outdoorList[110]._sprites = _outdoorList[108]._sprites; _outdoorList._sky1._flags = _outdoorList._sky2._flags = _flipSky ? SPRFLAG_HORIZ_FLIPPED : 0; _outdoorList._groundSprite._flags = _flipWater ? SPRFLAG_HORIZ_FLIPPED : 0; -- cgit v1.2.3