From 51f2eaff7802b90583f505ed708836ea02670cce Mon Sep 17 00:00:00 2001 From: silversurfer Date: Wed, 19 Mar 2014 17:22:31 +0000 Subject: [PATCH] fix for CTD when the prebattle interface should come up but we are in tactical screen at the moment. The game tried to draw into an invalid screen. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7096 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/PreBattle Interface.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 130900d7..621549c8 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -427,17 +427,21 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) } } - fMapScreenBottomDirty = TRUE; - ChangeSelectedMapSector( gubPBSectorX, gubPBSectorY, gubPBSectorZ ); - // Headrock: Added FALSE argument, We might need TRUE but not sure. Will need to initiate battle :) - RenderMapScreenInterfaceBottom( FALSE ); - + // silversurfer: moved this up here because this check needs to be done before we draw anything on the map screen - otherwise CTD. + // Also the necessary variables have to be set. //If we are currently in tactical, then set the flag to automatically bring up the mapscreen. if( guiCurrentScreen == GAME_SCREEN ) { gfEnteringMapScreen = TRUE; + gfEnteringMapScreenToEnterPreBattleInterface = TRUE; + return; } + fMapScreenBottomDirty = TRUE; + ChangeSelectedMapSector( gubPBSectorX, gubPBSectorY, gubPBSectorZ ); + // Headrock: Added FALSE argument, We might need TRUE but not sure. Will need to initiate battle :) + RenderMapScreenInterfaceBottom( FALSE ); + if( !fShowTeamFlag ) { ToggleShowTeamsMode();