From bef11941c6acd42429e45dbad50722dd857cb4ee Mon Sep 17 00:00:00 2001 From: Koen Bussemaker Date: Mon, 4 Mar 2024 21:56:53 +0100 Subject: [PATCH] Change: Allow rail and road depot overbuilding in current orientation in order to connect to rail or road --- regression/regression/result.txt | 16 ++++++++-------- src/rail_cmd.cpp | 2 +- src/road_cmd.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/regression/regression/result.txt b/regression/regression/result.txt index 8eedd0d71e..8abbcb7e48 100644 --- a/regression/regression/result.txt +++ b/regression/regression/result.txt @@ -7510,7 +7510,7 @@ ERROR: IsEnd() is invalid as Begin() is never called BuildRailDepot(): false BuildRailDepot(): true BuildRailDepot(): true - BuildRailDepot(): false + BuildRailDepot(): true GetRailDepotFrontTile(): 33412 IsBuildable(): false DepotList @@ -7604,12 +7604,12 @@ ERROR: IsEnd() is invalid as Begin() is never called BuildRoadDepot(): false BuildRoadDepot(): true BuildRoadDepot(): true - BuildRoadDepot(): false + BuildRoadDepot(): true HasRoadType(Road): true HasRoadType(Tram): false - GetLastError(): 259 - GetLastErrorString(): ERR_ALREADY_BUILT - GetErrorCategory(): 1 + GetLastError(): 0 + GetLastErrorString(): ERR_NONE + GetErrorCategory(): 0 IsRoadTile(): false GetRoadDepotFrontTile(): 33412 IsRoadDepotTile(): true @@ -9471,7 +9471,7 @@ ERROR: IsEnd() is invalid as Begin() is never called IsStoppedInDepot(): false --Accounting-- GetCosts(): -5947 - Should be: -5946 + Should be: -5947 GetName(): Road Vehicle #1 SetName(): true GetName(): MyVehicleName @@ -9485,7 +9485,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetAgeLeft(): 5489 GetCurrentSpeed(): 7 GetRunningCost(): 421 - GetProfitThisYear(): -1 + GetProfitThisYear(): 0 GetProfitLastYear(): 0 GetCurrentValue(): 5947 GetVehicleType(): 1 @@ -9604,7 +9604,7 @@ ERROR: IsEnd() is invalid as Begin() is never called 16 => 0 14 => 0 13 => 0 - 12 => -1 + 12 => 0 ProfitLastYear ListDump: 17 => 0 16 => 0 diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 918bfe1421..0429661eda 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -989,7 +989,7 @@ CommandCost CmdBuildTrainDepot(DoCommandFlag flags, TileIndex tile, RailType rai CommandCost ret = CheckTileOwnership(tile); if (ret.Failed()) return ret; - if (dir == GetRailDepotDirection(tile)) return_cmd_error(STR_ERROR_ALREADY_BUILT); + if (dir == GetRailDepotDirection(tile)) return CommandCost(); ret = EnsureNoVehicleOnGround(tile); if (ret.Failed()) return ret; diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index e575f1e0db..eee9e24efb 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1167,7 +1167,7 @@ CommandCost CmdBuildRoadDepot(DoCommandFlag flags, TileIndex tile, RoadType rt, CommandCost ret = CheckTileOwnership(tile); if (ret.Failed()) return ret; - if (dir == GetRoadDepotDirection(tile)) return_cmd_error(STR_ERROR_ALREADY_BUILT); + if (dir == GetRoadDepotDirection(tile)) return CommandCost(); ret = EnsureNoVehicleOnGround(tile); if (ret.Failed()) return ret;