本文整理汇总了C++中MapComposite::getEverything方法的典型用法代码示例。如果您正苦于以下问题:C++ MapComposite::getEverything方法的具体用法?C++ MapComposite::getEverything怎么用?C++ MapComposite::getEverything使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapComposite
的用法示例。
在下文中一共展示了MapComposite::getEverything方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendStatistics
void AccountConnection::sendStatistics()
{
MessageOut msg(GAMSG_STATISTICS);
const MapManager::Maps &maps = MapManager::getMaps();
for (MapManager::Maps::const_iterator i = maps.begin(),
i_end = maps.end(); i != i_end; ++i)
{
MapComposite *m = i->second;
if (!m->isActive()) continue;
msg.writeInt16(i->first);
int nbEntities = 0, nbMonsters = 0;
typedef std::vector< Entity * > Entities;
const Entities &things = m->getEverything();
std::vector< int > players;
for (Entities::const_iterator j = things.begin(),
j_end = things.end(); j != j_end; ++j)
{
Entity *t = *j;
switch (t->getType())
{
case OBJECT_CHARACTER:
players.push_back
(static_cast< Character * >(t)->getDatabaseID());
break;
case OBJECT_MONSTER:
++nbMonsters;
break;
default:
++nbEntities;
}
}
msg.writeInt16(nbEntities);
msg.writeInt16(nbMonsters);
msg.writeInt16(players.size());
for (std::vector< int >::const_iterator j = players.begin(),
j_end = players.end(); j != j_end; ++j)
{
msg.writeInt32(*j);
}
}
send(msg);
}