src/depot.h
branchnoai
changeset 9723 eee46cb39750
parent 9722 ebf0ece7d8f6
child 6878 7d1ff2f621c7
equal deleted inserted replaced
9722:ebf0ece7d8f6 9723:eee46cb39750
     3 /** @file depot.h Header files for depots (not hangars) */
     3 /** @file depot.h Header files for depots (not hangars) */
     4 
     4 
     5 #ifndef DEPOT_H
     5 #ifndef DEPOT_H
     6 #define DEPOT_H
     6 #define DEPOT_H
     7 
     7 
     8 #include "direction.h"
     8 #include "direction_type.h"
     9 #include "oldpool.h"
     9 #include "oldpool.h"
    10 #include "tile.h"
       
    11 #include "variables.h"
       
    12 #include "road_map.h"
    10 #include "road_map.h"
    13 #include "rail_map.h"
    11 #include "rail_map.h"
    14 #include "water_map.h"
    12 #include "water_map.h"
    15 #include "station_map.h"
    13 #include "station_map.h"
    16 
    14 
    34 
    32 
    35 void ShowDepotWindow(TileIndex tile, VehicleType type);
    33 void ShowDepotWindow(TileIndex tile, VehicleType type);
    36 
    34 
    37 #define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? GetDepot(d->index + 1U) : NULL) if (d->IsValid())
    35 #define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? GetDepot(d->index + 1U) : NULL) if (d->IsValid())
    38 #define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
    36 #define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
    39 
       
    40 #define MIN_SERVINT_PERCENT  5
       
    41 #define MAX_SERVINT_PERCENT 90
       
    42 #define MIN_SERVINT_DAYS    30
       
    43 #define MAX_SERVINT_DAYS   800
       
    44 
       
    45 /**
       
    46  * Get the service interval domain.
       
    47  * Get the new proposed service interval for the vehicle is indeed, clamped
       
    48  * within the given bounds. @see MIN_SERVINT_PERCENT ,etc.
       
    49  * @param index proposed service interval
       
    50  * @return service interval
       
    51  */
       
    52 static inline Date GetServiceIntervalClamped(uint index)
       
    53 {
       
    54 	return (_patches.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
       
    55 }
       
    56 
    37 
    57 /**
    38 /**
    58  * Check if a tile is a depot of the given type.
    39  * Check if a tile is a depot of the given type.
    59  */
    40  */
    60 static inline bool IsTileDepotType(TileIndex tile, TransportType type)
    41 static inline bool IsTileDepotType(TileIndex tile, TransportType type)