changeset 7090:b0933d2ad8e9 draft

(svn r10357) -Fix: and when we're at it... yet another memory leak, but only when you start a new game; can't find any other memory leaks we can fix.
author rubidium <rubidium@openttd.org>
date Wed, 27 Jun 2007 17:05:06 +0000
parents f657f07de0e6
children fcc7fb10869f
files src/npf.cpp
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -877,7 +877,13 @@
 
 void InitializeNPF()
 {
-	init_AyStar(&_npf_aystar, NPFHash, NPF_HASH_SIZE);
+	static bool first_init = true;
+	if (first_init) {
+		first_init = false;
+		init_AyStar(&_npf_aystar, NPFHash, NPF_HASH_SIZE);
+	} else {
+		AyStarMain_Clear(&_npf_aystar);
+	}
 	_npf_aystar.loops_per_tick = 0;
 	_npf_aystar.max_path_cost = 0;
 	//_npf_aystar.max_search_nodes = 0;