src/ship.h
changeset 7048 06b931095b26
parent 6916 e87d54a598ea
child 7049 01825af2ce90
--- a/src/ship.h	Sun Apr 29 20:16:58 2007 +0000
+++ b/src/ship.h	Sun Apr 29 21:24:08 2007 +0000
@@ -23,4 +23,23 @@
 	return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
 }
 
+
+/**
+ * This class 'wraps' Vehicle; you do not actually instantiate this class.
+ * You create a Vehicle using AllocateVehicle, so it is added to the pool
+ * and you reinitialize that to a Train using:
+ *   v = new (v) Ship();
+ *
+ * As side-effect the vehicle type is set correctly.
+ */
+struct Ship: public Vehicle {
+	/** Initializes the Vehicle to a ship */
+	Ship() { this->type = VEH_SHIP; }
+
+	/** We want to 'destruct' the right class. */
+	virtual ~Ship() {}
+
+	const char *GetTypeString() { return "ship"; }
+};
+
 #endif /* SHIP_H */