diff options
author | Darkvater <darkvater@openttd.org> | 2005-05-11 16:17:03 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-05-11 16:17:03 +0000 |
commit | 729066e407731ca323a9b368b108c100c37044e3 (patch) | |
tree | 200e057011df0475fd5c514b242f7105fc989644 /depot.h | |
parent | aa4f2d2db2e69a62914391d6e6f497302dc47391 (diff) | |
download | openttd-729066e407731ca323a9b368b108c100c37044e3.tar.xz |
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Diffstat (limited to 'depot.h')
-rw-r--r-- | depot.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -41,6 +41,16 @@ static inline bool IsDepotIndex(uint index) #define MIN_SERVINT_DAYS 30 #define MAX_SERVINT_DAYS 800 +/** Get the service interval domain. + * Get the new proposed service interval for the vehicle is indeed, clamped + * within the given bounds. @see MIN_SERVINT_PERCENT ,etc. + * @param index proposed service interval + */ +static inline uint16 GetServiceIntervalClamped(uint index) +{ + return (_patches.servint_ispercent) ? clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS); +} + VARDEF TileIndex _last_built_train_depot_tile; VARDEF TileIndex _last_built_road_depot_tile; VARDEF TileIndex _last_built_aircraft_depot_tile; |