src/disaster_cmd.cpp
branchNewGRF_ports
changeset 6872 1c4a4a609f85
parent 6871 5a9dc001e1ad
child 6877 889301acc299
equal deleted inserted replaced
6871:5a9dc001e1ad 6872:1c4a4a609f85
    16  */
    16  */
    17 
    17 
    18 
    18 
    19 #include "stdafx.h"
    19 #include "stdafx.h"
    20 #include "openttd.h"
    20 #include "openttd.h"
    21 #include "functions.h"
       
    22 #include "landscape.h"
    21 #include "landscape.h"
       
    22 
    23 #include "industry_map.h"
    23 #include "industry_map.h"
    24 #include "station_map.h"
    24 #include "station_map.h"
    25 #include "table/strings.h"
    25 #include "command_func.h"
    26 #include "strings.h"
    26 #include "tile_cmd.h"
    27 #include "map.h"
       
    28 #include "tile.h"
       
    29 #include "vehicle.h"
       
    30 #include "command.h"
       
    31 #include "news.h"
    27 #include "news.h"
    32 #include "station.h"
    28 #include "station.h"
    33 #include "waypoint.h"
    29 #include "waypoint.h"
    34 #include "town.h"
    30 #include "town.h"
    35 #include "industry.h"
    31 #include "industry.h"
    36 #include "player.h"
    32 #include "player_func.h"
    37 #include "airport.h"
    33 #include "airport.h"
    38 #include "sound.h"
       
    39 #include "variables.h"
    34 #include "variables.h"
       
    35 #include "settings_type.h"
       
    36 #include "strings_func.h"
       
    37 #include "date_func.h"
       
    38 #include "functions.h"
       
    39 #include "vehicle_func.h"
       
    40 #include "vehicle_base.h"
       
    41 #include "sound_func.h"
       
    42 
       
    43 #include "table/strings.h"
    40 #include "table/sprites.h"
    44 #include "table/sprites.h"
    41 #include "date.h"
       
    42 
    45 
    43 enum DisasterSubType {
    46 enum DisasterSubType {
    44 	ST_Zeppeliner,
    47 	ST_Zeppeliner,
    45 	ST_Zeppeliner_Shadow,
    48 	ST_Zeppeliner_Shadow,
    46 	ST_Small_Ufo,
    49 	ST_Small_Ufo,
    67 			if (IsHumanPlayer(GetTileOwner(tile)) && !IsRailWaypoint(tile)) {
    70 			if (IsHumanPlayer(GetTileOwner(tile)) && !IsRailWaypoint(tile)) {
    68 				PlayerID p = _current_player;
    71 				PlayerID p = _current_player;
    69 				_current_player = OWNER_WATER;
    72 				_current_player = OWNER_WATER;
    70 				DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
    73 				DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
    71 				_current_player = p;
    74 				_current_player = p;
       
    75 
       
    76 				/* update signals in buffer */
       
    77 				UpdateSignalsInBuffer();
    72 			}
    78 			}
    73 			break;
    79 			break;
    74 
    80 
    75 		case MP_HOUSE: {
    81 		case MP_HOUSE: {
    76 			PlayerID p = _current_player;
    82 			PlayerID p = _current_player;
   133 	v->u.disaster.image_override = 0;
   139 	v->u.disaster.image_override = 0;
   134 	v->current_order.Free();
   140 	v->current_order.Free();
   135 
   141 
   136 	DisasterVehicleUpdateImage(v);
   142 	DisasterVehicleUpdateImage(v);
   137 	VehiclePositionChanged(v);
   143 	VehiclePositionChanged(v);
   138 	BeginVehicleMove(v);
   144 	MarkSingleVehicleDirty(v);
   139 	EndVehicleMove(v);
       
   140 }
   145 }
   141 
   146 
   142 static void DeleteDisasterVeh(Vehicle *v)
   147 static void DeleteDisasterVeh(Vehicle *v)
   143 {
   148 {
   144 	DeleteVehicleChain(v);
   149 	DeleteVehicleChain(v);
   545 	if (HasBit(v->tick_counter, 0)) return;
   550 	if (HasBit(v->tick_counter, 0)) return;
   546 
   551 
   547 	if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
   552 	if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
   548 
   553 
   549 	VehiclePositionChanged(v);
   554 	VehiclePositionChanged(v);
   550 	BeginVehicleMove(v);
   555 	MarkSingleVehicleDirty(v);
   551 	EndVehicleMove(v);
       
   552 }
   556 }
   553 
   557 
   554 /**
   558 /**
   555  * (Big) Ufo handling, v->current_order.dest states:
   559  * (Big) Ufo handling, v->current_order.dest states:
   556  * 0: Fly around to the middle of the map, then randomly for a while and home in on a piece of rail
   560  * 0: Fly around to the middle of the map, then randomly for a while and home in on a piece of rail
   704 
   708 
   705 	v->tick_counter++;
   709 	v->tick_counter++;
   706 
   710 
   707 	if (++v->age > 8880) {
   711 	if (++v->age > 8880) {
   708 		VehiclePositionChanged(v);
   712 		VehiclePositionChanged(v);
   709 		BeginVehicleMove(v);
   713 		MarkSingleVehicleDirty(v);
   710 		EndVehicleMove(v);
       
   711 		delete v;
   714 		delete v;
   712 		return;
   715 		return;
   713 	}
   716 	}
   714 
   717 
   715 	if (!HasBit(v->tick_counter, 0)) return;
   718 	if (!HasBit(v->tick_counter, 0)) return;