diff --git a/Gameleap/mw4/Content/ShellScripts/Multiplayer/ConLobbyMission.script b/Gameleap/mw4/Content/ShellScripts/Multiplayer/ConLobbyMission.script index cd879f23..9189f304 100644 --- a/Gameleap/mw4/Content/ShellScripts/Multiplayer/ConLobbyMission.script +++ b/Gameleap/mw4/Content/ShellScripts/Multiplayer/ConLobbyMission.script @@ -53,6 +53,7 @@ #define MAIL_RECORD_MISSION -4444 #define MAIL_PREVIOUS_MISSION_PARAMS -5555 #define MAIL_LOAD_AUTO_MISSION -6666 // [automaticmode] sync with ConLobby.script +#define MAIL_LOAD_AUTO_MISSION_DONE -8888 // [automaticmode] internal finalize (self-mail) #define ROOKIE_MISSION "ScarabStronghold - Attrition" @@ -902,9 +903,9 @@ main nTempValue = $$g_nAutoArmorMode$$ o_game_options[16].state = 0 callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - initialize(this) - // notify ConLobby: game type/params changed (updates cur_game_type, cur_team_val display) - mail(-9998, parent) + // Finalize via self-mail: initialize(this) and mail(-9998,parent) must run + // in a sender==this context to avoid the 'gui_objects have no parent' crash. + mail(MAIL_LOAD_AUTO_MISSION_DONE, this) return } } @@ -1083,78 +1084,10 @@ main initialize(this) return } - if (getmessage() == MAIL_PREVIOUS_MISSION_PARAMS) + // [automaticmode] finalize in sender==this context (initialize/parent safe here) + if (getmessage() == MAIL_LOAD_AUTO_MISSION_DONE) { - callback($$SetNetworkMissionParamater$$, game_type, selection_to_standard[$$g_nAutoGameType$$]) - // visibility - o_game_options[2].nselected = $$g_nAutoVisibility$$ - callback($$SetNetworkMissionParamater$$, visibility, o_game_options[2].nselected) - // weather - o_game_options[3].nselected = $$g_nAutoWeather$$ - callback($$SetNetworkMissionParamater$$, weather, o_game_options[3].nselected) - // time of day - o_game_options[4].nselected = $$g_nAutoTimeOfDay$$ - callback($$SetNetworkMissionParamater$$, night_parameter, o_game_options[4].nselected) - callback($$Shell_CallbackHandler$$, ShellSetTime, o_game_options[4].nselected) - // time limit - int nAutoTL = $$g_nAutoTimeLimit$$ - int temp_num - if nAutoTL >= 0 - temp_num = nAutoTL - else - temp_num = TIME_VALUE_DEFAULT - int m - for (m = 0; m < o_game_options[5].list_size; m++) - { - if (makeint(o_game_options[5].list_item[m]) == temp_num) - { - o_game_options[5].nselected = m - break - } - } - callback($$SetNetworkMissionParamater$$, time_limit, temp_num) - // radar - int nTempParam = radar - int nTempValue = $$g_nAutoRadar$$ - o_game_options[6].nselected = nTempValue - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - // heat - nTempParam = HEAT_PARAMETER - nTempValue = $$g_nAutoHeat$$ - o_game_options[7].state = 0 - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - // friendly fire - nTempParam = FRIENDLY_FIRE_PERCENTGE_PARAMETER - nTempValue = $$g_nAutoFriendlyFire$$ - o_game_options[8].state = 0 - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - // splash - nTempParam = SPLASH_ON_PARAMETER - nTempValue = $$g_nAutoSplash$$ - o_game_options[9].state = 0 - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - // unlimited ammo - nTempParam = UNLIMITED_AMMO_PARAMETER - nTempValue = $$g_nAutoUnlimitedAmmo$$ - o_game_options[10].state = 0 - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - // weapon jam - nTempParam = WEAPON_JAM_PARAMETER - nTempValue = $$g_nAutoWeaponJam$$ - o_game_options[14].state = 0 - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - // advance mode - nTempParam = ADVANCE_MODE_PARAMETER - nTempValue = $$g_nAutoAdvanceMode$$ - o_game_options[15].state = 0 - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) - // armor mode - nTempParam = ARMOR_MODE_PARAMETER - nTempValue = $$g_nAutoArmorMode$$ - o_game_options[16].state = 0 - callback($$SetNetworkMissionParamater$$, nTempParam, nTempValue) initialize(this) - // notify ConLobby: game type/params changed (updates cur_game_type, cur_team_val display) mail(-9998, parent) return }