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


C++ BaseFacility::setBuildTime方法代码示例

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


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

示例1: viewClick

/**
 * Processes clicking on facilities.
 * @param action Pointer to an action.
 */
void PlaceFacilityState::viewClick(Action *)
{
	if (!_view->isPlaceable(_rule))
	{
		_game->pushState(new ErrorMessageState(tr("STR_CANNOT_BUILD_HERE"), _palette, _game->getRuleset()->getInterface("placeFacility")->getElement("errorMessage")->color, "BACK01.SCR", _game->getRuleset()->getInterface("placeFacility")->getElement("errorPalette")->color));
	}
	else if (_game->getSavedGame()->getFunds() < _rule->getBuildCost())
	{
		_game->popState();
		_game->pushState(new ErrorMessageState(tr("STR_NOT_ENOUGH_MONEY"), _palette, _game->getRuleset()->getInterface("placeFacility")->getElement("errorMessage")->color, "BACK01.SCR", _game->getRuleset()->getInterface("placeFacility")->getElement("errorPalette")->color));
	}
	else
	{
		BaseFacility *fac = new BaseFacility(_rule, _base);
		fac->setX(_view->getGridX());
		fac->setY(_view->getGridY());
		fac->setBuildTime(_rule->getBuildTime());
		_base->getFacilities()->push_back(fac);
		if (Options::allowBuildingQueue)
		{
			if (_view->isQueuedBuilding(_rule)) fac->setBuildTime(std::numeric_limits<int>::max());
			_view->reCalcQueuedBuildings();
		}
		_game->getSavedGame()->setFunds(_game->getSavedGame()->getFunds() - _rule->getBuildCost());
		_game->popState();
	}
}
开发者ID:kaizhu256,项目名称:OpenXcom,代码行数:31,代码来源:PlaceFacilityState.cpp

示例2: viewClick

/**
 * Processes clicking on facilities.
 * @param action Pointer to an action.
 */
void PlaceLiftState::viewClick(Action *action)
{
	BaseFacility *fac = new BaseFacility(_game->getRuleset()->getBaseFacility("STR_ACCESS_LIFT"), _base, _view->getGridX(), _view->getGridY());
	fac->setBuildTime(0);
	_base->getFacilities()->push_back(fac);
	_game->popState();
	_game->pushState(new BasescapeState(_game, _base, _globe));
}
开发者ID:UnkLegacy,项目名称:OpenXcom,代码行数:12,代码来源:PlaceLiftState.cpp

示例3: viewClick

/**
 * Processes clicking on facilities.
 * @param action Pointer to an action.
 */
void PlaceFacilityState::viewClick(Action *action)
{
	if (!_view->isPlaceable(_rule))
	{
		_game->popState();
		_game->pushState(new BasescapeErrorState(_game, "STR_CANNOT_BUILD_HERE"));
	}
	else if (_game->getSavedGame()->getFunds() < _rule->getBuildCost())
	{
		_game->popState();
		_game->pushState(new BasescapeErrorState(_game, "STR_NOT_ENOUGH_MONEY"));
	}
	else
	{
		BaseFacility *fac = new BaseFacility(_rule, _base, _view->getGridX(), _view->getGridY());
		fac->setBuildTime(_rule->getBuildTime());
		_base->getFacilities()->push_back(fac);
		_game->getSavedGame()->setFunds(_game->getSavedGame()->getFunds() - _rule->getBuildCost());
		_game->popState();
	}
}
开发者ID:Devanon,项目名称:OpenXcom,代码行数:25,代码来源:PlaceFacilityState.cpp

示例4: viewClick

/**
 * Processes clicking on facilities.
 * @param action Pointer to an action.
 */
void PlaceFacilityState::viewClick(Action *action)
{
	if (!_view->isPlaceable(_rule))
	{
		_game->popState();
		_game->pushState(new ErrorMessageState(_game, "STR_CANNOT_BUILD_HERE", Palette::blockOffset(15)+1, "BACK01.SCR", 6));
	}
	else if (_game->getSavedGame()->getFunds() < _rule->getBuildCost())
	{
		_game->popState();
		_game->pushState(new ErrorMessageState(_game, "STR_NOT_ENOUGH_MONEY", Palette::blockOffset(15)+1, "BACK01.SCR", 6));
	}
	else
	{
		BaseFacility *fac = new BaseFacility(_rule, _base);
		fac->setX(_view->getGridX());
		fac->setY(_view->getGridY());
		fac->setBuildTime(_rule->getBuildTime());
		_base->getFacilities()->push_back(fac);
		_game->getSavedGame()->setFunds(_game->getSavedGame()->getFunds() - _rule->getBuildCost());
		_game->popState();
	}
}
开发者ID:Munkeylord,项目名称:OpenXcom,代码行数:27,代码来源:PlaceFacilityState.cpp


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