diff options
-rw-r--r-- | bin/ai/regression/regression.nut | 4 | ||||
-rw-r--r-- | src/ai/api/ai_marine.cpp | 6 | ||||
-rw-r--r-- | src/ai/api/ai_marine.hpp | 5 | ||||
-rw-r--r-- | src/ai/api/ai_marine.hpp.sq | 2 |
4 files changed, 10 insertions, 7 deletions
diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut index e93e9252f..1c4b00311 100644 --- a/bin/ai/regression/regression.nut +++ b/bin/ai/regression/regression.nut @@ -778,7 +778,7 @@ function Regression::Marine() print(" IsCanalTile(): " + AIMarine.IsCanalTile(32116)); print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF)); - print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, false)); + print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, 28478)); print(" BuildDock(): " + AIMarine.BuildDock(29253, AIStation.STATION_JOIN_ADJACENT)); print(" BuildBuoy(): " + AIMarine.BuildBuoy(28481)); print(" BuildLock(): " + AIMarine.BuildLock(28487)); @@ -804,7 +804,7 @@ function Regression::Marine() print(" IsCanalTile(): " + AIMarine.IsCanalTile(32127)); print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF)); - print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, false)); + print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, 28480)); print(" BuildDock(): " + AIMarine.BuildDock(29253, AIStation.STATION_JOIN_ADJACENT)); } diff --git a/src/ai/api/ai_marine.cpp b/src/ai/api/ai_marine.cpp index f80c510e5..fb9bba882 100644 --- a/src/ai/api/ai_marine.cpp +++ b/src/ai/api/ai_marine.cpp @@ -64,11 +64,13 @@ return gtts1 != TRACK_BIT_NONE; } -/* static */ bool AIMarine::BuildWaterDepot(TileIndex tile, bool vertical) +/* static */ bool AIMarine::BuildWaterDepot(TileIndex tile, TileIndex front) { EnforcePrecondition(false, ::IsValidTile(tile)); + EnforcePrecondition(false, ::IsValidTile(front)); + EnforcePrecondition(false, (::TileX(front) == ::TileX(tile)) != (::TileY(front) == ::TileY(tile))); - return AIObject::DoCommand(tile, vertical, 0, CMD_BUILD_SHIP_DEPOT); + return AIObject::DoCommand(tile, ::TileY(front) == ::TileY(tile), 0, CMD_BUILD_SHIP_DEPOT); } /* static */ bool AIMarine::BuildDock(TileIndex tile, StationID station_id) diff --git a/src/ai/api/ai_marine.hpp b/src/ai/api/ai_marine.hpp index 0ff066018..6b8223392 100644 --- a/src/ai/api/ai_marine.hpp +++ b/src/ai/api/ai_marine.hpp @@ -82,15 +82,16 @@ public: /** * Builds a water depot on tile. * @param tile The tile where the water depot will be build. - * @param vertical If true, depot will be vertical, else horizontal. + * @param front A tile on the same axis with 'tile' as the depot shall be oriented * @pre AIMap::IsValidTile(tile). + * @pre AIMap::IsValidTile(front). * @exception AIError::ERR_AREA_NOT_CLEAR * @exception AIError::ERR_SITE_UNSUITABLE * @exception AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER * @return Whether the water depot has been/can be build or not. * @note A WaterDepot is 1 tile in width, and 2 tiles in length. */ - static bool BuildWaterDepot(TileIndex tile, bool vertical); + static bool BuildWaterDepot(TileIndex tile, TileIndex front); /** * Builds a dock where tile is the tile still on land. diff --git a/src/ai/api/ai_marine.hpp.sq b/src/ai/api/ai_marine.hpp.sq index 42c641b2a..884e27139 100644 --- a/src/ai/api/ai_marine.hpp.sq +++ b/src/ai/api/ai_marine.hpp.sq @@ -34,7 +34,7 @@ void SQAIMarine_Register(Squirrel *engine) { SQAIMarine.DefSQStaticMethod(engine, &AIMarine::IsLockTile, "IsLockTile", 2, "?i"); SQAIMarine.DefSQStaticMethod(engine, &AIMarine::IsCanalTile, "IsCanalTile", 2, "?i"); SQAIMarine.DefSQStaticMethod(engine, &AIMarine::AreWaterTilesConnected, "AreWaterTilesConnected", 3, "?ii"); - SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildWaterDepot, "BuildWaterDepot", 3, "?ib"); + SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildWaterDepot, "BuildWaterDepot", 3, "?ii"); SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildDock, "BuildDock", 3, "?ii"); SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildBuoy, "BuildBuoy", 2, "?i"); SQAIMarine.DefSQStaticMethod(engine, &AIMarine::BuildLock, "BuildLock", 2, "?i"); |