src/vehicle.h
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6524 44e22a9b2c97
child 9908 0fa543611bbe
--- a/src/vehicle.h	Mon Mar 19 09:33:17 2007 +0000
+++ b/src/vehicle.h	Mon Mar 19 12:38:16 2007 +0000
@@ -63,13 +63,13 @@
 };
 
 enum {
-	VEH_Train,
-	VEH_Road,
-	VEH_Ship,
-	VEH_Aircraft,
-	VEH_Special,
-	VEH_Disaster,
-	VEH_Invalid = 0xFF,
+	VEH_TRAIN,
+	VEH_ROAD,
+	VEH_SHIP,
+	VEH_AIRCRAFT,
+	VEH_SPECIAL,
+	VEH_DISASTER,
+	VEH_INVALID = 0xFF,
 } ;
 
 enum VehStatus {
@@ -90,7 +90,7 @@
 };
 
 /* Effect vehicle types */
-typedef enum EffectVehicle {
+enum EffectVehicle {
 	EV_CHIMNEY_SMOKE   = 0,
 	EV_STEAM_SMOKE     = 1,
 	EV_DIESEL_SMOKE    = 2,
@@ -101,9 +101,9 @@
 	EV_EXPLOSION_SMALL = 7,
 	EV_BULLDOZER       = 8,
 	EV_BUBBLE          = 9
-} EffectVehicle;
+};
 
-typedef struct VehicleRail {
+struct VehicleRail {
 	uint16 last_speed; // NOSAVE: only used in UI
 	uint16 crash_anim_pos;
 	uint16 days_since_order_progr;
@@ -140,7 +140,7 @@
 
 	// Link between the two ends of a multiheaded engine
 	Vehicle *other_multiheaded_part;
-} VehicleRail;
+};
 
 enum {
 	VRF_REVERSING         = 0,
@@ -162,15 +162,15 @@
 	VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6,
 };
 
-typedef struct VehicleAir {
+struct VehicleAir {
 	uint16 crashed_counter;
 	byte pos;
 	byte previous_pos;
 	StationID targetairport;
 	byte state;
-} VehicleAir;
+};
 
-typedef struct VehicleRoad {
+struct VehicleRoad {
 	byte state;             /// @see RoadVehicleStates
 	byte frame;
 	uint16 blocked_ctr;
@@ -180,21 +180,21 @@
 	byte reverse_ctr;
 	struct RoadStop *slot;
 	byte slot_age;
-} VehicleRoad;
+};
 
-typedef struct VehicleSpecial {
+struct VehicleSpecial {
 	uint16 unk0;
 	byte unk2;
-} VehicleSpecial;
+};
 
-typedef struct VehicleDisaster {
+struct VehicleDisaster {
 	uint16 image_override;
 	uint16 unk2;
-} VehicleDisaster;
+};
 
-typedef struct VehicleShip {
+struct VehicleShip {
 	TrackBitsByte state;
-} VehicleShip;
+};
 
 
 struct Vehicle {
@@ -322,12 +322,12 @@
 typedef void *VehicleFromPosProc(Vehicle *v, void *data);
 
 void VehicleServiceInDepot(Vehicle *v);
-Vehicle *AllocateVehicle(void);
+Vehicle *AllocateVehicle();
 bool AllocateVehicles(Vehicle **vl, int num);
-Vehicle *ForceAllocateVehicle(void);
-Vehicle *ForceAllocateSpecialVehicle(void);
+Vehicle *ForceAllocateVehicle();
+Vehicle *ForceAllocateSpecialVehicle();
 void VehiclePositionChanged(Vehicle *v);
-void AfterLoadVehicles(void);
+void AfterLoadVehicles();
 Vehicle *GetLastVehicleInChain(Vehicle *v);
 Vehicle *GetPrevVehicleInChain(const Vehicle *v);
 Vehicle *GetFirstVehicleInChain(const Vehicle *v);
@@ -335,12 +335,12 @@
 bool IsEngineCountable(const Vehicle *v);
 void DeleteVehicleChain(Vehicle *v);
 void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
-void CallVehicleTicks(void);
+void CallVehicleTicks();
 Vehicle *FindVehicleOnTileZ(TileIndex tile, byte z);
 
-void InitializeTrains(void);
-byte VehicleRandomBits(void);
-void ResetVehiclePosHash(void);
+void InitializeTrains();
+byte VehicleRandomBits();
+void ResetVehiclePosHash();
 
 bool CanFillVehicle(Vehicle *v);
 bool CanRefitTo(EngineID engine_type, CargoID cid_to);
@@ -400,6 +400,8 @@
 
 void InvalidateAutoreplaceWindow(EngineID e);
 
+int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs);
+
 /* Flags to add to p2 for goto depot commands */
 /* Note: bits 8-10 are used for VLW flags */
 enum {
@@ -409,11 +411,11 @@
 	DEPOT_LOCATE_HANGAR = (1 << 3), // Find another airport if the target one lacks a hangar
 };
 
-typedef struct GetNewVehiclePosResult {
+struct GetNewVehiclePosResult {
 	int x,y;
 	TileIndex old_tile;
 	TileIndex new_tile;
-} GetNewVehiclePosResult;
+};
 
 /**
  * Returns the Trackdir on which the vehicle is currently located.
@@ -437,7 +439,7 @@
 
 DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125)
 
-static inline VehicleID GetMaxVehicleIndex(void)
+static inline VehicleID GetMaxVehicleIndex()
 {
 	/* TODO - This isn't the real content of the function, but
 	 *  with the new pool-system this will be replaced with one that
@@ -447,7 +449,7 @@
 	return GetVehiclePoolSize() - 1;
 }
 
-static inline uint GetNumVehicles(void)
+static inline uint GetNumVehicles()
 {
 	return GetVehiclePoolSize();
 }
@@ -457,7 +459,7 @@
  */
 static inline bool IsValidVehicle(const Vehicle *v)
 {
-	return v->type != VEH_Invalid;
+	return v->type != VEH_INVALID;
 }
 
 void DestroyVehicle(Vehicle *v);
@@ -465,16 +467,16 @@
 static inline void DeleteVehicle(Vehicle *v)
 {
 	DestroyVehicle(v);
-	v->type = VEH_Invalid;
+	v->type = VEH_INVALID;
 }
 
 static inline bool IsPlayerBuildableVehicleType(byte type)
 {
 	switch (type) {
-		case VEH_Train:
-		case VEH_Road:
-		case VEH_Ship:
-		case VEH_Aircraft:
+		case VEH_TRAIN:
+		case VEH_ROAD:
+		case VEH_SHIP:
+		case VEH_AIRCRAFT:
 			return true;
 	}
 	return false;