Skip to content

Commit

Permalink
Fix OpenTTD#11748: Incorrect clamping of negative service interval va…
Browse files Browse the repository at this point in the history
…lues (OpenTTD#11749)
  • Loading branch information
glx22 authored Jan 10, 2024
1 parent 86b046c commit f7bd70b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/order_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/order_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit f7bd70b

Please sign in to comment.