src/disaster_cmd.cpp
branchgamebalance
changeset 9911 0b8b245a2391
parent 9910 0b2aebc8283e
child 9912 1ac8aac92385
equal deleted inserted replaced
9910:0b2aebc8283e 9911:0b8b245a2391
   114 	SpriteID img = v->u.disaster.image_override;
   114 	SpriteID img = v->u.disaster.image_override;
   115 	if (img == 0) img = _disaster_images[v->subtype][v->direction];
   115 	if (img == 0) img = _disaster_images[v->subtype][v->direction];
   116 	v->cur_image = img;
   116 	v->cur_image = img;
   117 }
   117 }
   118 
   118 
   119 
       
   120 /** Initialize a disaster vehicle. These vehicles are of type VEH_DISASTER, are unclickable
   119 /** Initialize a disaster vehicle. These vehicles are of type VEH_DISASTER, are unclickable
   121  * and owned by nobody */
   120  * and owned by nobody */
   122 static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Direction direction, byte subtype)
   121 static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Direction direction, byte subtype)
   123 {
   122 {
   124 	v->type = VEH_DISASTER;
   123 	v = new (v) DisasterVehicle();
   125 	v->x_pos = x;
   124 	v->x_pos = x;
   126 	v->y_pos = y;
   125 	v->y_pos = y;
   127 	v->z_pos = z;
   126 	v->z_pos = z;
   128 	v->tile = TileVirtXY(x, y);
   127 	v->tile = TileVirtXY(x, y);
   129 	v->direction = direction;
   128 	v->direction = direction;
   130 	v->subtype = subtype;
   129 	v->subtype = subtype;
   131 	v->x_offs = -1;
   130 	v->UpdateDeltaXY(INVALID_DIR);
   132 	v->y_offs = -1;
       
   133 	v->sprite_width = 2;
       
   134 	v->sprite_height = 2;
       
   135 	v->z_height = 5;
       
   136 	v->owner = OWNER_NONE;
   131 	v->owner = OWNER_NONE;
   137 	v->vehstatus = VS_UNCLICKABLE;
   132 	v->vehstatus = VS_UNCLICKABLE;
   138 	v->u.disaster.image_override = 0;
   133 	v->u.disaster.image_override = 0;
   139 	v->current_order.Free();
   134 	v->current_order.Free();
   140 
   135 
  1063 
  1058 
  1064 void StartupDisasters()
  1059 void StartupDisasters()
  1065 {
  1060 {
  1066 	ResetDisasterDelay();
  1061 	ResetDisasterDelay();
  1067 }
  1062 }
       
  1063 
       
  1064 void DisasterVehicle::UpdateDeltaXY(Direction direction)
       
  1065 {
       
  1066 	this->x_offs        = -1;
       
  1067 	this->y_offs        = -1;
       
  1068 	this->sprite_width  =  2;
       
  1069 	this->sprite_height =  2;
       
  1070 	this->z_height      =  5;
       
  1071 }