mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-29 04:53:35 +00:00
34 lines
586 B
C++
34 lines
586 B
C++
#pragma once
|
|
|
|
#include "../Platform/stdafx.h"
|
|
#include "../AI/Navigation/Node.h"
|
|
#include "../Platform/System.h"
|
|
#include "BasicTypeContainers.h"
|
|
|
|
class BinaryHeap {
|
|
private:
|
|
NodeArray heap;
|
|
int sizeVar;
|
|
|
|
// 4J Jev, add common ctor code.
|
|
void _init();
|
|
|
|
public:
|
|
BinaryHeap();
|
|
~BinaryHeap();
|
|
|
|
Node* insert(Node* node);
|
|
void clear();
|
|
Node* peek();
|
|
Node* pop();
|
|
void remove(Node* node);
|
|
void changeCost(Node* node, float newCost);
|
|
int size();
|
|
|
|
private:
|
|
void upHeap(int idx);
|
|
void downHeap(int idx);
|
|
|
|
public:
|
|
bool isEmpty();
|
|
}; |