diff options
Diffstat (limited to 'src')
-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 |
3 files changed, 8 insertions, 5 deletions
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"); |