diff options
-rw-r--r-- | src/depot_gui.cpp | 1 | ||||
-rw-r--r-- | src/economy.cpp | 1 | ||||
-rw-r--r-- | src/network/network_server.cpp | 4 | ||||
-rw-r--r-- | src/newgrf_engine.cpp | 2 | ||||
-rw-r--r-- | src/vehicle.cpp | 3 | ||||
-rw-r--r-- | src/vehicle.h | 9 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 1 |
7 files changed, 15 insertions, 6 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 7df0c537e..d0fa558b0 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -137,6 +137,7 @@ void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2) case VEH_ROAD: CcCloneRoadVeh( true, tile, p1, p2); break; case VEH_SHIP: CcCloneShip( true, tile, p1, p2); break; case VEH_AIRCRAFT: CcCloneAircraft(true, tile, p1, p2); break; + default: NOT_REACHED(); } } diff --git a/src/economy.cpp b/src/economy.cpp index 09f3de0c0..55136c28d 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -365,6 +365,7 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player) case VEH_ROAD: v->unitnumber = ++num_road; break; case VEH_SHIP: v->unitnumber = ++num_ship; break; case VEH_AIRCRAFT: if (IsNormalAircraft(v)) v->unitnumber = ++num_aircraft; break; + default: NOT_REACHED(); } } } diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index b4910b362..b2d6c73c1 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1301,9 +1301,7 @@ void NetworkPopulateCompanyInfo() _network_player_info[v->owner].num_vehicle[4]++; break; - case VEH_SPECIAL: - case VEH_DISASTER: - break; + default: break; } } diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index f6ff61322..775e4dbe9 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -770,6 +770,8 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by case 0x66: return MapAircraftMovementAction(v); // Current movement action } break; + + default: break; } DEBUG(grf, 1, "Unhandled vehicle property 0x%X, type 0x%X", variable, v->type); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 0b7916d29..724cd3428 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -677,6 +677,8 @@ void CallVehicleTicks() _vehicle_tick_procs[v->type](v); switch (v->type) { + default: break; + case VEH_TRAIN: case VEH_ROAD: case VEH_AIRCRAFT: @@ -2850,6 +2852,7 @@ static void Load_VEHS() case VEH_SPECIAL: v = new (v) SpecialVehicle(); break; case VEH_DISASTER: v = new (v) DisasterVehicle(); break; case VEH_INVALID: v = new (v) InvalidVehicle(); break; + default: NOT_REACHED(); } /* Old savegames used 'last_station_visited = 0xFF' */ diff --git a/src/vehicle.h b/src/vehicle.h index ccd918521..81efc6293 100644 --- a/src/vehicle.h +++ b/src/vehicle.h @@ -64,15 +64,18 @@ enum RoadVehicleStates { RVSB_ROAD_STOP_TRACKDIR_MASK = 0x09 ///< Only bits 0 and 3 are used to encode the trackdir for road stops }; -enum { +enum VehicleType { VEH_TRAIN, VEH_ROAD, VEH_SHIP, VEH_AIRCRAFT, VEH_SPECIAL, VEH_DISASTER, + VEH_END, VEH_INVALID = 0xFF, -} ; +}; +template <> struct EnumPropsT<VehicleType> : MakeEnumPropsT<VehicleType, byte, VEH_TRAIN, VEH_END, VEH_INVALID> {}; +typedef TinyEnumT<VehicleType> VehicleTypeByte; enum VehStatus { VS_HIDDEN = 0x01, @@ -203,7 +206,7 @@ struct VehicleShip { struct Vehicle { - byte type; // type, ie roadven,train,ship,aircraft,special + VehicleTypeByte type; ///< Type of vehicle byte subtype; // subtype (Filled with values from EffectVehicles/TrainSubTypes/AircraftSubTypes) VehicleID index; // NOSAVE: Index in vehicle array diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index c90ead3ff..02f90e70f 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -377,6 +377,7 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e) int command = 0; switch (v->type) { + default: NOT_REACHED(); case VEH_TRAIN: command = CMD_REFIT_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE); break; case VEH_ROAD: command = CMD_REFIT_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T); break; case VEH_SHIP: command = CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP); break; |