本文整理汇总了C++中BaseFacility::setX方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseFacility::setX方法的具体用法?C++ BaseFacility::setX怎么用?C++ BaseFacility::setX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseFacility
的用法示例。
在下文中一共展示了BaseFacility::setX方法的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();
}
}
示例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);
fac->setX(_view->getGridX());
fac->setY(_view->getGridY());
_base->getFacilities()->push_back(fac);
_game->popState();
_game->pushState(new BasescapeState(_game, _base, _globe));
}
示例3: viewClick
/**
* Processes clicking on facilities.
* @param action Pointer to an action.
*/
void PlaceLiftState::viewClick(Action *)
{
BaseFacility *fac = new BaseFacility(_game->getRuleset()->getBaseFacility("STR_ACCESS_LIFT"), _base);
fac->setX(_view->getGridX());
fac->setY(_view->getGridY());
_base->getFacilities()->push_back(fac);
_game->popState();
BasescapeState *bState = new BasescapeState(_game, _base, _globe);
_game->pushState(bState);
if (_first)
{
_game->pushState(new SelectStartFacilityState(_game, _base, bState, _globe));
}
}
示例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();
}
}