19 #include "gfx_func.h" |
19 #include "gfx_func.h" |
20 #include "player_func.h" |
20 #include "player_func.h" |
21 #include "widgets/dropdown_func.h" |
21 #include "widgets/dropdown_func.h" |
22 #include "engine_func.h" |
22 #include "engine_func.h" |
23 #include "engine_base.h" |
23 #include "engine_base.h" |
|
24 #include "window_gui.h" |
24 |
25 |
25 #include "table/sprites.h" |
26 #include "table/sprites.h" |
26 #include "table/strings.h" |
27 #include "table/strings.h" |
27 |
28 |
28 void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group); |
29 void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group); |
247 this->update_right = false; |
248 this->update_right = false; |
248 this->init_lists = false; |
249 this->init_lists = false; |
249 } |
250 } |
250 |
251 |
251 public: |
252 public: |
252 ReplaceVehicleWindow(const WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc, NULL, window_number) |
253 ReplaceVehicleWindow(const WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc, vehicletype) |
253 { |
254 { |
254 this->wagon_btnstate = true; // start with locomotives (all other vehicles will not read this bool) |
255 this->wagon_btnstate = true; // start with locomotives (all other vehicles will not read this bool) |
255 new (&this->list[0]) EngineList(); |
256 new (&this->list[0]) EngineList(); |
256 new (&this->list[1]) EngineList(); |
257 new (&this->list[1]) EngineList(); |
257 this->update_left = true; |
258 this->update_left = true; |
358 if (this->window_number == VEH_TRAIN) { |
359 if (this->window_number == VEH_TRAIN) { |
359 /* Show the selected railtype in the pulldown menu */ |
360 /* Show the selected railtype in the pulldown menu */ |
360 this->widget[RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN].data = _rail_types_list[sel_railtype]; |
361 this->widget[RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN].data = _rail_types_list[sel_railtype]; |
361 } |
362 } |
362 |
363 |
363 DrawWindowWidgets(this); |
364 this->DrawWidgets(); |
364 |
365 |
365 /* sets up the string for the vehicle that is being replaced to */ |
366 /* sets up the string for the vehicle that is being replaced to */ |
366 if (selected_id[0] != INVALID_ENGINE) { |
367 if (selected_id[0] != INVALID_ENGINE) { |
367 if (!EngineHasReplacementForPlayer(p, selected_id[0], selected_group)) { |
368 if (!EngineHasReplacementForPlayer(p, selected_id[0], selected_group)) { |
368 SetDParam(0, STR_NOT_REPLACING); |
369 SetDParam(0, STR_NOT_REPLACING); |
530 static const WindowDesc _replace_rail_vehicle_desc = { |
531 static const WindowDesc _replace_rail_vehicle_desc = { |
531 WDP_AUTO, WDP_AUTO, 456, 140, 456, 140, |
532 WDP_AUTO, WDP_AUTO, 456, 140, 456, 140, |
532 WC_REPLACE_VEHICLE, WC_NONE, |
533 WC_REPLACE_VEHICLE, WC_NONE, |
533 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
534 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
534 _replace_vehicle_widgets, |
535 _replace_vehicle_widgets, |
535 NULL |
|
536 }; |
536 }; |
537 |
537 |
538 static const WindowDesc _replace_vehicle_desc = { |
538 static const WindowDesc _replace_vehicle_desc = { |
539 WDP_AUTO, WDP_AUTO, 456, 118, 456, 118, |
539 WDP_AUTO, WDP_AUTO, 456, 118, 456, 118, |
540 WC_REPLACE_VEHICLE, WC_NONE, |
540 WC_REPLACE_VEHICLE, WC_NONE, |
541 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
541 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
542 _replace_vehicle_widgets, |
542 _replace_vehicle_widgets, |
543 NULL |
|
544 }; |
543 }; |
545 |
544 |
546 RailType ReplaceVehicleWindow::sel_railtype = RAILTYPE_RAIL; |
545 RailType ReplaceVehicleWindow::sel_railtype = RAILTYPE_RAIL; |
547 |
546 |
548 void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype) |
547 void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype) |