diff options
author | Darkvater <darkvater@openttd.org> | 2005-08-29 22:27:22 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-08-29 22:27:22 +0000 |
commit | 74f0c8b55afc6f9b5043369059fb68590e645d2f (patch) | |
tree | ef336f9c50699a725557b6cd824169e00afdce24 | |
parent | a02ee8ffda354231316d950ea4bdf457e075e4c4 (diff) | |
download | openttd-74f0c8b55afc6f9b5043369059fb68590e645d2f.tar.xz |
(svn r2901) Refix 'replace window' with wrong string-etc. coordinates. Also clean up, and make window-title a bit more meaningful (specify vehicle type replaced)
-rw-r--r-- | lang/english.txt | 2 | ||||
-rw-r--r-- | vehicle_gui.c | 84 |
2 files changed, 43 insertions, 43 deletions
diff --git a/lang/english.txt b/lang/english.txt index d09124e96..3e41db21d 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -2734,7 +2734,7 @@ STR_SCHEDULED_AIRCRAFT_TIP :{BLACK}Show all STR_SCHEDULED_SHIPS_TIP :{BLACK}Show all ships which have this station on their schedule STR_REPLACE_VEHICLES :{BLACK}Replace Vehicles -STR_REPLACE_VEHICLES_WHITE :{WHITE}Replace Vehicles +STR_REPLACE_VEHICLES_WHITE :{WHITE}Replace {STRING} STR_REPLACE_VEHICLES_START :{BLACK}Start Replacing Vehicles STR_REPLACE_VEHICLES_STOP :{BLACK}Stop Replacing Vehicles STR_NOT_REPLACING :{BLACK}Not replacing diff --git a/vehicle_gui.c b/vehicle_gui.c index a61889556..064ad0f18 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -740,15 +740,11 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int } static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) { - // these 3 variables is used if any of the lists is clicked - uint16 click_scroll_pos = w->vscroll2.pos; - uint16 click_scroll_cap = w->vscroll2.cap; - byte click_side = 1; - Player *p = GetPlayer(_local_player); - - switch(e->event) { - case WE_PAINT: - { + static const StringID _vehicle_type_names[4] = {STR_019F_TRAIN, STR_019C_ROAD_VEHICLE, STR_019E_SHIP,STR_019D_AIRCRAFT}; + + switch (e->event) { + case WE_PAINT: { + const Player *p = GetPlayer(_local_player); int pos = w->vscroll.pos; int selected_id[2] = {-1,-1}; int x = 1; @@ -826,10 +822,9 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) CLRBIT(w->disabled_state, 6); // now the actual drawing of the window itself takes place + SetDParam(0, _vehicle_type_names[WP(w, replaceveh_d).vehicletype - VEH_Train]); DrawWindowWidgets(w); - - // sets up the string for the vehicle that is being replaced to if ( selected_id[0] != -1 ) { if (p->engine_replacement[selected_id[0]] == INVALID_ENGINE) @@ -841,7 +836,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) } - DrawString(145, (w->resize.step_height == 24 ? 67 : 77 ) + ( w->resize.step_height * w->vscroll.cap), STR_02BD, 0x10); + DrawString(145, (w->resize.step_height == 24 ? 67 : 87 ) + ( w->resize.step_height * w->vscroll.cap), STR_02BD, 0x10); /* now we draw the two arrays according to what we just counted */ @@ -904,7 +899,12 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) } break; // end of paint case WE_CLICK: { - switch(e->click.widget) { + // these 3 variables is used if any of the lists is clicked + uint16 click_scroll_pos = w->vscroll2.pos; + uint16 click_scroll_cap = w->vscroll2.cap; + byte click_side = 1; + + switch (e->click.widget) { case 14: case 15: { /* Select sorting criteria dropdown menu */ ShowDropDownMenu(w, _rail_types_list, _railtype_selected_in_replace_gui, 15, ~GetPlayer(_local_player)->avail_railtypes, 1); break; @@ -959,59 +959,59 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) static const Widget _replace_rail_vehicle_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 443, 0, 13, STR_REPLACE_VEHICLES_WHITE, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 444, 455, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_PANEL, RESIZE_TB, 14, 0, 227, 126, 197, 0x0, STR_NULL}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 444, 455, 0, 13, STR_NULL, STR_STICKY_BUTTON}, +{ WWT_PANEL, RESIZE_TB, 14, 0, 227, 126, 197, STR_NULL, STR_NULL}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 138, 210, 221, STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON}, -{ WWT_PANEL, RESIZE_TB, 14, 139, 316, 198, 209, 0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB}, +{ WWT_PANEL, RESIZE_TB, 14, 139, 316, 198, 209, STR_NULL, STR_REPLACE_HELP_REPLACE_INFO_TAB}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 306, 443, 210, 221, STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON}, { WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 215, 14, 125, 0x801, STR_REPLACE_HELP_LEFT_ARRAY}, -{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 216, 227, 14, 125, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 216, 227, 14, 125, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, { WWT_MATRIX, RESIZE_BOTTOM, 14, 228, 443, 14, 125, 0x801, STR_REPLACE_HELP_RIGHT_ARRAY}, -{ WWT_SCROLL2BAR, RESIZE_BOTTOM, 14, 444, 455, 14, 125, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_PANEL, RESIZE_TB, 14, 228, 455, 126, 197, 0x0, STR_NULL}, +{ WWT_SCROLL2BAR, RESIZE_BOTTOM, 14, 444, 455, 14, 125, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_PANEL, RESIZE_TB, 14, 228, 455, 126, 197, STR_NULL, STR_NULL}, // train specific stuff -{ WWT_PANEL, RESIZE_TB, 14, 0, 138, 198, 209, 0x0, STR_NULL}, -{ WWT_PANEL, RESIZE_TB, 14, 139, 153, 210, 221, 0x0, STR_NULL}, -{ WWT_PANEL, RESIZE_TB, 14, 154, 277, 210, 221, 0x0, STR_REPLACE_HELP_RAILTYPE}, +{ WWT_PANEL, RESIZE_TB, 14, 0, 138, 198, 209, STR_NULL, STR_NULL}, +{ WWT_PANEL, RESIZE_TB, 14, 139, 153, 210, 221, STR_NULL, STR_NULL}, +{ WWT_PANEL, RESIZE_TB, 14, 154, 277, 210, 221, STR_NULL, STR_REPLACE_HELP_RAILTYPE}, { WWT_CLOSEBOX, RESIZE_TB, 14, 278, 289, 210, 221, STR_0225, STR_REPLACE_HELP_RAILTYPE}, -{ WWT_PANEL, RESIZE_TB, 14, 290, 305, 210, 221, 0x0, STR_NULL}, -{ WWT_PANEL, RESIZE_TB, 14, 317, 455, 198, 209, 0x0, STR_NULL}, +{ WWT_PANEL, RESIZE_TB, 14, 290, 305, 210, 221, STR_NULL, STR_NULL}, +{ WWT_PANEL, RESIZE_TB, 14, 317, 455, 198, 209, STR_NULL, STR_NULL}, // end of train specific stuff -{ WWT_RESIZEBOX, RESIZE_TB, 14, 444, 455, 210, 221, 0x0, STR_RESIZE_BUTTON}, +{ WWT_RESIZEBOX, RESIZE_TB, 14, 444, 455, 210, 221, STR_NULL, STR_RESIZE_BUTTON}, { WIDGETS_END}, }; static const Widget _replace_road_vehicle_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 443, 0, 13, STR_REPLACE_VEHICLES_WHITE, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 444, 455, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_PANEL, RESIZE_TB, 14, 0, 227, 126, 187, 0x0, STR_NULL}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 138, 188, 199, STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON}, -{ WWT_PANEL, RESIZE_TB, 14, 139, 305, 188, 199, 0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 306, 443, 188, 199, STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 444, 455, 0, 13, STR_NULL, STR_STICKY_BUTTON}, +{ WWT_PANEL, RESIZE_TB, 14, 0, 227, 126, 197, STR_NULL, STR_NULL}, +{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 138, 198, 209, STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON}, +{ WWT_PANEL, RESIZE_TB, 14, 139, 305, 198, 209, STR_NULL, STR_REPLACE_HELP_REPLACE_INFO_TAB}, +{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 306, 443, 198, 209, STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON}, { WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 215, 14, 125, 0x801, STR_REPLACE_HELP_LEFT_ARRAY}, -{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 216, 227, 14, 125, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 216, 227, 14, 125, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, { WWT_MATRIX, RESIZE_BOTTOM, 14, 228, 443, 14, 125, 0x801, STR_REPLACE_HELP_RIGHT_ARRAY}, -{ WWT_SCROLL2BAR, RESIZE_BOTTOM, 14, 444, 455, 14, 125, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_PANEL, RESIZE_TB, 14, 228, 455, 126, 187, 0x0, STR_NULL}, -{ WWT_RESIZEBOX, RESIZE_TB, 14, 444, 455, 188, 199, 0x0, STR_RESIZE_BUTTON}, +{ WWT_SCROLL2BAR, RESIZE_BOTTOM, 14, 444, 455, 14, 125, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_PANEL, RESIZE_TB, 14, 228, 455, 126, 197, STR_NULL, STR_NULL}, +{ WWT_RESIZEBOX, RESIZE_TB, 14, 444, 455, 198, 209, STR_NULL, STR_RESIZE_BUTTON}, { WIDGETS_END}, }; static const Widget _replace_ship_aircraft_vehicle_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_NONE, 14, 11, 443, 0, 13, STR_REPLACE_VEHICLES_WHITE, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 444, 455, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_PANEL, RESIZE_TB, 14, 0, 227, 110, 161, 0x0, STR_NULL}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 444, 455, 0, 13, STR_NULL, STR_STICKY_BUTTON}, +{ WWT_PANEL, RESIZE_TB, 14, 0, 227, 110, 161, STR_NULL, STR_NULL}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 138, 162, 173, STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON}, -{ WWT_PANEL, RESIZE_TB, 14, 139, 305, 162, 173, 0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB}, +{ WWT_PANEL, RESIZE_TB, 14, 139, 305, 162, 173, STR_NULL, STR_REPLACE_HELP_REPLACE_INFO_TAB}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 306, 443, 162, 173, STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON}, { WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 215, 14, 109, 0x401, STR_REPLACE_HELP_LEFT_ARRAY}, -{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 216, 227, 14, 109, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 216, 227, 14, 109, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, { WWT_MATRIX, RESIZE_BOTTOM, 14, 228, 443, 14, 109, 0x401, STR_REPLACE_HELP_RIGHT_ARRAY}, -{ WWT_SCROLL2BAR, RESIZE_BOTTOM, 14, 444, 455, 14, 109, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_PANEL, RESIZE_TB, 14, 228, 455, 110, 161, 0x0, STR_NULL}, -{ WWT_RESIZEBOX, RESIZE_TB, 14, 444, 455, 162, 173, 0x0, STR_RESIZE_BUTTON}, +{ WWT_SCROLL2BAR, RESIZE_BOTTOM, 14, 444, 455, 14, 109, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_PANEL, RESIZE_TB, 14, 228, 455, 110, 161, STR_NULL, STR_NULL}, +{ WWT_RESIZEBOX, RESIZE_TB, 14, 444, 455, 162, 173, STR_NULL, STR_RESIZE_BUTTON}, { WIDGETS_END}, }; @@ -1024,7 +1024,7 @@ static const WindowDesc _replace_rail_vehicle_desc = { }; static const WindowDesc _replace_road_vehicle_desc = { - -1, -1, 456, 200, + -1, -1, 456, 210, WC_REPLACE_VEHICLE,0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _replace_road_vehicle_widgets, |