npf.c
changeset 3957 25f4a4f22e05
parent 3933 231ae3c419f4
child 3977 513433ebd092
equal deleted inserted replaced
3956:92362ba224b7 3957:25f4a4f22e05
    13 #include "station_map.h"
    13 #include "station_map.h"
    14 #include "tile.h"
    14 #include "tile.h"
    15 #include "depot.h"
    15 #include "depot.h"
    16 #include "tunnel_map.h"
    16 #include "tunnel_map.h"
    17 #include "network.h"
    17 #include "network.h"
       
    18 #include "water_map.h"
    18 
    19 
    19 static AyStar _npf_aystar;
    20 static AyStar _npf_aystar;
    20 
    21 
    21 /* The cost of each trackdir. A diagonal piece is the full NPF_TILE_LENGTH,
    22 /* The cost of each trackdir. A diagonal piece is the full NPF_TILE_LENGTH,
    22  * the shorter piece is sqrt(2)/2*NPF_TILE_LENGTH =~ 0.7071
    23  * the shorter piece is sqrt(2)/2*NPF_TILE_LENGTH =~ 0.7071
   488 			break;
   489 			break;
   489 	}
   490 	}
   490 
   491 
   491 	return true; /* no need to check */
   492 	return true; /* no need to check */
   492 }
   493 }
       
   494 
       
   495 
       
   496 /**
       
   497  * Returns the direction the exit of the depot on the given tile is facing.
       
   498  */
       
   499 static DiagDirection GetDepotDirection(TileIndex tile, TransportType type)
       
   500 {
       
   501 	assert(IsTileDepotType(tile, type));
       
   502 
       
   503 	switch (type) {
       
   504 		case TRANSPORT_RAIL:  return GetRailDepotDirection(tile);
       
   505 		case TRANSPORT_ROAD:  return GetRoadDepotDirection(tile);
       
   506 		case TRANSPORT_WATER: return GetShipDepotDirection(tile);
       
   507 		default: return INVALID_DIAGDIR; /* Not reached */
       
   508 	}
       
   509 }
       
   510 
   493 
   511 
   494 /* Will just follow the results of GetTileTrackStatus concerning where we can
   512 /* Will just follow the results of GetTileTrackStatus concerning where we can
   495  * go and where not. Uses AyStar.user_data[NPF_TYPE] as the transport type and
   513  * go and where not. Uses AyStar.user_data[NPF_TYPE] as the transport type and
   496  * an argument to GetTileTrackStatus. Will skip tunnels, meaning that the
   514  * an argument to GetTileTrackStatus. Will skip tunnels, meaning that the
   497  * entry and exit are neighbours. Will fill
   515  * entry and exit are neighbours. Will fill