Add wallclock time settings
This commit is contained in:
@@ -2962,13 +2962,21 @@ void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist, bool reset_order_indic
|
||||
|
||||
/**
|
||||
* Clamp the service interval to the correct min/max. The actual min/max values
|
||||
* depend on whether it's in percent or days.
|
||||
* @param interval proposed service interval
|
||||
* @return Clamped service interval
|
||||
* depend on whether it's in days, minutes, or percent.
|
||||
* @param interval The proposed service interval.
|
||||
* @param ispercent Whether the interval is a percent.
|
||||
* @return The service interval clamped to use the chosen units.
|
||||
*/
|
||||
uint16_t GetServiceIntervalClamped(int interval, bool ispercent)
|
||||
{
|
||||
return ispercent ? Clamp(interval, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(interval, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
|
||||
/* Service intervals are in percents. */
|
||||
if (ispercent) return Clamp(interval, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT);
|
||||
|
||||
/* Service intervals are in minutes. */
|
||||
if (EconTime::UsingWallclockUnits(_game_mode == GM_MENU)) return Clamp(interval, MIN_SERVINT_MINUTES, MAX_SERVINT_MINUTES);
|
||||
|
||||
/* Service intervals are in days. */
|
||||
return Clamp(interval, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user