(svn r5116) Move the overly generic GetDepotDirection() from a header to its only consumer
This commit is contained in:
		
							
								
								
									
										17
									
								
								depot.h
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								depot.h
									
									
									
									
									
								
							@@ -8,11 +8,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "direction.h"
 | 
					#include "direction.h"
 | 
				
			||||||
#include "pool.h"
 | 
					#include "pool.h"
 | 
				
			||||||
#include "rail_map.h"
 | 
					 | 
				
			||||||
#include "road_map.h"
 | 
					 | 
				
			||||||
#include "tile.h"
 | 
					#include "tile.h"
 | 
				
			||||||
#include "variables.h"
 | 
					#include "variables.h"
 | 
				
			||||||
#include "water_map.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct Depot {
 | 
					struct Depot {
 | 
				
			||||||
	TileIndex xy;
 | 
						TileIndex xy;
 | 
				
			||||||
@@ -92,20 +89,6 @@ static inline bool IsTileDepotType(TileIndex tile, TransportType type)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Returns the direction the exit of the depot on the given tile is facing.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static inline DiagDirection GetDepotDirection(TileIndex tile, TransportType type)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	assert(IsTileDepotType(tile, type));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch (type) {
 | 
					 | 
				
			||||||
		case TRANSPORT_RAIL:  return GetRailDepotDirection(tile);
 | 
					 | 
				
			||||||
		case TRANSPORT_ROAD:  return GetRoadDepotDirection(tile);
 | 
					 | 
				
			||||||
		case TRANSPORT_WATER: return GetShipDepotDirection(tile);
 | 
					 | 
				
			||||||
		default: return INVALID_DIAGDIR; /* Not reached */
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
	Find out if the slope of the tile is suitable to build a depot of given direction
 | 
						Find out if the slope of the tile is suitable to build a depot of given direction
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								npf.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								npf.c
									
									
									
									
									
								
							@@ -15,6 +15,7 @@
 | 
				
			|||||||
#include "depot.h"
 | 
					#include "depot.h"
 | 
				
			||||||
#include "tunnel_map.h"
 | 
					#include "tunnel_map.h"
 | 
				
			||||||
#include "network.h"
 | 
					#include "network.h"
 | 
				
			||||||
 | 
					#include "water_map.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static AyStar _npf_aystar;
 | 
					static AyStar _npf_aystar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -491,6 +492,23 @@ static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enter
 | 
				
			|||||||
	return true; /* no need to check */
 | 
						return true; /* no need to check */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Returns the direction the exit of the depot on the given tile is facing.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static DiagDirection GetDepotDirection(TileIndex tile, TransportType type)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						assert(IsTileDepotType(tile, type));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch (type) {
 | 
				
			||||||
 | 
							case TRANSPORT_RAIL:  return GetRailDepotDirection(tile);
 | 
				
			||||||
 | 
							case TRANSPORT_ROAD:  return GetRoadDepotDirection(tile);
 | 
				
			||||||
 | 
							case TRANSPORT_WATER: return GetShipDepotDirection(tile);
 | 
				
			||||||
 | 
							default: return INVALID_DIAGDIR; /* Not reached */
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Will just follow the results of GetTileTrackStatus concerning where we can
 | 
					/* Will just follow the results of GetTileTrackStatus concerning where we can
 | 
				
			||||||
 * go and where not. Uses AyStar.user_data[NPF_TYPE] as the transport type and
 | 
					 * go and where not. Uses AyStar.user_data[NPF_TYPE] as the transport type and
 | 
				
			||||||
 * an argument to GetTileTrackStatus. Will skip tunnels, meaning that the
 | 
					 * an argument to GetTileTrackStatus. Will skip tunnels, meaning that the
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "stdafx.h"
 | 
					#include "stdafx.h"
 | 
				
			||||||
#include "openttd.h"
 | 
					#include "openttd.h"
 | 
				
			||||||
 | 
					#include "road_map.h"
 | 
				
			||||||
#include "spritecache.h"
 | 
					#include "spritecache.h"
 | 
				
			||||||
#include "table/sprites.h"
 | 
					#include "table/sprites.h"
 | 
				
			||||||
#include "table/strings.h"
 | 
					#include "table/strings.h"
 | 
				
			||||||
@@ -25,6 +26,7 @@
 | 
				
			|||||||
#include "train.h"
 | 
					#include "train.h"
 | 
				
			||||||
#include "industry_map.h"
 | 
					#include "industry_map.h"
 | 
				
			||||||
#include "station_map.h"
 | 
					#include "station_map.h"
 | 
				
			||||||
 | 
					#include "water_map.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define INVALID_COORD (-0x8000)
 | 
					#define INVALID_COORD (-0x8000)
 | 
				
			||||||
#define GEN_HASH(x,y) (((x & 0x1F80)>>7) + ((y & 0xFC0)))
 | 
					#define GEN_HASH(x,y) (((x & 0x1F80)>>7) + ((y & 0xFC0)))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user