depot.h
changeset 1650 4a5141e10b72
parent 1330 5d76a0522a11
child 1718 96d76767ea93
equal deleted inserted replaced
1649:f4f5fabe0506 1650:4a5141e10b72
    69 			assert(0);
    69 			assert(0);
    70 			return false;
    70 			return false;
    71 	}
    71 	}
    72 }
    72 }
    73 
    73 
       
    74 /**
       
    75  * Returns the direction the exit of the depot on the given tile is facing.
       
    76  */
       
    77 static inline uint GetDepotDirection(TileIndex tile, TransportType type)
       
    78 {
       
    79 	assert(IsTileDepotType(tile, type));
       
    80 
       
    81 	switch (type)
       
    82 	{
       
    83 		case TRANSPORT_RAIL:
       
    84 		case TRANSPORT_ROAD:
       
    85 			/* Rail and road store a diagonal direction in bits 0 and 1 */
       
    86 			return _map5[tile] & 3;
       
    87 		case TRANSPORT_WATER:
       
    88 			/* Water is stubborn, it stores the directions in a different order. */
       
    89 			switch (_map5[tile] & 3) {
       
    90 				case 0: return 0;
       
    91 				case 1: return 2;
       
    92 				case 2: return 3;
       
    93 				case 3: return 1;
       
    94 			}
       
    95 		default:
       
    96 			return 0; /* Not reached */
       
    97 	}
       
    98 }
       
    99 
    74 Depot *GetDepotByTile(uint tile);
   100 Depot *GetDepotByTile(uint tile);
    75 void InitializeDepot(void);
   101 void InitializeDepot(void);
    76 Depot *AllocateDepot(void);
   102 Depot *AllocateDepot(void);
    77 void DoDeleteDepot(uint tile);
   103 void DoDeleteDepot(uint tile);
    78 
   104