- 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
This commit is contained in:
Wanne
2013-04-02 08:52:18 +00:00
parent 8137c04207
commit cd300e83c0
+11 -7
View File
@@ -354,18 +354,16 @@ void ExitMainMenu( )
{ {
if (gMainMenulayout[iCounter2].Visible == 1) 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 ); DeleteVideoSurfaceFromIndex( gMainMenulayout[iCounter2].uiIndex );
} }
} }
gMsgBox.uiExitScreen = MAINMENU_SCREEN; 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 // 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 //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( MP_JOIN_SCREEN ); // OJW - 20081129
//SetMainMenuExitScreen( GAME_INIT_OPTIONS_SCREEN ); //SetMainMenuExitScreen( GAME_INIT_OPTIONS_SCREEN );
} }
@@ -469,6 +470,8 @@ void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason)
gfLoadGameUponEntry = TRUE; gfLoadGameUponEntry = TRUE;
} }
InitDependingGameStyleOptions();
btn->uiFlags &= (~BUTTON_CLICKED_ON ); btn->uiFlags &= (~BUTTON_CLICKED_ON );
} }
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
@@ -531,6 +534,7 @@ void HandleMainMenuInput()
// WANNE: Some initializing was missing when directly loading last savegame // WANNE: Some initializing was missing when directly loading last savegame
// form main menu with ALT + C // form main menu with ALT + C
giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS;
InitDependingGameStyleOptions();
break; break;