Changeset - r11015:e38b253d6aea
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2009-02-05 15:59:23
rubidium@openttd.org
(svn r15355) -Codechange: simplify some stuff now ->FirstShared returns non-NULL again.
1 file changed with 1 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_vehiclelist.cpp
Show inline comments
 
@@ -19,33 +19,28 @@ AIVehicleList::AIVehicleList()
 
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;
 
				}
 
			}
 
		}
 
	}
 
}
 

	
 
AIVehicleList_SharedOrders::AIVehicleList_SharedOrders(VehicleID vehicle_id)
 
{
 
	if (!AIVehicle::IsValidVehicle(vehicle_id)) return;
 

	
 
	Vehicle *v = GetVehicle(vehicle_id)->FirstShared();
 
	if (v == NULL) {
 
		this->AddItem(vehicle_id);
 
		return;
 
	}
 
	for (; v != NULL; v->NextShared()) {
 
	for (const Vehicle *v = GetVehicle(vehicle_id)->FirstShared(); v != NULL; v->NextShared()) {
 
		this->AddItem(v->index);
 
	}
 
}
0 comments (0 inline, 0 general)