summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-30 21:27:51 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-30 21:27:51 +0000
commit57146a3417723c6d069afca604222924e73223dd (patch)
tree8dcf7bbcdbcb54abccc5d02cf3307eb2c79dfa09
parent65c163668a1d9e5150645ad0c6d83869e5792c3c (diff)
downloadopenttd-57146a3417723c6d069afca604222924e73223dd.tar.xz
(svn r5048) - NewStations: Set up clipping areas to draw the station preview graphics in. This prevents larger station graphics from overflowing onto the list.
-rw-r--r--rail_gui.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/rail_gui.c b/rail_gui.c
index f8f7f48de..d260d12f6 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -620,6 +620,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
uint bits;
bool newstations = _railstation.newstations;
int y_offset;
+ DrawPixelInfo tmp_dpi, *old_dpi;
if (WP(w,def_d).close) return;
@@ -671,11 +672,24 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
y_offset = newstations ? 90 : 0;
- if (!DrawStationTile(39, 42 + y_offset, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) {
- StationPickerDrawSprite(39, 42 + y_offset, _cur_railtype, 2);
+ /* Set up a clipping area for the '/' station preview */
+ if (FillDrawPixelInfo(&tmp_dpi, NULL, 7, 26 + y_offset, 66, 48)) {
+ old_dpi = _cur_dpi;
+ _cur_dpi = &tmp_dpi;
+ if (!DrawStationTile(32, 16, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) {
+ StationPickerDrawSprite(32, 16, _cur_railtype, 2);
+ }
+ _cur_dpi = old_dpi;
}
- if (!DrawStationTile(107, 42 + y_offset, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
- StationPickerDrawSprite(107, 42 + y_offset, _cur_railtype, 3);
+
+ /* Set up a clipping area for the '\' station preview */
+ if (FillDrawPixelInfo(&tmp_dpi, NULL, 75, 26 + y_offset, 66, 48)) {
+ old_dpi = _cur_dpi;
+ _cur_dpi = &tmp_dpi;
+ if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
+ StationPickerDrawSprite(32, 16, _cur_railtype, 3);
+ }
+ _cur_dpi = old_dpi;
}
DrawStringCentered(74, 15 + y_offset, STR_3002_ORIENTATION, 0);