src/aircraft_gui.cpp
changeset 5780 b16aec7650c2
parent 5668 36b39f4a9032
child 5854 9eee280920f0
equal deleted inserted replaced
5779:a694ce1457bb 5780:b16aec7650c2
    18 #include "player.h"
    18 #include "player.h"
    19 #include "depot.h"
    19 #include "depot.h"
    20 #include "vehicle_gui.h"
    20 #include "vehicle_gui.h"
    21 #include "newgrf_engine.h"
    21 #include "newgrf_engine.h"
    22 
    22 
       
    23 void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selection)
       
    24 {
       
    25 	SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
       
    26 	DrawSprite(GetAircraftImage(v, DIR_W), pal, x + 25, y + 10);
       
    27 	if (v->subtype == 0) {
       
    28 		SpriteID rotor_sprite = GetCustomRotorSprite(v, true);
       
    29 		if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED;
       
    30 		DrawSprite(rotor_sprite, PAL_NONE, x + 25, y + 5);
       
    31 	}
       
    32 	if (v->index == selection) {
       
    33 		DrawFrameRect(x - 1, y - 1, x + 58, y + 21, 0xF, FR_BORDERONLY);
       
    34 	}
       
    35 }
       
    36 
       
    37 void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
       
    38 {
       
    39 	if (success) {
       
    40 		const Vehicle *v = GetVehicle(_new_vehicle_id);
       
    41 
       
    42 		if (v->tile == _backup_orders_tile) {
       
    43 			_backup_orders_tile = 0;
       
    44 			RestoreVehicleOrders(v, _backup_orders_data);
       
    45 		}
       
    46 		ShowAircraftViewWindow(v);
       
    47 	}
       
    48 }
    23 
    49 
    24 void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
    50 void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2)
    25 {
    51 {
    26 	if (success) ShowAircraftViewWindow(GetVehicle(_new_vehicle_id));
    52 	if (success) ShowAircraftViewWindow(GetVehicle(_new_vehicle_id));
    27 }
    53 }