Changeset - r6621:c0fe19bbb51d
[Not reviewed]
master
0 7 0
rubidium - 17 years ago 2007-05-15 11:28:22
rubidium@openttd.org
(svn r9841) -Codechange: add a little more type strictness to the vehicle types.
7 files changed with 14 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/depot_gui.cpp
Show inline comments
 
@@ -137,6 +137,7 @@ void CcCloneVehicle(bool success, TileIn
 
		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();
 
	}
 
}
 

	
src/economy.cpp
Show inline comments
 
@@ -365,6 +365,7 @@ void ChangeOwnershipOfPlayerItems(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();
 
					}
 
				}
 
			}
src/network/network_server.cpp
Show inline comments
 
@@ -1301,9 +1301,7 @@ void NetworkPopulateCompanyInfo()
 
				_network_player_info[v->owner].num_vehicle[4]++;
 
				break;
 

	
 
			case VEH_SPECIAL:
 
			case VEH_DISASTER:
 
				break;
 
			default: break;
 
		}
 
	}
 

	
src/newgrf_engine.cpp
Show inline comments
 
@@ -770,6 +770,8 @@ static uint32 VehicleGetVariable(const R
 
				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);
src/vehicle.cpp
Show inline comments
 
@@ -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' */
src/vehicle.h
Show inline comments
 
@@ -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
src/vehicle_gui.cpp
Show inline comments
 
@@ -377,6 +377,7 @@ static void VehicleRefitWndProc(Window *
 
							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;
0 comments (0 inline, 0 general)