summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-27 15:40:55 +0000
committerbjarni <bjarni@openttd.org>2006-09-27 15:40:55 +0000
commitc07324c8782816ebb71ef61b543e32dd491d6603 (patch)
tree9ddb344d69511b78f91340dbf576a2d01a61517c
parentd67f0cf3ec31baac73e22ea78bfa611fde3b78f7 (diff)
downloadopenttd-c07324c8782816ebb71ef61b543e32dd491d6603.tar.xz
(svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
The result of this missing switch was asserts in some cloning conditions (not all) (spotted by KUDr)
-rw-r--r--aircraft.h2
-rw-r--r--depot_gui.c8
-rw-r--r--roadveh.h2
-rw-r--r--train.h1
4 files changed, 12 insertions, 1 deletions
diff --git a/aircraft.h b/aircraft.h
index 06e53797a..132aa6a96 100644
--- a/aircraft.h
+++ b/aircraft.h
@@ -20,4 +20,6 @@ static inline bool IsAircraftInHangarStopped(const Vehicle* v)
uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type);
+void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
+
#endif /* AIRCRAFT_H */
diff --git a/depot_gui.c b/depot_gui.c
index d83e9119e..494efa992 100644
--- a/depot_gui.c
+++ b/depot_gui.c
@@ -4,6 +4,7 @@
#include "openttd.h"
#include "functions.h"
#include "ship.h"
+#include "aircraft.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "gui.h"
@@ -150,7 +151,12 @@ extern int WagonLengthToPixels(int len);
void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (!success) return;
- CcCloneShip(true, tile, p1, p2);
+ switch(GetVehicle(p1)->type) {
+ case VEH_Train: CcCloneTrain( true, tile, p1, p2); break;
+ 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;
+ }
}
static inline void ShowVehicleViewWindow(const Vehicle *v)
diff --git a/roadveh.h b/roadveh.h
index 9d5800e6d..a30d6d536 100644
--- a/roadveh.h
+++ b/roadveh.h
@@ -13,3 +13,5 @@ static inline bool IsRoadVehInDepotStopped(const Vehicle* v)
{
return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED;
}
+
+void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
diff --git a/train.h b/train.h
index 485e80b6f..5dcf2d4f3 100644
--- a/train.h
+++ b/train.h
@@ -219,5 +219,6 @@ void ConvertOldMultiheadToNew(void);
void ConnectMultiheadedTrains(void);
int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped);
+void CcCloneTrain(bool success, TileIndex tile, uint32 p1, uint32 p2);
#endif /* TRAIN_H */