Center sprites on station picker for road stations and rail stations.
This commit is contained in:
@@ -1092,8 +1092,9 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
if (!DrawStationTile(32, 28, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) {
|
||||
StationPickerDrawSprite(32, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2);
|
||||
int x = Center(TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS);
|
||||
if (!DrawStationTile(x, 28, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) {
|
||||
StationPickerDrawSprite(x, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2);
|
||||
}
|
||||
_cur_dpi = old_dpi;
|
||||
}
|
||||
@@ -1104,8 +1105,9 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
if (!DrawStationTile(32, 28, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
|
||||
StationPickerDrawSprite(32, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3);
|
||||
int x = Center(TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS);
|
||||
if (!DrawStationTile(x, 28, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
|
||||
StationPickerDrawSprite(x, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3);
|
||||
}
|
||||
_cur_dpi = old_dpi;
|
||||
}
|
||||
@@ -1140,8 +1142,9 @@ public:
|
||||
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
|
||||
DrawPixelInfo *old_dpi = _cur_dpi;
|
||||
_cur_dpi = &tmp_dpi;
|
||||
if (!DrawStationTile(32, 28, _cur_railtype, _railstation.orientation, _railstation.station_class, type)) {
|
||||
StationPickerDrawSprite(32, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2 + _railstation.orientation);
|
||||
int x = Center(TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS);
|
||||
if (!DrawStationTile(x, 28, _cur_railtype, _railstation.orientation, _railstation.station_class, type)) {
|
||||
StationPickerDrawSprite(x, 28, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 2 + _railstation.orientation);
|
||||
}
|
||||
_cur_dpi = old_dpi;
|
||||
}
|
||||
|
||||
@@ -992,8 +992,12 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return;
|
||||
|
||||
int x = Center(r.left + TILE_PIXELS, r.right - r.left, 2 * TILE_PIXELS);
|
||||
/* Height of bus/truck sprite in OpenGFX is TILE_PIXELS + 11. */
|
||||
int y = Center(r.top + WD_FRAMERECT_TOP - WD_MATRIX_BOTTOM + IsWidgetLowered(widget) + 11, r.bottom - r.top, TILE_PIXELS + 11);
|
||||
|
||||
StationType st = (this->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
|
||||
StationPickerDrawSprite(r.left + TILE_PIXELS, r.bottom - TILE_PIXELS, st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE);
|
||||
StationPickerDrawSprite(x, y, st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
|
||||
Reference in New Issue
Block a user