Ejemplo n.º 1
0
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);
	}
}
Ejemplo n.º 2
0
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);
	}
}