summaryrefslogtreecommitdiff
path: root/src/pathfinder
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-10-02 09:46:40 +0000
committeralberth <alberth@openttd.org>2010-10-02 09:46:40 +0000
commit581d1070b4f96bdcf191b4f6d397475d189bc9e0 (patch)
treed3a9acc07506c8c936d4e3344d99e6ae9398f15f /src/pathfinder
parent78fe0457b4b55370ece4aea25037143811fe4ebf (diff)
downloadopenttd-581d1070b4f96bdcf191b4f6d397475d189bc9e0.tar.xz
(svn r20862) -Codechange: Make AyStar_Free() a method.
Diffstat (limited to 'src/pathfinder')
-rw-r--r--src/pathfinder/npf/aystar.cpp9
-rw-r--r--src/pathfinder/npf/aystar.h3
2 files changed, 5 insertions, 7 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp
index 150b86b56..0895a0845 100644
--- a/src/pathfinder/npf/aystar.cpp
+++ b/src/pathfinder/npf/aystar.cpp
@@ -198,13 +198,13 @@ static int AyStarMain_Loop(AyStar *aystar)
/*
* This function frees the memory it allocated
*/
-static void AyStarMain_Free(AyStar *aystar)
+void AyStar::Free()
{
- aystar->OpenListQueue.Free(false);
+ this->OpenListQueue.Free(false);
/* 2nd argument above is false, below is true, to free the values only
* once */
- delete_Hash(&aystar->OpenListHash, true);
- delete_Hash(&aystar->ClosedListHash, true);
+ delete_Hash(&this->OpenListHash, true);
+ delete_Hash(&this->ClosedListHash, true);
#ifdef AYSTAR_DEBUG
printf("[AyStar] Memory free'd\n");
#endif
@@ -296,7 +296,6 @@ void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets)
aystar->addstart = AyStarMain_AddStartNode;
aystar->main = AyStarMain_Main;
aystar->loop = AyStarMain_Loop;
- aystar->free = AyStarMain_Free;
aystar->clear = AyStarMain_Clear;
aystar->checktile = AyStarMain_CheckTile;
}
diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h
index a71fef299..b604118f9 100644
--- a/src/pathfinder/npf/aystar.h
+++ b/src/pathfinder/npf/aystar.h
@@ -108,7 +108,6 @@ typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g)
typedef int AyStar_Main(AyStar *aystar);
typedef int AyStar_Loop(AyStar *aystar);
typedef int AyStar_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
-typedef void AyStar_Free(AyStar *aystar);
typedef void AyStar_Clear(AyStar *aystar);
struct AyStar {
@@ -152,7 +151,7 @@ struct AyStar {
AyStar_AddStartNode *addstart;
AyStar_Main *main;
AyStar_Loop *loop;
- AyStar_Free *free;
+ void Free();
AyStar_Clear *clear;
AyStar_CheckTile *checktile;