diff options
author | truelight <truelight@openttd.org> | 2005-01-06 17:40:57 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-01-06 17:40:57 +0000 |
commit | 2c9cd8f68c1bf491e4c887de2899f0e0601c297c (patch) | |
tree | f7f9f3da92039b27065ab51729b36e613b5e9f4e | |
parent | 8e58dd8dec13a7db75452ca5c8ed6c9541bbce8a (diff) | |
download | openttd-2c9cd8f68c1bf491e4c887de2899f0e0601c297c.tar.xz |
(svn r1401) -Fix: glitches in train-depot GUI (tnx to Hackykid)
-Fix: glitch in Company Overview GUI (Hackykid)
-rw-r--r-- | player_gui.c | 17 | ||||
-rw-r--r-- | train_gui.c | 26 |
2 files changed, 23 insertions, 20 deletions
diff --git a/player_gui.c b/player_gui.c index 4c7fab8cb..c03d6a1bc 100644 --- a/player_gui.c +++ b/player_gui.c @@ -497,26 +497,25 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) switch(e->event) { case WE_PAINT: { Player *p = DEREF_PLAYER(w->window_number); - uint32 dis; + uint32 dis = 0; if (!IsWindowOfPrototype(w, _other_player_company_widgets)) { AssignWidgetToWindow(w, (p->location_of_house != 0) ? _my_player_company_bh_widgets : _my_player_company_widgets); if (!_networking) w->hidden_state |= (1 << 9); // hide company-password widget + } else { + if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) dis |= 1 << 9; + // Also disable the buy button if 25% is not-owned by someone + // and the player is not an AI + if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) dis |= 1 << 9; + if (GetAmountOwnedBy(p, _local_player) == 0) dis |= 1 << 10; + if (_local_player == OWNER_SPECTATOR) dis |= (1 << 9) | (1 << 10); } SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, GetPlayerNameString((byte)w->window_number, 3)); - dis = 0; - if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) dis |= 1 << 9; - // Also disable the buy button if 25% is not-owned by someone - // and the player is not an AI - if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) dis |= 1 << 9; - if (GetAmountOwnedBy(p, _local_player) == 0) dis |= 1 << 10; - if (_local_player == OWNER_SPECTATOR) dis |= (1 << 9) | (1 << 10); - w->disabled_state = dis; DrawWindowWidgets(w); diff --git a/train_gui.c b/train_gui.c index ec7dde994..90d69da58 100644 --- a/train_gui.c +++ b/train_gui.c @@ -329,6 +329,10 @@ static void DrawTrainDepotWindow(Window *w) } } } + + /* Always have 1 empty row, so people can change the setting of the train */ + num++; + SetVScrollCount(w, num); SetHScrollCount(w, hnum); @@ -397,7 +401,7 @@ static int GetVehicleFromTrainDepotWndPt(Window *w, int x, int y, GetDepotVehicl } row = (y - 14) / 14; - if ( (uint) row >= 6) + if ( (uint) row >= w->vscroll.cap) return 1; /* means err */ row += w->vscroll.pos; @@ -604,22 +608,22 @@ static const Widget _train_depot_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 336, 0, 13, STR_8800_TRAIN_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_STICKYBOX, RESIZE_LR, 14, 337, 348, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_MATRIX, RESIZE_RB, 14, 0, 313, 14, 96, 0x601, STR_883F_TRAINS_CLICK_ON_TRAIN_FOR}, +{ WWT_MATRIX, RESIZE_RB, 14, 0, 313, 14, 97, 0x601, STR_883F_TRAINS_CLICK_ON_TRAIN_FOR}, { WWT_PANEL, RESIZE_LRB, 14, 314, 336, 14, 13, 0x0, STR_NULL}, { WWT_PANEL, RESIZE_LRTB, 14, 314, 336, 14, 54, 0x2A9, STR_8841_DRAG_TRAIN_VEHICLE_TO_HERE}, -{ WWT_PANEL, RESIZE_LRTB, 14, 314, 336, 55, 108, 0x2BF, STR_DRAG_WHOLE_TRAIN_TO_SELL_TIP}, - -{ WWT_SCROLLBAR, RESIZE_LRB, 14, 337, 348, 14, 108, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 167, 109, 120, STR_8815_NEW_VEHICLES, STR_8840_BUILD_NEW_TRAIN_VEHICLE}, -{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 168, 336, 109, 120, STR_00E4_LOCATION, STR_8842_CENTER_MAIN_VIEW_ON_TRAIN}, -{ WWT_HSCROLLBAR, RESIZE_RTB, 14, 0, 313, 97, 108, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_PANEL, RESIZE_RTB, 14, 337, 336, 109, 120, 0x0, STR_NULL}, -{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 337, 348, 109, 120, 0x0, STR_RESIZE_BUTTON}, +{ WWT_PANEL, RESIZE_LRTB, 14, 314, 336, 55, 109, 0x2BF, STR_DRAG_WHOLE_TRAIN_TO_SELL_TIP}, + +{ WWT_SCROLLBAR, RESIZE_LRB, 14, 337, 348, 14, 109, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 167, 110, 121, STR_8815_NEW_VEHICLES, STR_8840_BUILD_NEW_TRAIN_VEHICLE}, +{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 168, 336, 110, 121, STR_00E4_LOCATION, STR_8842_CENTER_MAIN_VIEW_ON_TRAIN}, +{ WWT_HSCROLLBAR, RESIZE_RTB, 14, 0, 313, 98, 109, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, +{ WWT_PANEL, RESIZE_RTB, 14, 337, 336, 110, 121, 0x0, STR_NULL}, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 337, 348, 110, 121, 0x0, STR_RESIZE_BUTTON}, { WIDGETS_END}, }; static const WindowDesc _train_depot_desc = { - -1, -1, 349, 121, + -1, -1, 349, 122, WC_VEHICLE_DEPOT,0, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _train_depot_widgets, |