mirror of
https://github.com/edubart/otclient.git
synced 2025-04-29 17:19: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::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);
|
Node *currentNode = new Node(startPos);
|
||||||
currentNode->pos = startPos;
|
currentNode->pos = startPos;
|
||||||
|
@ -116,4 +116,3 @@ EventPtr EventDispatcher::addEvent(const std::function<void()>& callback, bool p
|
|||||||
m_eventList.push_back(event);
|
m_eventList.push_back(event);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ public:
|
|||||||
ScheduledEventPtr cycleEvent(const std::function<void()>& callback, int delay);
|
ScheduledEventPtr cycleEvent(const std::function<void()>& callback, int delay);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<EventPtr> m_eventList;
|
std::deque<EventPtr> m_eventList;
|
||||||
int m_pollEventsSize;
|
int m_pollEventsSize;
|
||||||
stdext::boolean<false> m_disabled;
|
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;
|
extern EventDispatcher g_dispatcher;
|
||||||
|
@ -36,8 +36,8 @@ void microsleep(size_t us);
|
|||||||
struct timer {
|
struct timer {
|
||||||
public:
|
public:
|
||||||
timer() { restart(); }
|
timer() { restart(); }
|
||||||
float elapsed_seconds() { return (float)((stdext::micros() - m_start)/1000000.0); }
|
float elapsed_seconds() { return (stdext::micros() - m_start) / 1000000.f; }
|
||||||
ticks_t elapsed_millis() { return (stdext::micros() - m_start)/1000; }
|
ticks_t elapsed_millis() { return (stdext::micros() - m_start) / 1000; }
|
||||||
ticks_t elapsed_micros() { return stdext::micros() - m_start; }
|
ticks_t elapsed_micros() { return stdext::micros() - m_start; }
|
||||||
void restart() { m_start = stdext::micros(); }
|
void restart() { m_start = stdext::micros(); }
|
||||||
private:
|
private:
|
||||||
@ -47,4 +47,3 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user