MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / IsVehicleTypeDisabled

Function IsVehicleTypeDisabled

src/engine.cpp:948–958  ·  view source on GitHub ↗

* Checks if a vehicle type is disabled for all/ai companies. * @param type The vehicle type which shall be checked. * @param ai If true, check if the type is disabled for AI companies, otherwise check if * the vehicle type is disabled for human companies. * @return Whether or not a vehicle type is disabled. */

Source from the content-addressed store, hash-verified

946 * @return Whether or not a vehicle type is disabled.
947 */
948static bool IsVehicleTypeDisabled(VehicleType type, bool ai)
949{
950 switch (type) {
951 case VEH_TRAIN: return _settings_game.vehicle.max_trains == 0 || (ai && _settings_game.ai.ai_disable_veh_train);
952 case VEH_ROAD: return _settings_game.vehicle.max_roadveh == 0 || (ai && _settings_game.ai.ai_disable_veh_roadveh);
953 case VEH_SHIP: return _settings_game.vehicle.max_ships == 0 || (ai && _settings_game.ai.ai_disable_veh_ship);
954 case VEH_AIRCRAFT: return _settings_game.vehicle.max_aircraft == 0 || (ai && _settings_game.ai.ai_disable_veh_aircraft);
955
956 default: NOT_REACHED();
957 }
958}
959
960/** Daily check to offer an exclusive engine preview to the companies. */
961static const IntervalTimer<TimerGameCalendar> _calendar_engines_daily({TimerGameCalendar::DAY, TimerGameCalendar::Priority::ENGINE}, [](auto)

Callers 3

engine.cppFile · 0.85
NewVehicleAvailableFunction · 0.85

Calls 1

NOT_REACHEDFunction · 0.85

Tested by

no test coverage detected