mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r19247) -Codechange: Rename methods to fit better to common style (skidd13)
This commit is contained in:
parent
433e1d884c
commit
1a89a5fc92
@ -148,7 +148,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return The number of items in the queue
|
* @return The number of items in the queue
|
||||||
*/
|
*/
|
||||||
FORCEINLINE uint Size() const { return this->items; }
|
FORCEINLINE uint Length() const { return this->items; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the priority queue is empty.
|
* Test if the priority queue is empty.
|
||||||
@ -192,7 +192,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param new_item The pointer to the new item
|
* @param new_item The pointer to the new item
|
||||||
*/
|
*/
|
||||||
FORCEINLINE void Push(T *new_item)
|
FORCEINLINE void Include(T *new_item)
|
||||||
{
|
{
|
||||||
if (this->IsFull()) {
|
if (this->IsFull()) {
|
||||||
this->capacity *= 2;
|
this->capacity *= 2;
|
||||||
@ -233,7 +233,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param index The position of the item in the heap
|
* @param index The position of the item in the heap
|
||||||
*/
|
*/
|
||||||
FORCEINLINE void RemoveByIdx(uint index)
|
FORCEINLINE void Remove(uint index)
|
||||||
{
|
{
|
||||||
if (index < this->items) {
|
if (index < this->items) {
|
||||||
assert(index != 0);
|
assert(index != 0);
|
||||||
@ -261,7 +261,7 @@ public:
|
|||||||
* @param item The reference to the item
|
* @param item The reference to the item
|
||||||
* @return The index of the item or zero if not found
|
* @return The index of the item or zero if not found
|
||||||
*/
|
*/
|
||||||
FORCEINLINE uint FindLinear(const T &item) const
|
FORCEINLINE uint FindIndex(const T &item) const
|
||||||
{
|
{
|
||||||
if (this->IsEmpty()) return 0;
|
if (this->IsEmpty()) return 0;
|
||||||
for (T **ppI = this->data + 1, **ppLast = ppI + this->items; ppI <= ppLast; ppI++) {
|
for (T **ppI = this->data + 1, **ppLast = ppI + this->items; ppI <= ppLast; ppI++) {
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
{
|
{
|
||||||
assert(m_closed.Find(item.GetKey()) == NULL);
|
assert(m_closed.Find(item.GetKey()) == NULL);
|
||||||
m_open.Push(item);
|
m_open.Push(item);
|
||||||
m_open_queue.Push(&item);
|
m_open_queue.Include(&item);
|
||||||
if (&item == m_new_node) {
|
if (&item == m_new_node) {
|
||||||
m_new_node = NULL;
|
m_new_node = NULL;
|
||||||
}
|
}
|
||||||
@ -130,8 +130,8 @@ public:
|
|||||||
FORCEINLINE Titem_& PopOpenNode(const Key& key)
|
FORCEINLINE Titem_& PopOpenNode(const Key& key)
|
||||||
{
|
{
|
||||||
Titem_& item = m_open.Pop(key);
|
Titem_& item = m_open.Pop(key);
|
||||||
int idxPop = m_open_queue.FindLinear(item);
|
uint idxPop = m_open_queue.FindIndex(item);
|
||||||
m_open_queue.RemoveByIdx(idxPop);
|
m_open_queue.Remove(idxPop);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user