本文整理汇总了C++中BattleItem::getStimulantQuantity方法的典型用法代码示例。如果您正苦于以下问题:C++ BattleItem::getStimulantQuantity方法的具体用法?C++ BattleItem::getStimulantQuantity怎么用?C++ BattleItem::getStimulantQuantity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BattleItem
的用法示例。
在下文中一共展示了BattleItem::getStimulantQuantity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invClick
/**
* Updates item info.
* @param action Pointer to an action.
*/
void InventoryState::invClick(Action *)
{
BattleItem *item = _inv->getSelectedItem();
_txtItem->setText(L"");
_txtAmmo->setText(L"");
_selAmmo->clear();
if (item != 0)
{
if (item->getUnit() && item->getUnit()->getStatus() == STATUS_UNCONSCIOUS)
{
_txtItem->setText(item->getUnit()->getName(_game->getLanguage()));
}
else
{
if (_game->getSavedGame()->isResearched(item->getRules()->getRequirements()))
{
_txtItem->setText(tr(item->getRules()->getName()));
}
else
{
_txtItem->setText(tr("STR_ALIEN_ARTIFACT"));
}
}
std::wstring s;
if (item->getAmmoItem() != 0 && item->needsAmmo())
{
s = tr("STR_AMMO_ROUNDS_LEFT").arg(item->getAmmoItem()->getAmmoQuantity());
SDL_Rect r;
r.x = 0;
r.y = 0;
r.w = RuleInventory::HAND_W * RuleInventory::SLOT_W;
r.h = RuleInventory::HAND_H * RuleInventory::SLOT_H;
_selAmmo->drawRect(&r, Palette::blockOffset(0)+8);
r.x++;
r.y++;
r.w -= 2;
r.h -= 2;
_selAmmo->drawRect(&r, 0);
item->getAmmoItem()->getRules()->drawHandSprite(_game->getResourcePack()->getSurfaceSet("BIGOBS.PCK"), _selAmmo);
}
else if (item->getAmmoQuantity() != 0 && item->needsAmmo())
{
s = tr("STR_AMMO_ROUNDS_LEFT").arg(item->getAmmoQuantity());
}
else if (item->getRules()->getBattleType() == BT_MEDIKIT)
{
s = tr("STR_MEDI_KIT_QUANTITIES_LEFT").arg(item->getPainKillerQuantity()).arg(item->getStimulantQuantity()).arg(item->getHealQuantity());
}
_txtAmmo->setText(s);
}
updateStats();
}
示例2: invMouseOver
/**
* Shows item info.
* @param action Pointer to an action.
*/
void InventoryState::invMouseOver(Action *)
{
if (_inv->getSelectedItem() != 0)
{
return;
}
BattleItem *item = _inv->getMouseOverItem();
if (item != 0)
{
if (item->getUnit() && item->getUnit()->getStatus() == STATUS_UNCONSCIOUS)
{
_txtItem->setText(item->getUnit()->getName(_game->getLanguage()));
}
else
{
if (_game->getSavedGame()->isResearched(item->getRules()->getRequirements()))
{
_txtItem->setText(tr(item->getRules()->getName()));
}
else
{
_txtItem->setText(tr("STR_ALIEN_ARTIFACT"));
}
}
std::wstring s;
if (item->getAmmoItem() != 0 && item->needsAmmo())
{
s = tr("STR_AMMO_ROUNDS_LEFT").arg(item->getAmmoItem()->getAmmoQuantity());
SDL_Rect r;
r.x = 0;
r.y = 0;
r.w = RuleInventory::HAND_W * RuleInventory::SLOT_W;
r.h = RuleInventory::HAND_H * RuleInventory::SLOT_H;
_selAmmo->drawRect(&r, _game->getMod()->getInterface("inventory")->getElement("grid")->color);
r.x++;
r.y++;
r.w -= 2;
r.h -= 2;
_selAmmo->drawRect(&r, Palette::blockOffset(0)+15);
item->getAmmoItem()->getRules()->drawHandSprite(_game->getMod()->getSurfaceSet("BIGOBS.PCK"), _selAmmo);
_updateTemplateButtons(false);
}
else
{
_selAmmo->clear();
_updateTemplateButtons(!_tu);
}
if (item->getAmmoQuantity() != 0 && item->needsAmmo())
{
s = tr("STR_AMMO_ROUNDS_LEFT").arg(item->getAmmoQuantity());
}
else if (item->getRules()->getBattleType() == BT_MEDIKIT)
{
s = tr("STR_MEDI_KIT_QUANTITIES_LEFT").arg(item->getPainKillerQuantity()).arg(item->getStimulantQuantity()).arg(item->getHealQuantity());
}
_txtAmmo->setText(s);
}
else
{
if (_currentTooltip.empty())
{
_txtItem->setText(L"");
}
_txtAmmo->setText(L"");
_selAmmo->clear();
_updateTemplateButtons(!_tu);
}
}