src/disaster_cmd.cpp
branchgamebalance
changeset 9911 0b8b245a2391
parent 9910 0b2aebc8283e
child 9912 1ac8aac92385
--- a/src/disaster_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
+++ b/src/disaster_cmd.cpp	Wed Jun 13 11:45:14 2007 +0000
@@ -116,23 +116,18 @@
 	v->cur_image = img;
 }
 
-
 /** Initialize a disaster vehicle. These vehicles are of type VEH_DISASTER, are unclickable
  * and owned by nobody */
 static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Direction direction, byte subtype)
 {
-	v->type = VEH_DISASTER;
+	v = new (v) DisasterVehicle();
 	v->x_pos = x;
 	v->y_pos = y;
 	v->z_pos = z;
 	v->tile = TileVirtXY(x, y);
 	v->direction = direction;
 	v->subtype = subtype;
-	v->x_offs = -1;
-	v->y_offs = -1;
-	v->sprite_width = 2;
-	v->sprite_height = 2;
-	v->z_height = 5;
+	v->UpdateDeltaXY(INVALID_DIR);
 	v->owner = OWNER_NONE;
 	v->vehstatus = VS_UNCLICKABLE;
 	v->u.disaster.image_override = 0;
@@ -1065,3 +1060,12 @@
 {
 	ResetDisasterDelay();
 }
+
+void DisasterVehicle::UpdateDeltaXY(Direction direction)
+{
+	this->x_offs        = -1;
+	this->y_offs        = -1;
+	this->sprite_width  =  2;
+	this->sprite_height =  2;
+	this->z_height      =  5;
+}