summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_bridgelist.cpp
blob: 9fd6728c249e23fea4aa185ffdda6bb14fd40ffe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* $Id$ */

/** @file ai_bridgelist.cpp Implementation of AIBridgeList and friends. */

#include "ai_bridgelist.hpp"
#include "ai_bridge.hpp"
#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);
}