changeset 13849:d66e7acda8fa draft

(svn r18378) -Codechange: move the pathfinder 'length' constants to pathfinder_type.h
author rubidium <rubidium@openttd.org>
date Wed, 02 Dec 2009 16:38:33 +0000
parents a47ef53cafb4
children da5eda07b403
files src/pathfinder/npf/npf.h src/pathfinder/pathfinder_type.h src/pathfinder/yapf/yapf.h src/settings.cpp
diffstat 4 files changed, 27 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/pathfinder/npf/npf.h
+++ b/src/pathfinder/npf/npf.h
@@ -31,24 +31,6 @@
 	NPF_HASH_HALFMASK = (1 << NPF_HASH_HALFBITS) - 1
 };
 
-/* For new pathfinding. Define here so it is globally available without having
- * to include npf.h */
-enum {
-	NPF_TILE_LENGTH = 100
-};
-
-enum {
-	/**
-	 * This penalty is the equivalent of "infite", which means that paths that
-	 * get this penalty will be chosen, but only if there is no other route
-	 * without it. Be careful with not applying this penalty to often, or the
-	 * total path cost might overflow..
-	 * For now, this is just a Very Big Penalty, we might actually implement
-	 * this in a nicer way :-)
-	 */
-	NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH
-};
-
 /* Meant to be stored in AyStar.targetdata */
 struct NPFFindStationOrTileData {
 	TileIndex dest_coords;   ///< An indication of where the station is, for heuristic purposes, or the target tile
--- a/src/pathfinder/pathfinder_type.h
+++ b/src/pathfinder/pathfinder_type.h
@@ -12,6 +12,32 @@
 #ifndef PATHFINDER_TYPE_H
 #define PATHFINDER_TYPE_H
 
+/** Length (penalty) of one tile with NPF */
+static const int NPF_TILE_LENGTH = 100;
+
+/**
+ * This penalty is the equivalent of "infite", which means that paths that
+ * get this penalty will be chosen, but only if there is no other route
+ * without it. Be careful with not applying this penalty to often, or the
+ * total path cost might overflow..
+ */
+static const int NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH;
+
+
+/** Length (penalty) of one tile with YAPF */
+static const int YAPF_TILE_LENGTH = 100;
+
+/** Length (penalty) of a corner with YAPF */
+static const int YAPF_TILE_CORNER_LENGTH = 71;
+
+/**
+ * This penalty is the equivalent of "infite", which means that paths that
+ * get this penalty will be chosen, but only if there is no other route
+ * without it. Be careful with not applying this penalty to often, or the
+ * total path cost might overflow..
+ */
+static const int YAPF_INFINITE_PENALTY = 1000 * YAPF_TILE_LENGTH;
+
 /**
  * Helper container to find a depot
  */
--- a/src/pathfinder/yapf/yapf.h
+++ b/src/pathfinder/yapf/yapf.h
@@ -105,20 +105,4 @@
 /** Use this function to notify YAPF that track layout (or signal configuration) has change */
 void YapfNotifyTrackLayoutChange(TileIndex tile, Track track);
 
-/** Base tile length units */
-enum {
-	YAPF_TILE_LENGTH = 100,
-	YAPF_TILE_CORNER_LENGTH = 71,
-
-	/**
-	 * This penalty is the equivalent of "infite", which means that paths that
-	 * get this penalty will be chosen, but only if there is no other route
-	 * without it. Be careful with not applying this penalty to often, or the
-	 * total path cost might overflow..
-	 * For now, this is just a Very Big Penalty, we might actually implement
-	 * this in a nicer way :-)
-	 */
-	YAPF_INFINITE_PENALTY = 1000 * YAPF_TILE_LENGTH,
-};
-
 #endif /* YAPF_H */
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -31,8 +31,7 @@
 #include "settings_internal.h"
 #include "command_func.h"
 #include "console_func.h"
-#include "pathfinder/npf/npf.h"
-#include "pathfinder/yapf/yapf.h"
+#include "pathfinder/pathfinder_type.h"
 #include "genworld.h"
 #include "train.h"
 #include "news_func.h"