本文整理汇总了C++中MoveListMap类的典型用法代码示例。如果您正苦于以下问题:C++ MoveListMap类的具体用法?C++ MoveListMap怎么用?C++ MoveListMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MoveListMap类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addEvent
void MoveEvents::addEvent(MoveEvent* moveEvent, const int32_t& id, MoveListMap& map)
{
MoveListMap::iterator it = map.find(id);
if (it == map.end())
{
MoveEventList moveEventList;
moveEventList.moveEvent[moveEvent->getEventType()].push_back(moveEvent);
map[id] = moveEventList;
}
else
{
std::list<MoveEvent*>& moveEventList = it->second.moveEvent[moveEvent->getEventType()];
for (std::list<MoveEvent*>::iterator it = moveEventList.begin(); it != moveEventList.end(); ++it)
{
if ((*it)->getSlot() == moveEvent->getSlot())
{
std::cout << "Warning: [MoveEvents::addEvent] Duplicate move event found: " << id << std::endl;
}
}
moveEventList.push_back(moveEvent);
}
}
示例2: clearMap
inline void MoveEvents::clearMap(MoveListMap& map)
{
for(MoveListMap::iterator it = map.begin(); it != map.end(); ++it)
{
for(int32_t i = MOVE_EVENT_FIRST; i <= MOVE_EVENT_LAST; ++i)
{
EventList& moveEventList = it->second.moveEvent[i];
for(EventList::iterator it = moveEventList.begin(); it != moveEventList.end(); ++it)
delete (*it);
moveEventList.clear();
}
}
map.clear();
}
示例3: addEvent
void MoveEvents::addEvent(MoveEvent* moveEvent, int32_t id, MoveListMap& map)
{
auto it = map.find(id);
if (it == map.end()) {
MoveEventList moveEventList;
moveEventList.moveEvent[moveEvent->getEventType()].push_back(moveEvent);
map[id] = moveEventList;
} else {
std::list<MoveEvent*>& moveEventList = it->second.moveEvent[moveEvent->getEventType()];
for (MoveEvent* existingMoveEvent : moveEventList) {
if (existingMoveEvent->getSlot() == moveEvent->getSlot()) {
std::cout << "[Warning - MoveEvents::addEvent] Duplicate move event found: " << id << std::endl;
}
}
moveEventList.push_back(moveEvent);
}
}
示例4: clearMap
void MoveEvents::clearMap(MoveListMap& map)
{
std::unordered_set<MoveEvent*> set;
for (const auto& it : map) {
const MoveEventList& moveEventList = it.second;
for (int32_t i = 0; i < MOVE_EVENT_LAST; ++i) {
for (MoveEvent* moveEvent : moveEventList.moveEvent[i]) {
set.insert(moveEvent);
}
}
}
map.clear();
for (MoveEvent* moveEvent : set) {
delete moveEvent;
}
}
示例5: clearMap
void MoveEvents::clearMap(MoveListMap& map)
{
std::unordered_set<MoveEvent*> set;
for (const auto& it : map) {
const MoveEventList& moveEventList = it.second;
for (const auto& i : moveEventList.moveEvent) {
for (MoveEvent* moveEvent : i) {
set.insert(moveEvent);
}
}
}
map.clear();
for (MoveEvent* moveEvent : set) {
delete moveEvent;
}
}