MCPcopy Create free account
hub / github.com/bwapi/bwapi / onMenuFrame

Method onMenuFrame

bwapi/BWAPI/Source/BWAPI/AutoMenuManager.cpp:200–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void AutoMenuManager::onMenuFrame()
201{
202 static DWORD createdTimer;
203 static DWORD waitJoinTimer;
204 static DWORD waitSelRaceTimer;
205 static DWORD waitRestartTimer;
206
207 // Don't attempt auto-menu if we run into 50 error message boxes
208 if (this->autoMapTryCount > 50)
209 return;
210
211 // Return if autoMenu is not enabled
212 if (this->autoMenuMode == "" || this->autoMenuMode == "OFF")
213 return;
214
215#ifdef _DEBUG
216 // Wait for a debugger if autoMenuPause is enabled, and in DEBUG
217 if (this->autoMenuPause != "OFF" && !IsDebuggerPresent())
218 return;
219#endif
220
221 // Get the menu mode
222 int menu = BW::BWDATA::glGluesMode;
223
224 // Declare a commonly used dialog pointer
225 BW::dialog *tempDlg = nullptr;
226
227 // Get some autoMenu properties
228 bool isAutoSingle = this->autoMenuMode == "SINGLE_PLAYER";
229 bool isCreating = !this->autoMenuMapPath.empty();
230 bool isJoining = !this->autoMenuGameName.empty();
231
232 // Reset raceSel flag
233 if (menu != BW::GLUE_CHAT)
234 {
235 this->actRaceSel = false;
236 this->actStartedGame = false;
237 }
238
239 // Iterate through the menus
240 switch (menu)
241 {
242 case BW::GLUE_MAIN_MENU: // Main menu
243 if (BW::FindDialogGlobal("TitleDlg")) // skip if at title
244 break;
245
246 // Choose single or multi
247 pressDialogKey(BW::FindDialogGlobal("MainMenu")->findIndex(isAutoSingle ? 3 : 4));
248
249 // choose original or expansion (we always choose expansion)
250 if (BW::FindDialogGlobal("Delete"))
251 pressDialogKey(BW::FindDialogGlobal("Delete")->findIndex(7));
252 break;
253 case BW::GLUE_EX_CAMPAIGN: // Campaign selection menu
254 case BW::GLUE_CAMPAIGN:
255 // Choose "Custom"
256 pressDialogKey(BW::FindDialogGlobal("RaceSelection")->findIndex(10));
257 break;

Callers

nothing calls this directly

Calls 15

chooseNewRandomMapMethod · 0.95
FindDialogGlobalFunction · 0.85
getFileTypeFunction · 0.85
getLobbyPlayerReadyCountFunction · 0.85
getLobbyPlayerCountFunction · 0.85
getLobbyOpenCountFunction · 0.85
findIndexMethod · 0.80
getSelectedValueMethod · 0.80
setSelectedByValueMethod · 0.80
getSelectedStringMethod · 0.80
setSelectedByStringMethod · 0.80
getSelectedIndexMethod · 0.80

Tested by

no test coverage detected