* Clamp the service interval to the correct min/max. The actual min/max values * 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. */
| 1863 | * @return The service interval clamped to use the chosen units. |
| 1864 | */ |
| 1865 | uint16_t GetServiceIntervalClamped(int interval, bool ispercent) |
| 1866 | { |
| 1867 | /* Service intervals are in percents. */ |
| 1868 | if (ispercent) return Clamp(interval, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT); |
| 1869 | |
| 1870 | /* Service intervals are in minutes. */ |
| 1871 | if (TimerGameEconomy::UsingWallclockUnits(_game_mode == GM_MENU)) return Clamp(interval, MIN_SERVINT_MINUTES, MAX_SERVINT_MINUTES); |
| 1872 | |
| 1873 | /* Service intervals are in days. */ |
| 1874 | return Clamp(interval, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS); |
| 1875 | } |
| 1876 | |
| 1877 | /** |
| 1878 | * |
no test coverage detected