Files @ r10999:950d41f6cb97
Branch filter:

Location: cpp/openttd-patchpack/source/src/ai/api/ai_vehiclelist.cpp

translators
(svn r15339) -Update: WebTranslator2 update to 2009-02-04 18:39:16
arabic_egypt - 1 fixed by khaloofah (1)
german - 1 changed by planetmaker (1)
hebrew - 668 fixed, 19 changed by 19izhar73 (687)
korean - 10 changed by leejaeuk5 (10)
serbian - 6 fixed, 4 changed by salejemaster (10)
/* $Id$ */

/** @file ai_vehiclelist.cpp Implementation of AIVehicleList and friends. */

#include "ai_vehiclelist.hpp"
#include "ai_station.hpp"
#include "../../company_func.h"
#include "../../vehicle_base.h"

AIVehicleList::AIVehicleList()
{
	Vehicle *v;
	FOR_ALL_VEHICLES(v) {
		if (v->owner == _current_company && v->IsPrimaryVehicle()) this->AddItem(v->index);
	}
}

AIVehicleList_Station::AIVehicleList_Station(StationID station_id)
{
	if (!AIStation::IsValidStation(station_id)) return;

	Vehicle *v;

	FOR_ALL_VEHICLES(v) {
		if (v->owner == _current_company && v->IsPrimaryVehicle()) {
			const Order *order;

			FOR_VEHICLE_ORDERS(v, order) {
				if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == station_id) {
					this->AddItem(v->index);
					break;
				}
			}
		}
	}
}