diff options
Diffstat (limited to 'src/ai/api/ai_bridge.cpp')
-rw-r--r-- | src/ai/api/ai_bridge.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/ai/api/ai_bridge.cpp b/src/ai/api/ai_bridge.cpp index f342404cf..03c457d4c 100644 --- a/src/ai/api/ai_bridge.cpp +++ b/src/ai/api/ai_bridge.cpp @@ -10,10 +10,11 @@ #include "../../core/alloc_func.hpp" #include "../../economy_func.h" #include "../../settings_type.h" +#include "../../date_func.h" /* static */ bool AIBridge::IsValidBridge(BridgeID bridge_id) { - return bridge_id < MAX_BRIDGES; + return bridge_id < MAX_BRIDGES && ::GetBridgeSpec(bridge_id)->avail_year <= _cur_year; } /* static */ bool AIBridge::IsBridgeTile(TileIndex tile) @@ -159,13 +160,6 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance) return ::GetBridgeSpec(bridge_id)->min_length + 2; } -/* static */ int32 AIBridge::GetYearAvailable(BridgeID bridge_id) -{ - if (!IsValidBridge(bridge_id)) return -1; - - return ::GetBridgeSpec(bridge_id)->avail_year; -} - /* static */ TileIndex AIBridge::GetOtherBridgeEnd(TileIndex tile) { if (!::IsValidTile(tile)) return INVALID_TILE; |