diff options
author | rubidium <rubidium@openttd.org> | 2009-07-18 10:01:31 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-18 10:01:31 +0000 |
commit | 861a2163f615fef311ea0ee6c7c4abeb1e2e65c0 (patch) | |
tree | 278567959796487fd7e6cb1c17aba1182778eba7 /src | |
parent | 8c17c6cb2bba037e0e7cbe5f97bc2e025bed9a6f (diff) | |
download | openttd-861a2163f615fef311ea0ee6c7c4abeb1e2e65c0.tar.xz |
(svn r16869) -Codechange: make drawing waypoints a tiny bit more like drawing stations
Diffstat (limited to 'src')
-rw-r--r-- | src/rail.h | 1 | ||||
-rw-r--r-- | src/rail_cmd.cpp | 10 | ||||
-rw-r--r-- | src/station_cmd.cpp | 1 | ||||
-rw-r--r-- | src/station_type.h | 3 | ||||
-rw-r--r-- | src/table/station_land.h | 18 | ||||
-rw-r--r-- | src/table/track_land.h | 19 | ||||
-rw-r--r-- | src/waypoint.cpp | 2 |
7 files changed, 24 insertions, 30 deletions
diff --git a/src/rail.h b/src/rail.h index 02a17a622..9a9fa3423 100644 --- a/src/rail.h +++ b/src/rail.h @@ -222,7 +222,6 @@ static inline Money RailConvertCost(RailType from, RailType to) Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data); void DrawTrainDepotSprite(int x, int y, int image, RailType railtype); -void DrawDefaultWaypointSprite(int x, int y, RailType railtype); Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data); int TicksToLeaveDepot(const Train *v); diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index d0dfa5f8d..fc79d413a 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1973,7 +1973,7 @@ static void DrawTile_Track(TileInfo *ti) } else { default_waypoint: /* There is no custom layout, fall back to the default graphics */ - dts = &_waypoint_gfx_table[GetWaypointAxis(ti->tile)]; + dts = GetStationTileLayout(STATION_WAYPOINT, GetWaypointAxis(ti->tile)); relocation = 0; image = dts->ground.sprite + rti->total_offset; if (IsSnowRailGround(ti->tile)) image += rti->snow_offset; @@ -2049,14 +2049,6 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype) DrawTileSequence(x + 33, y + 17, image, dts->seq, offset); } -void DrawDefaultWaypointSprite(int x, int y, RailType railtype) -{ - uint32 offset = GetRailTypeInfo(railtype)->total_offset; - const DrawTileSprites *dts = &_waypoint_gfx_table[AXIS_X]; - - DrawTileSequence(x, y, dts->ground.sprite + offset, dts->seq, 0); -} - static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y) { uint z; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index c6e98c612..603bfea93 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3081,6 +3081,7 @@ static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags) { if (flags & DC_AUTO) { switch (GetStationType(tile)) { + default: break; case STATION_RAIL: return_cmd_error(STR_ERROR_MUST_DEMOLISH_RAILROAD); case STATION_AIRPORT: return_cmd_error(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST); case STATION_TRUCK: return_cmd_error(HasTileRoadType(tile, ROADTYPE_TRAM) ? STR_ERROR_MUST_DEMOLISH_CARGO_TRAM_STATION_FIRST : STR_ERROR_MUST_DEMOLISH_TRUCK_STATION_FIRST); diff --git a/src/station_type.h b/src/station_type.h index feb5ad42c..6a65c30d7 100644 --- a/src/station_type.h +++ b/src/station_type.h @@ -26,7 +26,8 @@ enum StationType { STATION_BUS, STATION_OILRIG, STATION_DOCK, - STATION_BUOY + STATION_BUOY, + STATION_WAYPOINT, }; /** Types of RoadStops */ diff --git a/src/table/station_land.h b/src/table/station_land.h index 15790ac3c..0d5927c68 100644 --- a/src/table/station_land.h +++ b/src/table/station_land.h @@ -737,6 +737,18 @@ static const DrawTileSeqStruct _station_display_datas_0171[] = { TILE_SEQ_END() }; +static const DrawTileSeqStruct _station_display_datas_waypoint_X[] = { + TILE_SEQ_LINE( 0, 0, 0, 16, 5, 23, SPR_WAYPOINT_X_1 | (1 << PALETTE_MODIFIER_COLOUR)) + TILE_SEQ_LINE( 0, 11, 0, 16, 5, 23, SPR_WAYPOINT_X_2 | (1 << PALETTE_MODIFIER_COLOUR)) + TILE_SEQ_END() +}; + +static const DrawTileSeqStruct _station_display_datas_waypoint_Y[] = { + TILE_SEQ_LINE( 0, 0, 0, 5, 16, 23, SPR_WAYPOINT_Y_1 | (1 << PALETTE_MODIFIER_COLOUR)) + TILE_SEQ_LINE(11, 0, 0, 5, 16, 23, SPR_WAYPOINT_Y_2 | (1 << PALETTE_MODIFIER_COLOUR)) + TILE_SEQ_END() +}; + #undef TILE_SEQ_END #undef TILE_SEQ_LINE #undef TILE_SEQ_LINE_PAL @@ -941,6 +953,11 @@ static const DrawTileSprites _station_display_datas_buoy[] = { TILE_SPRITE_LINE(SPR_FLAT_WATER_TILE, _station_display_datas_82) }; +static const DrawTileSprites _station_display_datas_waypoint[] = { + TILE_SPRITE_LINE(SPR_RAIL_TRACK_X, _station_display_datas_waypoint_X) + TILE_SPRITE_LINE(SPR_RAIL_TRACK_Y, _station_display_datas_waypoint_Y) +}; + #undef TILE_SPRITE_LINE static const DrawTileSprites *_station_display_datas[] = { @@ -951,4 +968,5 @@ static const DrawTileSprites *_station_display_datas[] = { _station_display_datas_oilrig, _station_display_datas_dock, _station_display_datas_buoy, + _station_display_datas_waypoint, }; diff --git a/src/table/track_land.h b/src/table/track_land.h index 7c2a94e3c..10eed215e 100644 --- a/src/table/track_land.h +++ b/src/table/track_land.h @@ -1,6 +1,6 @@ /* $Id$ */ -/** @file track_land.h Sprites to use and how to display them for train depot/waypoint tiles. */ +/** @file track_land.h Sprites to use and how to display them for train depot tiles. */ #define TILE_SEQ_LINE(img, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 23, {img, PAL_NONE} }, #define TILE_SEQ_END() { (int8)0x80, 0, 0, 0, 0, 0, {0, 0} } @@ -42,23 +42,6 @@ static const DrawTileSprites _depot_invisible_gfx_table[] = { { {SPR_RAIL_TRACK_Y, PAL_NONE}, _depot_gfx_NW } }; -static const DrawTileSeqStruct _waypoint_gfx_X[] = { - TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_X_1, 0, 0, 16, 5) - TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_X_2, 0, 11, 16, 5) - TILE_SEQ_END() -}; - -static const DrawTileSeqStruct _waypoint_gfx_Y[] = { - TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_Y_1, 0, 0, 5, 16) - TILE_SEQ_LINE((1 << PALETTE_MODIFIER_COLOUR) | SPR_WAYPOINT_Y_2, 11, 0, 5, 16) - TILE_SEQ_END() -}; - -static const DrawTileSprites _waypoint_gfx_table[] = { - { {SPR_RAIL_TRACK_X, PAL_NONE}, _waypoint_gfx_X }, - { {SPR_RAIL_TRACK_Y, PAL_NONE}, _waypoint_gfx_Y } -}; - #undef TILE_SEQ_LINE #undef TILE_SEQ_END diff --git a/src/waypoint.cpp b/src/waypoint.cpp index e56fbca0d..d8605400a 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -43,7 +43,7 @@ void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype) y += 17; if (!DrawStationTile(x, y, railtype, AXIS_X, STAT_CLASS_WAYP, stat_id)) { - DrawDefaultWaypointSprite(x, y, railtype); + StationPickerDrawSprite(x, y, STATION_WAYPOINT, railtype, INVALID_ROADTYPE, AXIS_X); } } |