summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 60396da7a..ea29e2479 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -56,6 +56,7 @@
#include "linkgraph/refresh.h"
#include "widgets/station_widget.h"
#include "tunnelbridge_map.h"
+#include "road_cmd.h"
#include "table/strings.h"
@@ -949,13 +950,13 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
* @param rt Road type to build.
* @return The cost in case of success, or an error code if it failed.
*/
-static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags, bool is_drive_through, bool is_truck_stop, Axis axis, StationID *station, RoadType rt)
+static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags, uint invalid_dirs, bool is_drive_through, bool is_truck_stop, Axis axis, StationID *station, RoadType rt)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
int allowed_z = -2;
for (TileIndex cur_tile : tile_area) {
- CommandCost ret = CheckBuildableTile(cur_tile, 0, allowed_z, true);
+ CommandCost ret = CheckBuildableTile(cur_tile, invalid_dirs, allowed_z, true);
if (ret.Failed()) return ret;
cost.AddCost(ret);
@@ -1878,7 +1879,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
/* Total road stop cost. */
CommandCost cost(EXPENSES_CONSTRUCTION, roadstop_area.w * roadstop_area.h * _price[type ? PR_BUILD_STATION_TRUCK : PR_BUILD_STATION_BUS]);
StationID est = INVALID_STATION;
- ret = CheckFlatLandRoadStop(roadstop_area, flags, is_drive_through, type, axis, &est, rt);
+ ret = CheckFlatLandRoadStop(roadstop_area, flags, is_drive_through ? 0 : 1 << ddir, is_drive_through, type, axis, &est, rt);
if (ret.Failed()) return ret;
cost.AddCost(ret);
@@ -2990,10 +2991,10 @@ static void DrawTile_Station(TileInfo *ti)
}
OffsetGroundSprite(31, 1);
- ti->z += ApplyPixelFoundationToSlope(FOUNDATION_LEVELED, &ti->tileh);
+ ti->z += ApplyPixelFoundationToSlope(FOUNDATION_NONE, &ti->tileh); //FOUNDATION_LEVELED, &ti->tileh);
} else {
draw_default_foundation:
- DrawFoundation(ti, FOUNDATION_LEVELED);
+ DrawFoundation(ti, FOUNDATION_NONE); //FOUNDATION_LEVELED);
}
}
@@ -3048,22 +3049,31 @@ draw_default_foundation:
DrawGroundSprite(overlay + overlay_offset, PALETTE_CRASH);
}
} else {
- image += HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? ground_relocation : total_offset;
if (HasBit(pal, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
pal += ground_relocation;
- } else if (ti->tileh != SLOPE_FLAT && IsRailStation(ti->tile)) {
+ } else if (ti->tileh != SLOPE_FLAT && (IsRailStation(ti->tile) || IsRoadStop(ti->tile))) {
/* It's a sloped rail station? */
Foundation rf = FOUNDATION_NONE;
- /* sloped rail station */
- TrackBits track = AxisToTrackBits(GetRailStationAxis(ti->tile));
- rf = GetRailFoundation(ti->tileh, track);
- DrawFoundation(ti, rf);
- if (rf != FOUNDATION_LEVELED) {
- image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y;
- } else {
- (image = rti->base_sprites.track_y, track == TRACK_BIT_Y ) || (image++, track == TRACK_BIT_X);
- }
- }
+ if (IsRoadStop(ti->tile)) {
+ /* Roadstops without foundation on a slope
+ * and on Slopes with one corner raised */
+ rf = GetRoadFoundation(ti->tileh, AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(ti->tile))));
+ DrawFoundation(ti, rf);
+ /* Draws the sloped road */
+ if (ti->tileh != SLOPE_FLAT) image = _road_sloped_sprites[ti->tileh - 1] + 0x53F;
+ } else {
+ /* sloped rail station */
+ TrackBits track = AxisToTrackBits(GetRailStationAxis(ti->tile));
+ rf = GetRailFoundation(ti->tileh, track);
+ DrawFoundation(ti, rf);
+ if (rf != FOUNDATION_LEVELED) {
+ image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y;
+ } else {
+ (image = rti->base_sprites.track_y, track == TRACK_BIT_Y ) || (image++, track == TRACK_BIT_X);
+ }
+ }
+ } else
+ image += HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? ground_relocation : total_offset;
DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette));
/* PBS debugging, draw reserved tracks darker */