本文整理汇总了C++中ThingPtr::getTile方法的典型用法代码示例。如果您正苦于以下问题:C++ ThingPtr::getTile方法的具体用法?C++ ThingPtr::getTile怎么用?C++ ThingPtr::getTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThingPtr
的用法示例。
在下文中一共展示了ThingPtr::getTile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeThing
bool Map::removeThing(const ThingPtr& thing)
{
if(!thing)
return false;
bool ret = false;
if(thing->isMissile()) {
MissilePtr missile = thing->static_self_cast<Missile>();
int z = missile->getPosition().z;
auto it = std::find(m_floorMissiles[z].begin(), m_floorMissiles[z].end(), missile);
if(it != m_floorMissiles[z].end()) {
m_floorMissiles[z].erase(it);
ret = true;
}
} else if(thing->isAnimatedText()) {
AnimatedTextPtr animatedText = thing->static_self_cast<AnimatedText>();
auto it = std::find(m_animatedTexts.begin(), m_animatedTexts.end(), animatedText);
if(it != m_animatedTexts.end()) {
m_animatedTexts.erase(it);
ret = true;
}
} else if(thing->isStaticText()) {
StaticTextPtr staticText = thing->static_self_cast<StaticText>();
auto it = std::find(m_staticTexts.begin(), m_staticTexts.end(), staticText);
if(it != m_staticTexts.end()) {
m_staticTexts.erase(it);
ret = true;
}
} else if(const TilePtr& tile = thing->getTile())
ret = tile->removeThing(thing);
notificateTileUpdate(thing->getPosition());
return ret;
}
示例2: removeThingColor
void Map::removeThingColor(const ThingPtr& thing)
{
if(!thing)
return;
if(thing->isItem())
thing->static_self_cast<Item>()->setColor(Color::alpha);
else if(thing->isCreature()) {
const TilePtr& tile = thing->getTile();
assert(tile);
const ThingPtr& topThing = tile->getTopThing();
assert(topThing);
topThing->static_self_cast<Item>()->setColor(Color::alpha);
}
}
示例3: colorizeThing
void Map::colorizeThing(const ThingPtr& thing, const Color& color)
{
if(!thing)
return;
if(thing->isItem())
thing->static_self_cast<Item>()->setColor(color);
else if(thing->isCreature()) {
const TilePtr& tile = thing->getTile();
assert(tile);
const ThingPtr& topThing = tile->getTopThing();
assert(topThing);
topThing->static_self_cast<Item>()->setColor(color);
}
}