本文整理汇总了C++中SavedBattleGame::getMissionType方法的典型用法代码示例。如果您正苦于以下问题:C++ SavedBattleGame::getMissionType方法的具体用法?C++ SavedBattleGame::getMissionType怎么用?C++ SavedBattleGame::getMissionType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SavedBattleGame
的用法示例。
在下文中一共展示了SavedBattleGame::getMissionType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareDebriefing
//.........这里部分代码省略.........
if ((*i) == soldier)
{
delete (*i);
base->getSoldiers()->erase(i);
break;
}
}
}
}
}
if (((playerInExitArea == 0 && aborted) || (playersSurvived == 0)) && craft != 0)
{
addStat("STR_XCOM_CRAFT_LOST", 1, -200);
delete craft;
base->getCrafts()->erase(craftIterator);
for (std::vector<Soldier*>::iterator i = base->getSoldiers()->begin(); i != base->getSoldiers()->end();)
{
if ((*i)->getCraft() == craft)
{
delete (*i);
i = base->getSoldiers()->erase(i);
}
else
{
++i;
}
}
_txtTitle->setText(_game->getLanguage()->getString("STR_CRAFT_IS_LOST"));
return;
}
if (!aborted && playersSurvived > 0) // RECOVER UFO : run through all tiles to recover UFO components and items
{
if (battle->getMissionType() == "STR_BASE_DEFENCE")
{
_txtTitle->setText(_game->getLanguage()->getString("STR_BASE_IS_SAVED"));
}
else
{
_txtTitle->setText(_game->getLanguage()->getString("STR_UFO_IS_RECOVERED"));
}
for (int i = 0; i < battle->getHeight() * battle->getLength() * battle->getWidth(); ++i)
{
for (int part = 0; part < 4; part++)
{
if (battle->getTiles()[i]->getMapData(part))
{
switch (battle->getTiles()[i]->getMapData(part)->getSpecialType())
{
case UFO_POWER_SOURCE:
addStat("STR_UFO_POWER_SOURCE", 1, 1); break;
case DESTROY_OBJECTIVE:break; // this is the brain
case UFO_NAVIGATION:
addStat("STR_UFO_NAVIGATION", 1, 1); break;
case ALIEN_FOOD:
addStat("STR_ALIEN_FOOD", 1, 1); break;
case ALIEN_REPRODUCTION:
addStat("STR_ALIEN_REPRODUCTION", 1, 1); break;
case ALIEN_ENTERTAINMENT:
addStat("STR_ALIEN_ENTERTAINMENT", 1, 1); break;
case ALIEN_SURGERY:
addStat("STR_ALIEN_SURGERY", 1, 1); break;
case UNKNOWN09:
addStat("STR_UFO_CONSTRUCTION", 1, 1); break;
case ALIEN_ALLOYS:
示例2: btnOkClick
/**
* Starts the battle.
* @param action Pointer to an action.
*/
void NewBattleState::btnOkClick(Action *)
{
save();
if (_missionTypes[_cbxMission->getSelected()] != "STR_BASE_DEFENSE" && _craft->getNumSoldiers() == 0 && _craft->getNumVehicles() == 0)
{
return;
}
SavedBattleGame *bgame = new SavedBattleGame();
_game->getSavedGame()->setBattleGame(bgame);
bgame->setMissionType(_missionTypes[_cbxMission->getSelected()]);
BattlescapeGenerator bgen = BattlescapeGenerator(_game);
Base *base = 0;
bgen.setTerrain(_game->getMod()->getTerrain(_terrainTypes[_cbxTerrain->getSelected()]));
// base defense
if (_missionTypes[_cbxMission->getSelected()] == "STR_BASE_DEFENSE")
{
base = _craft->getBase();
bgen.setBase(base);
_craft = 0;
}
// alien base
else if (_game->getMod()->getDeployment(bgame->getMissionType())->isAlienBase())
{
AlienBase *b = new AlienBase(_game->getMod()->getDeployment(bgame->getMissionType()));
b->setId(1);
b->setAlienRace(_alienRaces[_cbxAlienRace->getSelected()]);
_craft->setDestination(b);
bgen.setAlienBase(b);
_game->getSavedGame()->getAlienBases()->push_back(b);
}
// ufo assault
else if (_craft && _game->getMod()->getUfo(_missionTypes[_cbxMission->getSelected()]))
{
Ufo *u = new Ufo(_game->getMod()->getUfo(_missionTypes[_cbxMission->getSelected()]));
u->setId(1);
_craft->setDestination(u);
bgen.setUfo(u);
// either ground assault or ufo crash
if (RNG::generate(0,1) == 1)
{
u->setStatus(Ufo::LANDED);
bgame->setMissionType("STR_UFO_GROUND_ASSAULT");
}
else
{
u->setStatus(Ufo::CRASHED);
bgame->setMissionType("STR_UFO_CRASH_RECOVERY");
}
_game->getSavedGame()->getUfos()->push_back(u);
}
// mission site
else
{
const AlienDeployment *deployment = _game->getMod()->getDeployment(bgame->getMissionType());
const RuleAlienMission *mission = _game->getMod()->getAlienMission(_game->getMod()->getAlienMissionList().front()); // doesn't matter
MissionSite *m = new MissionSite(mission, deployment);
m->setId(1);
m->setAlienRace(_alienRaces[_cbxAlienRace->getSelected()]);
_craft->setDestination(m);
bgen.setMissionSite(m);
_game->getSavedGame()->getMissionSites()->push_back(m);
}
if (_craft)
{
_craft->setSpeed(0);
bgen.setCraft(_craft);
}
_game->getSavedGame()->setDifficulty((GameDifficulty)_cbxDifficulty->getSelected());
bgen.setWorldShade(_slrDarkness->getValue());
bgen.setAlienRace(_alienRaces[_cbxAlienRace->getSelected()]);
bgen.setAlienItemlevel(_slrAlienTech->getValue());
bgame->setDepth(_slrDepth->getValue());
bgen.run();
_game->popState();
_game->popState();
_game->pushState(new BriefingState(_craft, base));
_craft = 0;
}