当前位置: 首页>>代码示例>>C++>>正文


C++ Ufo::getStatus方法代码示例

本文整理汇总了C++中Ufo::getStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ Ufo::getStatus方法的具体用法?C++ Ufo::getStatus怎么用?C++ Ufo::getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ufo的用法示例。


在下文中一共展示了Ufo::getStatus方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ufoLifting

/**
 * This function is called when one of the mission's UFOs has finished it's time on the ground.
 * It takes care of sending the UFO to the next waypoint and marking them for removal as required.
 * It must set the game data in a way that the rest of the code understands what to do.
 * @param ufo The UFO that reached it's waypoint.
 * @param game The saved game information.
 * @param globe The earth globe, required to get access to land checks.
 */
void AlienMission::ufoLifting(Ufo &ufo, SavedGame &game, const Globe &globe)
{
	switch (ufo.getStatus())
	{
	case Ufo::FLYING:
		assert(0 && "Ufo is already on the air!");
		break;
	case Ufo::LANDED:
		{
			// base missions only get points when they are completed.
			if (_rule.getPoints() > 0 && _rule.getObjective() != OBJECTIVE_BASE)
			{
				addScore(ufo.getLongitude(), ufo.getLatitude(), game);
			}
			ufo.setAltitude("STR_VERY_LOW");
			ufo.setSpeed((int)(ufo.getRules()->getMaxSpeed() * ufo.getTrajectory().getSpeedPercentage(ufo.getTrajectoryPoint())));
		}
		break;
	case Ufo::CRASHED:
		// Mission expired
		ufo.setDetected(false);
		ufo.setStatus(Ufo::DESTROYED);
		break;
	case Ufo::DESTROYED:
		assert(0 && "UFO can't fly!");
		break;
	}
}
开发者ID:oculushut,项目名称:OpenXcom,代码行数:36,代码来源:AlienMission.cpp

示例2: btnYesClick

/**
 * Enters the mission.
 * @param action Pointer to an action.
 */
void ConfirmLandingState::btnYesClick(Action *action)
{
	_game->popState();
	Ufo* u = dynamic_cast<Ufo*>(_craft->getDestination());
	TerrorSite* t = dynamic_cast<TerrorSite*>(_craft->getDestination());
	AlienBase* b = dynamic_cast<AlienBase*>(_craft->getDestination());
	if (u != 0)
	{
		SavedBattleGame *bgame = new SavedBattleGame();
		_game->getSavedGame()->setBattleGame(bgame);
		if(u->getStatus() == Ufo::CRASHED)
			bgame->setMissionType("STR_UFO_CRASH_RECOVERY");
		else
			bgame->setMissionType("STR_UFO_GROUND_ASSAULT");
		BattlescapeGenerator bgen = BattlescapeGenerator(_game);
		bgen.setWorldTexture(_texture);
		bgen.setWorldShade(_shade);
		bgen.setCraft(_craft);
		bgen.setUfo(u);
		bgen.setAlienRace(u->getAlienRace());
		bgen.setAlienItemlevel(0);
		bgen.run();

		_game->pushState(new BriefingState(_game, _craft));
	}
	else if (t != 0)
	{
		SavedBattleGame *bgame = new SavedBattleGame();
		_game->getSavedGame()->setBattleGame(bgame);
		bgame->setMissionType("STR_TERROR_MISSION");
		BattlescapeGenerator bgen = BattlescapeGenerator(_game);
		bgen.setWorldTexture(_texture);
		bgen.setWorldShade(_shade);
		bgen.setCraft(_craft);
		bgen.setTerrorSite(t);
		bgen.setAlienRace(t->getAlienRace());
		bgen.setAlienItemlevel(0);
		bgen.run();

		_game->pushState(new BriefingState(_game, _craft));
	}
	else if (b != 0)
	{
		SavedBattleGame *bgame = new SavedBattleGame();
		_game->getSavedGame()->setBattleGame(bgame);
		bgame->setMissionType("STR_ALIEN_BASE_ASSAULT");
		BattlescapeGenerator bgen = BattlescapeGenerator(_game);
		bgen.setWorldTexture(_texture);
		bgen.setWorldShade(_shade);
		bgen.setCraft(_craft);
		bgen.setAlienBase(b);
		bgen.setAlienRace(b->getAlienRace());
		bgen.setAlienItemlevel(0);
		bgen.run();

		_game->pushState(new BriefingState(_game, _craft));
	}
}
开发者ID:Tripphippie,项目名称:OpenXcom,代码行数:62,代码来源:ConfirmLandingState.cpp

示例3: ufoLifting

/**
 * This function is called when one of the mission's UFOs has finished it's time on the ground.
 * It takes care of sending the UFO to the next waypoint and marking them for removal as required.
 * It must set the game data in a way that the rest of the code understands what to do.
 * @param ufo The UFO that reached it's waypoint.
 * @param engine The game engine, required to get access to game data and game rules.
 * @param globe The earth globe, required to get access to land checks.
 */
void AlienMission::ufoLifting(Ufo &ufo, Game &engine, const Globe &globe)
{
	const Ruleset &rules = *engine.getRuleset();
	switch (ufo.getStatus())
	{
	case Ufo::FLYING:
		assert(0 && "Ufo is already on the air!");
		break;
	case Ufo::LANDED:
		{
			if ((ufo.getRules()->getType() == "STR_HARVESTER" && _rule.getType() == "STR_ALIEN_HARVEST") || 
				(ufo.getRules()->getType() == "STR_ABDUCTOR" && _rule.getType() == "STR_ALIEN_ABDUCTION"))
			{
				addScore(ufo.getLongitude(), ufo.getLatitude(), engine);
			}
			assert(ufo.getTrajectoryPoint() != ufo.getTrajectory().getWaypointCount() - 1);
			ufo.setSpeed((int)(ufo.getRules()->getMaxSpeed() * ufo.getTrajectory().getSpeedPercentage(ufo.getTrajectoryPoint())));
			ufo.setAltitude("STR_VERY_LOW");
			// Set next waypoint.
			Waypoint *wp = new Waypoint();
			RuleRegion *region = rules.getRegion(_region);
			std::pair<double, double> pos;
			if (ufo.getTrajectory().getAltitude(ufo.getTrajectoryPoint() + 1) == "STR_GROUND")
			{
				pos = getLandPoint(globe, *region, ufo.getTrajectory().getZone(ufo.getTrajectoryPoint() + 1));
			}
			else
			{
				pos = region->getRandomPoint(ufo.getTrajectory().getZone(ufo.getTrajectoryPoint() + 1));
			}
			wp->setLongitude(pos.first);
			wp->setLatitude(pos.second);
			ufo.setDestination(wp);
			ufo.setTrajectoryPoint(ufo.getTrajectoryPoint() + 1);
		}
		break;
	case Ufo::CRASHED:
		// Mission expired
		ufo.setDetected(false);
		ufo.setStatus(Ufo::DESTROYED);
		break;
	case Ufo::DESTROYED:
		assert(0 && "UFO can't fly!");
		break;
	}
}
开发者ID:AngelusEV,项目名称:OpenXcom,代码行数:54,代码来源:AlienMission.cpp

示例4: btnYesClick

/**
 * Enters the mission.
 * @param action Pointer to an action.
 */
void ConfirmLandingState::btnYesClick(Action *)
{
	_game->popState();
	_state->musicStop();
	Ufo* u = dynamic_cast<Ufo*>(_craft->getDestination());
	TerrorSite* t = dynamic_cast<TerrorSite*>(_craft->getDestination());
	AlienBase* b = dynamic_cast<AlienBase*>(_craft->getDestination());
	size_t month = _game->getSavedGame()->getMonthsPassed();
	if (month > _game->getRuleset()->getAlienItemLevels().size()-1)
		month = _game->getRuleset()->getAlienItemLevels().size()-1;

	SavedBattleGame *bgame = new SavedBattleGame();
	_game->getSavedGame()->setBattleGame(bgame);
	BattlescapeGenerator bgen = BattlescapeGenerator(_game);
	bgen.setWorldTexture(_texture);
	bgen.setWorldShade(_shade);
	bgen.setCraft(_craft);
	if (u != 0)
	{
		if(u->getStatus() == Ufo::CRASHED)
			bgame->setMissionType("STR_UFO_CRASH_RECOVERY");
		else
			bgame->setMissionType("STR_UFO_GROUND_ASSAULT");
		bgen.setUfo(u);
		bgen.setAlienRace(u->getAlienRace());
	}
	else if (t != 0)
	{
		bgame->setMissionType("STR_TERROR_MISSION");
		bgen.setTerrorSite(t);
		bgen.setAlienRace(t->getAlienRace());
	}
	else if (b != 0)
	{
		bgame->setMissionType("STR_ALIEN_BASE_ASSAULT");
		bgen.setAlienBase(b);
		bgen.setAlienRace(b->getAlienRace());
	}
	else
	{
		throw Exception("No mission available!");
	}
	bgen.setAlienItemlevel(_game->getRuleset()->getAlienItemLevels().at(month).at(RNG::generate(0,9)));
	bgen.run();
	_game->pushState(new BriefingState(_game, _craft));
}
开发者ID:2xG,项目名称:OpenXcom,代码行数:50,代码来源:ConfirmLandingState.cpp

示例5: ufoShotDown

/**
 * This function is called when one of the mission's UFOs is shot down (crashed or destroyed).
 * Currently the only thing that happens is delaying the next UFO in the mission sequence.
 * @param ufo The UFO that was shot down.
 * @param engine The game engine, unused for now.
 * @param globe The earth globe, unused for now.
 */
void AlienMission::ufoShotDown(Ufo &ufo, Game &, const Globe &)
{
	switch (ufo.getStatus())
	{
	case Ufo::FLYING:
	case Ufo::LANDED:
		assert(0 && "Ufo seems ok!");
		break;
	case Ufo::CRASHED:
	case Ufo::DESTROYED:
		if (_nextWave != _rule.getWaveCount())
		{
			// Delay next wave
			_spawnCountdown += 30 * (RNG::generate(0, 48) + 400);
		}
		break;
	}
}
开发者ID:AngelusEV,项目名称:OpenXcom,代码行数:25,代码来源:AlienMission.cpp

示例6: btnYesClick

/**
 * Enters the mission.
 * @param action Pointer to an action.
 */
void ConfirmLandingState::btnYesClick(Action *)
{
	_game->popState();
	Ufo* u = dynamic_cast<Ufo*>(_craft->getDestination());
	MissionSite* m = dynamic_cast<MissionSite*>(_craft->getDestination());
	AlienBase* b = dynamic_cast<AlienBase*>(_craft->getDestination());

	SavedBattleGame *bgame = new SavedBattleGame();
	_game->getSavedGame()->setBattleGame(bgame);
	BattlescapeGenerator bgen(_game);
	bgen.setWorldTexture(_texture);
	bgen.setWorldShade(_shade);
	bgen.setCraft(_craft);
	if (u != 0)
	{
		if (u->getStatus() == Ufo::CRASHED)
			bgame->setMissionType("STR_UFO_CRASH_RECOVERY");
		else
			bgame->setMissionType("STR_UFO_GROUND_ASSAULT");
		bgen.setUfo(u);
		bgen.setAlienRace(u->getAlienRace());
	}
	else if (m != 0)
	{
		bgame->setMissionType(m->getDeployment()->getType());
		bgen.setMissionSite(m);
		bgen.setAlienRace(m->getAlienRace());
	}
	else if (b != 0)
	{
		bgame->setMissionType(b->getDeployment()->getType());
		bgen.setAlienBase(b);
		bgen.setAlienRace(b->getAlienRace());
		bgen.setWorldTexture(0);
	}
	else
	{
		throw Exception("No mission available!");
	}
	bgen.run();
	_game->pushState(new BriefingState(_craft));
}
开发者ID:BHSDuncan,项目名称:OpenXcom,代码行数:46,代码来源:ConfirmLandingState.cpp

示例7: if


//.........这里部分代码省略.........
	_txtTitle->setColor(Palette::blockOffset(15)-1);
	_txtTitle->setBig();
	_txtTitle->setText(_craft->getName(_game->getLanguage()));

	_txtStatus->setColor(Palette::blockOffset(15)-1);
	_txtStatus->setSecondaryColor(Palette::blockOffset(8)+10);
	_txtStatus->setWordWrap(true);
	std::wstring status;
	if (_waypoint != 0)
	{
		status = tr("STR_INTERCEPTING_UFO").arg(_waypoint->getId());
	}
	else if (_craft->getLowFuel())
	{
		status = tr("STR_LOW_FUEL_RETURNING_TO_BASE");
	}
	else if (_craft->getDestination() == 0)
	{
		status = tr("STR_PATROLLING");
	}
	else if (_craft->getDestination() == (Target*)_craft->getBase())
	{
		status = tr("STR_RETURNING_TO_BASE");
	}
	else
	{
		Ufo *u = dynamic_cast<Ufo*>(_craft->getDestination());
		if (u != 0)
		{
			if (_craft->isInDogfight())
			{
				status = tr("STR_TAILING_UFO");
			}
			else if (u->getStatus() == Ufo::FLYING)
			{
				status = tr("STR_INTERCEPTING_UFO").arg(u->getId());
			}
			else
			{
				status = tr("STR_DESTINATION_UC_").arg(u->getName(_game->getLanguage()));
			}
		}
		else
		{
			status = tr("STR_DESTINATION_UC_").arg(_craft->getDestination()->getName(_game->getLanguage()));
		}
	}
	_txtStatus->setText(tr("STR_STATUS_").arg(status));

	_txtBase->setColor(Palette::blockOffset(15)-1);
	_txtBase->setSecondaryColor(Palette::blockOffset(8)+5);
	_txtBase->setText(tr("STR_BASE_UC").arg(_craft->getBase()->getName()));

	_txtSpeed->setColor(Palette::blockOffset(15)-1);
	_txtSpeed->setSecondaryColor(Palette::blockOffset(8)+5);
	_txtSpeed->setText(tr("STR_SPEED_").arg(Text::formatNumber(_craft->getSpeed())));

	_txtMaxSpeed->setColor(Palette::blockOffset(15)-1);
	_txtMaxSpeed->setSecondaryColor(Palette::blockOffset(8)+5);
	_txtMaxSpeed->setText(tr("STR_MAXIMUM_SPEED_UC").arg(Text::formatNumber(_craft->getRules()->getMaxSpeed())));

	_txtAltitude->setColor(Palette::blockOffset(15)-1);
	_txtAltitude->setSecondaryColor(Palette::blockOffset(8)+5);
	std::string altitude = _craft->getAltitude() == "STR_GROUND" ? "STR_GROUNDED" : _craft->getAltitude();
	_txtAltitude->setText(tr("STR_ALTITUDE_").arg(tr(altitude)));
开发者ID:AngelusEV,项目名称:OpenXcom,代码行数:66,代码来源:GeoscapeCraftState.cpp

示例8: if


//.........这里部分代码省略.........
	_txtTitle->setText(_craft->getName(_game->getLanguage()));

	_txtStatus->setWordWrap(true);
	std::wstring status;
	if (_waypoint != 0)
	{
		status = tr("STR_INTERCEPTING_UFO").arg(_waypoint->getId());
	}
	else if (_craft->getLowFuel())
	{
		status = tr("STR_LOW_FUEL_RETURNING_TO_BASE");
	}
	else if (_craft->getMissionComplete())
	{
		status = tr("STR_MISSION_COMPLETE_RETURNING_TO_BASE");
	}
	else if (_craft->getDestination() == 0)
	{
		status = tr("STR_PATROLLING");
	}
	else if (_craft->getDestination() == (Target*)_craft->getBase())
	{
		status = tr("STR_RETURNING_TO_BASE");
	}
	else
	{
		Ufo *u = dynamic_cast<Ufo*>(_craft->getDestination());
		if (u != 0)
		{
			if (_craft->isInDogfight())
			{
				status = tr("STR_TAILING_UFO");
			}
			else if (u->getStatus() == Ufo::FLYING)
			{
				status = tr("STR_INTERCEPTING_UFO").arg(u->getId());
			}
			else
			{
				status = tr("STR_DESTINATION_UC_").arg(u->getName(_game->getLanguage()));
			}
		}
		else
		{
			status = tr("STR_DESTINATION_UC_").arg(_craft->getDestination()->getName(_game->getLanguage()));
		}
	}
	_txtStatus->setText(tr("STR_STATUS_").arg(status));

	_txtBase->setText(tr("STR_BASE_UC").arg(_craft->getBase()->getName()));

	int speed = _craft->getSpeed();
	if (_craft->isInDogfight())
	{
		Ufo *ufo = dynamic_cast<Ufo*>(_craft->getDestination());
		if (ufo)
		{
			speed = ufo->getSpeed();
		}
	}
	_txtSpeed->setText(tr("STR_SPEED_").arg(Text::formatNumber(speed)));

	_txtMaxSpeed->setText(tr("STR_MAXIMUM_SPEED_UC").arg(Text::formatNumber(_craft->getRules()->getMaxSpeed())));

	std::string altitude = _craft->getAltitude() == "STR_GROUND" ? "STR_GROUNDED" : _craft->getAltitude();
	if (_craft->getRules()->isWaterOnly() && !_globe->insideLand(_craft->getLongitude(), _craft->getLatitude()))
开发者ID:DiceMaster,项目名称:OpenXcom,代码行数:67,代码来源:GeoscapeCraftState.cpp

示例9: if


//.........这里部分代码省略.........
	_btnCancel->setColor(Palette::blockOffset(8)+5);
	_btnCancel->setText(_game->getLanguage()->getString("STR_CANCEL_UC"));
	_btnCancel->onMouseClick((ActionHandler)&GeoscapeCraftState::btnCancelClick);

	_txtTitle->setColor(Palette::blockOffset(15)-1);
	_txtTitle->setBig();
	_txtTitle->setText(_craft->getName(_game->getLanguage()));

	_txtStatus->setColor(Palette::blockOffset(15)-1);
	_txtStatus->setSecondaryColor(Palette::blockOffset(8)+10);
	std::wstringstream ss;
	ss << _game->getLanguage()->getString("STR_STATUS_") << L'\x01';
	if (_waypoint != 0)
	{
		ss << _game->getLanguage()->getString("STR_INTERCEPTING_UFO") << _waypoint->getId();
	}
	else if (_craft->getLowFuel())
	{
		ss << _game->getLanguage()->getString("STR_LOW_FUEL_RETURNING_TO_BASE");
	}
	else if (_craft->getDestination() == 0)
	{
		ss << _game->getLanguage()->getString("STR_PATROLLING");
	}
	else if (_craft->getDestination() == (Target*)_craft->getBase())
	{
		ss << _game->getLanguage()->getString("STR_RETURNING_TO_BASE");
	}
	else
	{
		Ufo *u = dynamic_cast<Ufo*>(_craft->getDestination());
		if (u != 0)
		{
			if (u->getStatus() == Ufo::FLYING)
			{
				ss << _game->getLanguage()->getString("STR_INTERCEPTING_UFO") << u->getId();
			}
			else
			{
				ss << _game->getLanguage()->getString("STR_DESTINATION_UC_") << u->getName(_game->getLanguage());
			}
		}
		else
		{
			ss << _game->getLanguage()->getString("STR_DESTINATION_UC_") << _craft->getDestination()->getName(_game->getLanguage());
		}
	}
	_txtStatus->setText(ss.str());

	_txtBase->setColor(Palette::blockOffset(15)-1);
	_txtBase->setSecondaryColor(Palette::blockOffset(8)+5);
	std::wstringstream ss2;
	ss2 << _game->getLanguage()->getString("STR_BASE_UC_") << L'\x01' << _craft->getBase()->getName();
	_txtBase->setText(ss2.str());

	_txtSpeed->setColor(Palette::blockOffset(15)-1);
	_txtSpeed->setSecondaryColor(Palette::blockOffset(8)+5);
	std::wstringstream ss3;
	ss3 << _game->getLanguage()->getString("STR_SPEED_") << L'\x01' << _craft->getSpeed();
	_txtSpeed->setText(ss3.str());

	_txtMaxSpeed->setColor(Palette::blockOffset(15)-1);
	_txtMaxSpeed->setSecondaryColor(Palette::blockOffset(8)+5);
	std::wstringstream ss4;
	ss4 << _game->getLanguage()->getString("STR_MAXIMUM_SPEED_UC") << L'\x01' << _craft->getRules()->getMaxSpeed();
	_txtMaxSpeed->setText(ss4.str());
开发者ID:Munkeylord,项目名称:OpenXcom,代码行数:67,代码来源:GeoscapeCraftState.cpp


注:本文中的Ufo::getStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。