src/npf.cpp
branchNewGRF_ports
changeset 10242 52b4a9006029
parent 10184 fcf5fb2548eb
child 10724 68a692eacf22
--- a/src/npf.cpp	Wed Apr 16 22:34:14 2008 +0000
+++ b/src/npf.cpp	Fri Apr 18 19:55:13 2008 +0000
@@ -14,7 +14,8 @@
 #include "pathfind.h"
 #include "station_base.h"
 #include "station_map.h"
-#include "depot.h"
+#include "depot_base.h"
+#include "depot_map.h"
 #include "tunnel_map.h"
 #include "network/network.h"
 #include "water_map.h"
@@ -231,14 +232,14 @@
 	switch (GetTileType(tile)) {
 		case MP_RAILWAY:
 			/* DEBUG: mark visited tiles by mowing the grass under them ;-) */
-			if (!IsTileDepotType(tile, TRANSPORT_RAIL)) {
+			if (!IsRailDepot(tile)) {
 				SetRailGroundType(tile, RAIL_GROUND_BARREN);
 				MarkTileDirtyByTile(tile);
 			}
 			break;
 
 		case MP_ROAD:
-			if (!IsTileDepotType(tile, TRANSPORT_ROAD)) {
+			if (!IsRoadDepot(tile)) {
 				SetRoadside(tile, ROADSIDE_BARREN);
 				MarkTileDirtyByTile(tile);
 			}
@@ -397,7 +398,7 @@
 	 *      curves should be taken into account, as this affects the speed limit. */
 
 	/* Check for reverse in depot */
-	if (IsTileDepotType(tile, TRANSPORT_RAIL) && as->EndNodeCheck(as, &new_node) != AYSTAR_FOUND_END_NODE) {
+	if (IsRailDepotTile(tile) && as->EndNodeCheck(as, &new_node) != AYSTAR_FOUND_END_NODE) {
 		/* Penalise any depot tile that is not the last tile in the path. This
 		 * _should_ penalise every occurence of reversing in a depot (and only
 		 * that) */
@@ -417,7 +418,7 @@
 {
 	/* It's not worth caching the result with NPF_FLAG_IS_TARGET here as below,
 	 * since checking the cache not that much faster than the actual check */
-	return IsTileDepotType(current->path.node.tile, (TransportType)as->user_data[NPF_TYPE]) ?
+	return IsDepotTypeTile(current->path.node.tile, (TransportType)as->user_data[NPF_TYPE]) ?
 		AYSTAR_FOUND_END_NODE : AYSTAR_DONE;
 }
 
@@ -464,9 +465,9 @@
  */
 static bool CanEnterTileOwnerCheck(Owner owner, TileIndex tile, DiagDirection enterdir)
 {
-	if (IsTileType(tile, MP_RAILWAY) ||           /* Rail tile (also rail depot) */
-			IsRailwayStationTile(tile) ||               /* Rail station tile */
-			IsTileDepotType(tile, TRANSPORT_ROAD) ||  /* Road depot tile */
+	if (IsTileType(tile, MP_RAILWAY) ||             /* Rail tile (also rail depot) */
+			IsRailwayStationTile(tile) ||   /* Rail station tile */
+			IsRoadDepotTile(tile) ||        /* Road depot tile */
 			IsStandardRoadStopTile(tile)) { /* Road station tile (but not drive-through stops) */
 		return IsTileOwner(tile, owner); /* You need to own these tiles entirely to use them */
 	}
@@ -499,7 +500,7 @@
  */
 static DiagDirection GetDepotDirection(TileIndex tile, TransportType type)
 {
-	assert(IsTileDepotType(tile, type));
+	assert(IsDepotTypeTile(tile, type));
 
 	switch (type) {
 		case TRANSPORT_RAIL:  return GetRailDepotDirection(tile);
@@ -537,7 +538,7 @@
  */
 static DiagDirection GetTileSingleEntry(TileIndex tile, TransportType type, uint subtype)
 {
-	if (type != TRANSPORT_WATER && IsTileDepotType(tile, type)) return GetDepotDirection(tile, type);
+	if (type != TRANSPORT_WATER && IsDepotTypeTile(tile, type)) return GetDepotDirection(tile, type);
 
 	if (type == TRANSPORT_ROAD) {
 		if (IsStandardRoadStopTile(tile)) return GetRoadStopDir(tile);
@@ -879,7 +880,7 @@
 	FOR_ALL_DEPOTS(depot) {
 		/* Check if this is really a valid depot, it is of the needed type and
 		 * owner */
-		if (IsTileDepotType(depot->xy, type) && IsTileOwner(depot->xy, owner))
+		if (IsDepotTypeTile(depot->xy, type) && IsTileOwner(depot->xy, owner))
 			/* If so, let's add it to the queue, sorted by distance */
 			depots.push(&depots, depot, DistanceManhattan(tile, depot->xy));
 	}