diff options
Diffstat (limited to 'bin/ai/library/queue/priority_queue')
-rw-r--r-- | bin/ai/library/queue/priority_queue/library.nut | 6 | ||||
-rw-r--r-- | bin/ai/library/queue/priority_queue/main.nut | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/bin/ai/library/queue/priority_queue/library.nut b/bin/ai/library/queue/priority_queue/library.nut index 22e97e4e9..1559393ee 100644 --- a/bin/ai/library/queue/priority_queue/library.nut +++ b/bin/ai/library/queue/priority_queue/library.nut @@ -1,14 +1,14 @@ /* $Id$ */ -class PriorityQueue extends AILibrary { +class Priority_Queue extends AILibrary { function GetAuthor() { return "OpenTTD NoAI Developers Team"; } function GetName() { return "Priority Queue"; } function GetShortName() { return "QUPQ"; } function GetDescription() { return "An implementation of a Priority Queue"; } function GetVersion() { return 2; } function GetDate() { return "2008-06-10"; } - function CreateInstance() { return "PriorityQueue"; } + function CreateInstance() { return "Priority_Queue"; } function GetCategory() { return "Queue"; } } -RegisterLibrary(PriorityQueue()); +RegisterLibrary(Priority_Queue()); diff --git a/bin/ai/library/queue/priority_queue/main.nut b/bin/ai/library/queue/priority_queue/main.nut index bafc93ac5..feda89559 100644 --- a/bin/ai/library/queue/priority_queue/main.nut +++ b/bin/ai/library/queue/priority_queue/main.nut @@ -5,7 +5,7 @@ * Peek and Pop always return the current lowest value in the list. * Sort is done on insertion only. */ -class PriorityQueue +class Priority_Queue { _queue = null; _count = 0; @@ -56,7 +56,7 @@ class PriorityQueue function Exists(item); }; -function PriorityQueue::Insert(item, priority) +function Priority_Queue::Insert(item, priority) { /* Append dummy entry */ _queue.append(0); @@ -82,7 +82,7 @@ function PriorityQueue::Insert(item, priority) return true; } -function PriorityQueue::Pop() +function Priority_Queue::Pop() { if (_count == 0) return null; @@ -92,19 +92,19 @@ function PriorityQueue::Pop() return node[0]; } -function PriorityQueue::Peek() +function Priority_Queue::Peek() { if (_count == 0) return null; return _queue[_count - 1][0]; } -function PriorityQueue::Count() +function Priority_Queue::Count() { return _count; } -function PriorityQueue::Exists(item) +function Priority_Queue::Exists(item) { /* Brute-force find the item (there is no faster way, as we don't have the priority number) */ foreach (node in _queue) { |