summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_bridgelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai/api/ai_bridgelist.cpp')
-rw-r--r--src/ai/api/ai_bridgelist.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ai/api/ai_bridgelist.cpp b/src/ai/api/ai_bridgelist.cpp
new file mode 100644
index 000000000..4f2fb2719
--- /dev/null
+++ b/src/ai/api/ai_bridgelist.cpp
@@ -0,0 +1,25 @@
+/* $Id$ */
+
+/** @file ai_bridgelist.cpp Implementation of AIBridgeList and friends. */
+
+#include "ai_bridgelist.hpp"
+#include "ai_bridge.hpp"
+#include "../../openttd.h"
+#include "../../bridge.h"
+#include "../../date_func.h"
+
+AIBridgeList::AIBridgeList()
+{
+ /* Add all bridges, no matter if they are available or not */
+ for (byte j = 0; j < MAX_BRIDGES; j++)
+ if (::GetBridgeSpec(j)->avail_year <= _cur_year)
+ this->AddItem(j);
+}
+
+AIBridgeList_Length::AIBridgeList_Length(uint length)
+{
+ for (byte j = 0; j < MAX_BRIDGES; j++)
+ if (::GetBridgeSpec(j)->avail_year <= _cur_year)
+ if (length >= (uint)AIBridge::GetMinLength(j) && length <= (uint)AIBridge::GetMaxLength(j))
+ this->AddItem(j);
+}