本文整理汇总了C++中SpectatorVec::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ SpectatorVec::empty方法的具体用法?C++ SpectatorVec::empty怎么用?C++ SpectatorVec::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpectatorVec
的用法示例。
在下文中一共展示了SpectatorVec::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeCondition
bool ConditionRegeneration::executeCondition(Creature* creature, int32_t interval)
{
internalHealthTicks += interval;
internalManaTicks += interval;
if (creature->getZone() != ZONE_PROTECTION) {
if (internalHealthTicks >= healthTicks) {
internalHealthTicks = 0;
int32_t realHealthGain = creature->getHealth();
creature->changeHealth(healthGain);
realHealthGain = creature->getHealth() - realHealthGain;
if (isBuff && realHealthGain > 0) {
Player* player = creature->getPlayer();
if (player) {
std::string healString = std::to_string(realHealthGain) + (realHealthGain != 1 ? " hitpoints." : " hitpoint.");
TextMessage message(MESSAGE_HEALED, "You were healed for " + healString);
message.position = player->getPosition();
message.primary.value = realHealthGain;
message.primary.color = TEXTCOLOR_MAYABLUE;
player->sendTextMessage(message);
SpectatorVec list;
g_game.map.getSpectators(list, player->getPosition(), false, true);
list.erase(player);
if (!list.empty()) {
message.type = MESSAGE_HEALED_OTHERS;
message.text = player->getName() + " was healed for " + healString;
for (Creature* spectator : list) {
spectator->getPlayer()->sendTextMessage(message);
}
}
}
}
}
if (internalManaTicks >= manaTicks) {
internalManaTicks = 0;
creature->changeMana(manaGain);
}
}
return ConditionGeneric::executeCondition(creature, interval);
}
示例2: onGainExperience
void Creature::onGainExperience(uint64_t gainExp, Creature* target)
{
if (gainExp == 0 || !master) {
return;
}
gainExp /= 2;
master->onGainExperience(gainExp, target);
SpectatorVec list;
g_game.map.getSpectators(list, position, false, true);
if (list.empty()) {
return;
}
TextMessage message(MESSAGE_EXPERIENCE_OTHERS, ucfirst(getNameDescription()) + " gained " + std::to_string(gainExp) + (gainExp != 1 ? " experience points." : " experience point."));
message.position = position;
message.primary.color = TEXTCOLOR_WHITE_EXP;
message.primary.value = gainExp;
for (Creature* spectator : list) {
spectator->getPlayer()->sendTextMessage(message);
}
}