mirror of
https://github.com/edubart/otclient.git
synced 2025-04-29 01:09:20 +02:00
Use std::deque for queues (#1112)
This commit is contained in:
parent
83959e5e23
commit
b3d947d4c3
@ -763,7 +763,7 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
|
||||
}
|
||||
|
||||
std::unordered_map<Position, Node*, PositionHasher> nodes;
|
||||
std::priority_queue<std::pair<Node*, float>, std::vector<std::pair<Node*, float>>, LessNode> searchList;
|
||||
std::priority_queue<std::pair<Node*, float>, std::deque<std::pair<Node*, float>>, LessNode> searchList;
|
||||
|
||||
Node *currentNode = new Node(startPos);
|
||||
currentNode->pos = startPos;
|
||||
|
@ -74,7 +74,7 @@ void EventDispatcher::poll()
|
||||
event->execute();
|
||||
}
|
||||
m_pollEventsSize = m_eventList.size();
|
||||
|
||||
|
||||
loops++;
|
||||
}
|
||||
}
|
||||
@ -116,4 +116,3 @@ EventPtr EventDispatcher::addEvent(const std::function<void()>& callback, bool p
|
||||
m_eventList.push_back(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -40,10 +40,10 @@ public:
|
||||
ScheduledEventPtr cycleEvent(const std::function<void()>& callback, int delay);
|
||||
|
||||
private:
|
||||
std::list<EventPtr> m_eventList;
|
||||
std::deque<EventPtr> m_eventList;
|
||||
int m_pollEventsSize;
|
||||
stdext::boolean<false> m_disabled;
|
||||
std::priority_queue<ScheduledEventPtr, std::vector<ScheduledEventPtr>, lessScheduledEvent> m_scheduledEventList;
|
||||
std::priority_queue<ScheduledEventPtr, std::deque<ScheduledEventPtr>, lessScheduledEvent> m_scheduledEventList;
|
||||
};
|
||||
|
||||
extern EventDispatcher g_dispatcher;
|
||||
|
@ -36,8 +36,8 @@ void microsleep(size_t us);
|
||||
struct timer {
|
||||
public:
|
||||
timer() { restart(); }
|
||||
float elapsed_seconds() { return (float)((stdext::micros() - m_start)/1000000.0); }
|
||||
ticks_t elapsed_millis() { return (stdext::micros() - m_start)/1000; }
|
||||
float elapsed_seconds() { return (stdext::micros() - m_start) / 1000000.f; }
|
||||
ticks_t elapsed_millis() { return (stdext::micros() - m_start) / 1000; }
|
||||
ticks_t elapsed_micros() { return stdext::micros() - m_start; }
|
||||
void restart() { m_start = stdext::micros(); }
|
||||
private:
|
||||
@ -47,4 +47,3 @@ private:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user