mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r1401) -Fix: glitches in train-depot GUI (tnx to Hackykid)
-Fix: glitch in Company Overview GUI (Hackykid)
This commit is contained in:
parent
8e58dd8dec
commit
2c9cd8f68c
17
player_gui.c
17
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);
|
||||
|
||||
|
24
train_gui.c
24
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_PANEL, RESIZE_LRTB, 14, 314, 336, 55, 109, 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_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,
|
||||
|
Loading…
Reference in New Issue
Block a user