From cd300e83c0fa9bc1c7a0ab7ffa606c03df5fc09c Mon Sep 17 00:00:00 2001 From: Wanne Date: Tue, 2 Apr 2013 08:52:18 +0000 Subject: [PATCH] - Fixed CTDs in Bobby Ray location drop down and florists drop down list because of double initialization of the locations and buffer overruns o I simply reverted the MainMenuScreen.cpp back to revision 5882 (which fixes the double initialization of the external data -> this results in the bug described above) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5975 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- MainMenuScreen.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/MainMenuScreen.cpp b/MainMenuScreen.cpp index febcca82..a01570c5 100644 --- a/MainMenuScreen.cpp +++ b/MainMenuScreen.cpp @@ -354,18 +354,16 @@ void ExitMainMenu( ) { if (gMainMenulayout[iCounter2].Visible == 1) { + // WANNE: This is a dirty fix. I don't know when that was introduced, but when clicking on "Multiplayer Game", the game crashes when trying to call DeleteVideoSurfaceFromIndex() + if (is_networked && iCounter2 == 1) + continue; + +// DeleteVideoObjectFromIndex( gMainMenulayout[iCounter2].uiIndex ); DeleteVideoSurfaceFromIndex( gMainMenulayout[iCounter2].uiIndex ); } } gMsgBox.uiExitScreen = MAINMENU_SCREEN; - - // WANNE: Re-Init to get the correct data - if (gbHandledMainMenu == NEW_GAME || gbHandledMainMenu == NEW_MP_GAME || gbHandledMainMenu == LOAD_GAME) - { - LoadExternalGameplayData(TABLEDATA_DIRECTORY); - InitDependingGameStyleOptions(); - } } // WANNE - MP: This method initializes variables that should be initialized @@ -448,6 +446,9 @@ void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason) //if something didnt work, dont even know how to make error code...//hayden } + // Reload the external gameplay data, because maybe we started a MP game before! + LoadExternalGameplayData(TABLEDATA_DIRECTORY); + SetMainMenuExitScreen( MP_JOIN_SCREEN ); // OJW - 20081129 //SetMainMenuExitScreen( GAME_INIT_OPTIONS_SCREEN ); } @@ -469,6 +470,8 @@ void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason) gfLoadGameUponEntry = TRUE; } + InitDependingGameStyleOptions(); + btn->uiFlags &= (~BUTTON_CLICKED_ON ); } if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) @@ -531,6 +534,7 @@ void HandleMainMenuInput() // WANNE: Some initializing was missing when directly loading last savegame // form main menu with ALT + C giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; + InitDependingGameStyleOptions(); break; @@ -898,4 +902,4 @@ void RestoreButtonBackGrounds() } #endif -} \ No newline at end of file +}