(svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
authorbjarni
Wed, 27 Sep 2006 15:40:55 +0000
changeset 4653 091f530bae28
parent 4652 4db9b10ba8d5
child 4654 71048359c6ac
(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)
aircraft.h
depot_gui.c
roadveh.h
train.h
--- a/aircraft.h	Wed Sep 27 15:28:47 2006 +0000
+++ b/aircraft.h	Wed Sep 27 15:40:55 2006 +0000
@@ -20,4 +20,6 @@
 
 uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type);
 
+void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
+
 #endif /* AIRCRAFT_H */
--- a/depot_gui.c	Wed Sep 27 15:28:47 2006 +0000
+++ b/depot_gui.c	Wed Sep 27 15:40:55 2006 +0000
@@ -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 @@
 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)
--- a/roadveh.h	Wed Sep 27 15:28:47 2006 +0000
+++ b/roadveh.h	Wed Sep 27 15:40:55 2006 +0000
@@ -13,3 +13,5 @@
 {
 	return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED;
 }
+
+void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
--- a/train.h	Wed Sep 27 15:28:47 2006 +0000
+++ b/train.h	Wed Sep 27 15:40:55 2006 +0000
@@ -219,5 +219,6 @@
 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 */