本文整理汇总了C++中BaseFacility::inUse方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseFacility::inUse方法的具体用法?C++ BaseFacility::inUse怎么用?C++ BaseFacility::inUse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseFacility
的用法示例。
在下文中一共展示了BaseFacility::inUse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viewClick
/**
* Processes clicking on facilities.
* @param action Pointer to an action.
*/
void BasescapeState::viewClick(Action *action)
{
BaseFacility *fac = _view->getSelectedFacility();
if (fac != 0)
{
// Pre-calculate values to ensure base stays connected
int x = -1, y = -1, squares = 0;
for (std::vector<BaseFacility*>::iterator i = _base->getFacilities()->begin(); i != _base->getFacilities()->end(); i++)
{
if ((*i)->getRules()->getLift())
{
x = (*i)->getX();
y = (*i)->getY();
}
squares += (*i)->getRules()->getSize() * (*i)->getRules()->getSize();
}
squares -= fac->getRules()->getSize() * fac->getRules()->getSize();
// Is facility in use?
if (fac->inUse())
{
_game->pushState(new BasescapeErrorState(_game, "STR_FACILITY_IN_USE"));
}
// Would base become disconnected? (ocuppied squares connected to Access Lift < total squares occupied by base)
else if (_view->countConnected(x, y, 0, fac) < squares)
{
_game->pushState(new BasescapeErrorState(_game, "STR_CANNOT_DISMANTLE_FACILITY"));
}
else
{
_game->pushState(new DismantleFacilityState(_game, _base, fac));
}
}
}
示例2: viewLeftClick
/**
* Processes clicking on facilities.
* @param action Pointer to an action.
*/
void BasescapeState::viewLeftClick(Action *)
{
BaseFacility *fac = _view->getSelectedFacility();
if (fac != 0)
{
// Is facility in use?
if (fac->inUse())
{
_game->pushState(new ErrorMessageState(_game, "STR_FACILITY_IN_USE", Palette::blockOffset(15)+1, "BACK13.SCR", 6));
}
// Would base become disconnected?
else if (!_base->getDisconnectedFacilities(fac).empty())
{
_game->pushState(new ErrorMessageState(_game, "STR_CANNOT_DISMANTLE_FACILITY", Palette::blockOffset(15)+1, "BACK13.SCR", 6));
}
else
{
_game->pushState(new DismantleFacilityState(_game, _base, _view, fac));
}
}
}
示例3: viewLeftClick
/**
* Processes clicking on facilities.
* @param action Pointer to an action.
*/
void BasescapeState::viewLeftClick(Action *)
{
BaseFacility *fac = _view->getSelectedFacility();
if (fac != 0)
{
// Is facility in use?
if (fac->inUse())
{
_game->pushState(new ErrorMessageState(tr("STR_FACILITY_IN_USE"), _palette, _game->getMod()->getInterface("basescape")->getElement("errorMessage")->color, "BACK13.SCR", _game->getMod()->getInterface("basescape")->getElement("errorPalette")->color));
}
// Would base become disconnected?
else if (!_base->getDisconnectedFacilities(fac).empty())
{
_game->pushState(new ErrorMessageState(tr("STR_CANNOT_DISMANTLE_FACILITY"), _palette, _game->getMod()->getInterface("basescape")->getElement("errorMessage")->color, "BACK13.SCR", _game->getMod()->getInterface("basescape")->getElement("errorPalette")->color));
}
else
{
_game->pushState(new DismantleFacilityState(_base, _view, fac));
}
}
}