(svn r6718) -Codechange: added function to get the line height for a vehicle type

-Fix r6513: [depot window] fixed incorrect line height for large ships
-Fix r6513: [depot window] fixed incorrect resizing of the sell button
This commit is contained in:
bjarni 2006-10-10 10:04:09 +00:00
parent 1ae7f10077
commit 7a6518cad9
2 changed files with 12 additions and 7 deletions

View File

@ -53,7 +53,7 @@ static const byte widget_moves[] = {
WIDGET_MOVE_NONE, // DEPOT_WIDGET_CLOSEBOX WIDGET_MOVE_NONE, // DEPOT_WIDGET_CLOSEBOX
WIDGET_STRETCH_RIGHT, // DEPOT_WIDGET_CAPTION WIDGET_STRETCH_RIGHT, // DEPOT_WIDGET_CAPTION
WIDGET_MOVE_RIGHT, // DEPOT_WIDGET_STICKY WIDGET_MOVE_RIGHT, // DEPOT_WIDGET_STICKY
WIDGET_MOVE_RIGHT, // DEPOT_WIDGET_SELL WIDGET_MOVE_RIGHT_STRETCH_DOWN, // DEPOT_WIDGET_SELL
WIDGET_MOVE_NONE, // DEPOT_WIDGET_SELL_CHAIN WIDGET_MOVE_NONE, // DEPOT_WIDGET_SELL_CHAIN
WIDGET_MOVE_DOWN_RIGHT, // DEPOT_WIDGET_SELL_ALL WIDGET_MOVE_DOWN_RIGHT, // DEPOT_WIDGET_SELL_ALL
WIDGET_MOVE_DOWN_RIGHT, // DEPOT_WIDGET_AUTOREPLACE WIDGET_MOVE_DOWN_RIGHT, // DEPOT_WIDGET_AUTOREPLACE
@ -125,7 +125,7 @@ static const WindowDesc _road_depot_desc = {
}; };
static const WindowDesc _ship_depot_desc = { static const WindowDesc _ship_depot_desc = {
-1, -1, 305, 96, -1, -1, 305, 98,
WC_VEHICLE_DEPOT,0, WC_VEHICLE_DEPOT,0,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_depot_widgets, _depot_widgets,
@ -133,7 +133,7 @@ static const WindowDesc _ship_depot_desc = {
}; };
static const WindowDesc _aircraft_depot_desc = { static const WindowDesc _aircraft_depot_desc = {
-1, -1, 331, 96, -1, -1, 331, 98,
WC_VEHICLE_DEPOT,0, WC_VEHICLE_DEPOT,0,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_depot_widgets, _depot_widgets,
@ -969,7 +969,6 @@ void ShowDepotWindow(TileIndex tile, byte type)
w->vscroll.cap = 6; w->vscroll.cap = 6;
w->hscroll.cap = 10 * 29; w->hscroll.cap = 10 * 29;
w->resize.step_width = 1; w->resize.step_width = 1;
w->resize.step_height = 14;
break; break;
case VEH_Road: case VEH_Road:
@ -978,27 +977,28 @@ void ShowDepotWindow(TileIndex tile, byte type)
w->vscroll.cap = 5; w->vscroll.cap = 5;
w->hscroll.cap = 5; w->hscroll.cap = 5;
w->resize.step_width = 56; w->resize.step_width = 56;
w->resize.step_height = 14;
break; break;
case VEH_Ship: case VEH_Ship:
vertical = 2;
w->vscroll.cap = 3; w->vscroll.cap = 3;
w->hscroll.cap = 3; w->hscroll.cap = 3;
w->resize.step_width = 90; w->resize.step_width = 90;
w->resize.step_height = 23;
break; break;
case VEH_Aircraft: case VEH_Aircraft:
horizontal = 26; horizontal = 26;
vertical = 2;
w->vscroll.cap = 3; w->vscroll.cap = 3;
w->hscroll.cap = 4; w->hscroll.cap = 4;
w->resize.step_width = 74; w->resize.step_width = 74;
w->resize.step_height = 23;
break; break;
default: NOT_REACHED(); default: NOT_REACHED();
} }
w->resize.step_height = GetVehicleListHeight(type);
SetupStringsForDepotWindow(w, type); SetupStringsForDepotWindow(w, type);
w->widget[DEPOT_WIDGET_MATRIX].data = w->widget[DEPOT_WIDGET_MATRIX].data =

View File

@ -68,4 +68,9 @@ static inline void DrawVehicleImage(const Vehicle *v, int x, int y, int count, i
} }
} }
static inline byte GetVehicleListHeight(byte type)
{
return (type == VEH_Train || type == VEH_Road) ? 14 : 24;
}
#endif /* VEHICLE_GUI_H */ #endif /* VEHICLE_GUI_H */