diff options
author | rubidium <rubidium@openttd.org> | 2007-05-24 08:52:28 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-05-24 08:52:28 +0000 |
commit | 29123cf2756b7325f48376501bec5c33d0e8c8ca (patch) | |
tree | cc7580e4422273bf8d7dd165fb39cba3e40d754d | |
parent | d647bc79871d7920e3f507dd74ea44ec92d7b43f (diff) | |
download | openttd-29123cf2756b7325f48376501bec5c33d0e8c8ca.tar.xz |
(svn r9908) -Codechange: prepare the station picker for more road types.
-rw-r--r-- | src/rail_gui.cpp | 4 | ||||
-rw-r--r-- | src/road_gui.cpp | 18 | ||||
-rw-r--r-- | src/station.h | 3 | ||||
-rw-r--r-- | src/station_cmd.cpp | 5 |
4 files changed, 20 insertions, 10 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 999c6afd3..fe5879466 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -755,7 +755,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) 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); + StationPickerDrawSprite(32, 16, _cur_railtype, INVALID_ROADTYPE, 2); } _cur_dpi = old_dpi; } @@ -765,7 +765,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e) 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); + StationPickerDrawSprite(32, 16, _cur_railtype, INVALID_ROADTYPE, 3); } _cur_dpi = old_dpi; } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 9f42415ec..ce8faaf3d 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -479,6 +479,12 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e) { switch (e->event) { case WE_CREATE: + /* Trams don't have non-drivethrough stations */ + if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) { + _road_station_picker_orientation = DIAGDIR_END; + } + SetWindowWidgetsDisabledState(w, _cur_roadtype == ROADTYPE_TRAM, 3, 4, 5, 6, WIDGET_LIST_END); + LowerWindowWidget(w, _road_station_picker_orientation + 3); LowerWindowWidget(w, _station_show_coverage + 9); break; @@ -499,15 +505,15 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e) image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE : GFX_TRUCK_BASE; - StationPickerDrawSprite(103, 35, RAILTYPE_BEGIN, image); - StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image + 1); - StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image + 2); - StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image + 3); + StationPickerDrawSprite(103, 35, RAILTYPE_BEGIN, ROADTYPE_ROAD, image); + StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, ROADTYPE_ROAD, image + 1); + StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, ROADTYPE_ROAD, image + 2); + StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, ROADTYPE_ROAD, image + 3); image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE_EXT : GFX_TRUCK_BASE_EXT; - StationPickerDrawSprite(171, 35, RAILTYPE_BEGIN, image); - StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, image + 1); + StationPickerDrawSprite(171, 35, RAILTYPE_BEGIN, _cur_roadtype, image); + StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, _cur_roadtype, image + 1); DrawStationCoverageAreaText(2, 146, ((w->window_class == WC_BUS_STATION) ? (1 << CT_PASSENGERS) : ~(1 << CT_PASSENGERS)), diff --git a/src/station.h b/src/station.h index 87b0b1154..fb3bbd727 100644 --- a/src/station.h +++ b/src/station.h @@ -10,6 +10,7 @@ #include "oldpool.h" #include "sprite.h" #include "tile.h" +#include "road.h" #include "newgrf_station.h" #include <list> @@ -271,7 +272,7 @@ void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int const DrawTileSprites *GetStationTileLayout(byte gfx); -void StationPickerDrawSprite(int x, int y, RailType railtype, int image); +void StationPickerDrawSprite(int x, int y, RailType railtype, RoadType roadtype, int image); RoadStop * GetRoadStopByTile(TileIndex tile, RoadStop::Type type); uint GetNumRoadStops(const Station* st, RoadStop::Type type); diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 79805859a..404fca9ad 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1253,6 +1253,9 @@ int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (rts == ROADTYPES_NONE || HASBIT(rts, ROADTYPE_HWAY)) return CMD_ERROR; + /* Trams only have drive through stops */ + if (!is_drive_through && HASBIT(rts, ROADTYPE_TRAM)) return CMD_ERROR; + /* Saveguard the parameters */ if (!IsValidDiagDirection((DiagDirection)p1)) return CMD_ERROR; /* If it is a drive-through stop check for valid axis */ @@ -2076,7 +2079,7 @@ static void DrawTile_Station(TileInfo *ti) } } -void StationPickerDrawSprite(int x, int y, RailType railtype, int image) +void StationPickerDrawSprite(int x, int y, RailType railtype, RoadType roadtype, int image) { const RailtypeInfo *rti = GetRailTypeInfo(railtype); SpriteID pal = PLAYER_SPRITE_COLOR(_local_player); |