mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-12 17:19:09 +00:00
Fix #11748: Incorrect clamping of negative service interval values
This commit is contained in:
@@ -1849,7 +1849,7 @@ void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist, bool reset_order_indic
|
||||
* @param interval proposed service interval
|
||||
* @return Clamped service interval
|
||||
*/
|
||||
uint16_t GetServiceIntervalClamped(uint interval, bool ispercent)
|
||||
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);
|
||||
}
|
||||
|
@@ -37,6 +37,6 @@ static const uint DEF_SERVINT_PERCENT = 50;
|
||||
static const uint MIN_SERVINT_PERCENT = 5;
|
||||
static const uint MAX_SERVINT_PERCENT = 90;
|
||||
|
||||
uint16_t GetServiceIntervalClamped(uint interval, bool ispercent);
|
||||
uint16_t GetServiceIntervalClamped(int interval, bool ispercent);
|
||||
|
||||
#endif /* ORDER_FUNC_H */
|
||||
|
Reference in New Issue
Block a user