void SinglePlayerMenu::OnCampaign() { int player; HouseChoiceMenu* pHouseChoiceMenu = new HouseChoiceMenu(); if(pHouseChoiceMenu == NULL) { perror("SinglePlayerMenu::OnCampaign()"); exit(EXIT_FAILURE); } player = pHouseChoiceMenu->showMenu(); delete pHouseChoiceMenu; if(player < 0) { return; } GameInitSettings init((HOUSETYPE) player, settings.General.ConcreteRequired, settings.General.FogOfWar); for(int houseID = 0; houseID < NUM_HOUSES; houseID++) { if(houseID == player) { GameInitSettings::HouseInfo humanHouseInfo((HOUSETYPE) player, 1); humanHouseInfo.addPlayerInfo( GameInitSettings::PlayerInfo(settings.General.PlayerName, "HumanPlayer") ); init.addHouseInfo(humanHouseInfo); } else { GameInitSettings::HouseInfo aiHouseInfo((HOUSETYPE) houseID, 2); aiHouseInfo.addPlayerInfo( GameInitSettings::PlayerInfo(getHouseNameByNumber( (HOUSETYPE) houseID), "AIPlayer", stringify(settings.playerDifficulty)) ); init.addHouseInfo(aiHouseInfo); } } startSinglePlayerGame(init); quit(); }
void SinglePlayerSkirmishMenu::onStart() { HOUSETYPE houseChoice = (HOUSETYPE) houseOrder[currentHouseChoiceScrollPos + selectedButton]; GameInitSettings init(houseChoice,mission,currentGameOptions); for(int houseID = 0; houseID < NUM_HOUSES; houseID++) { if(houseID == houseChoice) { GameInitSettings::HouseInfo humanHouseInfo(houseChoice, 1); humanHouseInfo.addPlayerInfo( GameInitSettings::PlayerInfo(settings.general.playerName, HUMANPLAYERCLASS) ); init.addHouseInfo(humanHouseInfo); } else { GameInitSettings::HouseInfo aiHouseInfo((HOUSETYPE) houseID, 2); aiHouseInfo.addPlayerInfo( GameInitSettings::PlayerInfo(getHouseNameByNumber( (HOUSETYPE) houseID), settings.ai.campaignAI) ); init.addHouseInfo(aiHouseInfo); } } startSinglePlayerGame(init); quit(); }