author | truebrain |
Sat, 23 Feb 2008 15:16:21 +0000 | |
branch | noai |
changeset 9745 | fb2454d70f37 |
parent 9740 | a98f20bce404 |
child 9746 | e4ab7ea8d897 |
permissions | -rw-r--r-- |
9614
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
1 |
#include "ai_vehiclelist.hpp" |
9740
a98f20bce404
(svn r12220) [NoAI] -Fix: minor type in AIVehicleStation, and missing security check
truebrain
parents:
9724
diff
changeset
|
2 |
#include "ai_station.hpp" |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
3 |
#include "../../player_func.h" |
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
4 |
#include "../../station.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9647
diff
changeset
|
5 |
#include "../../vehicle_base.h" |
9614
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
6 |
|
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
7 |
AIVehicleList::AIVehicleList() |
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
8 |
{ |
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
9 |
Vehicle *v; |
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
10 |
FOR_ALL_VEHICLES(v) { |
9633 | 11 |
if (v->owner == _current_player && v->IsPrimaryVehicle()) this->AddItem(v->index); |
9614
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
12 |
} |
814c3bbf8ecc
(svn r9781) [NoAI] -Add: added AIVehicleListProfit[This|Last]Year as valuator
truelight
parents:
diff
changeset
|
13 |
} |
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
14 |
|
9745
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9740
diff
changeset
|
15 |
AIVehicleList_Station::AIVehicleList_Station(StationID station_id) |
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
16 |
{ |
9745
fb2454d70f37
(svn r12225) [NoAI] -Change [API CHANGE]: AIStationVehicleList -> AIVehicleList_Station (WATCH THE NAMES CAREFULLY!)
truebrain
parents:
9740
diff
changeset
|
17 |
this->Clear(); |
9740
a98f20bce404
(svn r12220) [NoAI] -Fix: minor type in AIVehicleStation, and missing security check
truebrain
parents:
9724
diff
changeset
|
18 |
if (!AIStation::IsValidStation(station_id)) return; |
a98f20bce404
(svn r12220) [NoAI] -Fix: minor type in AIVehicleStation, and missing security check
truebrain
parents:
9724
diff
changeset
|
19 |
|
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
20 |
Vehicle *v; |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
21 |
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
22 |
FOR_ALL_VEHICLES(v) { |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
23 |
if (v->owner == _current_player && v->IsPrimaryVehicle()) { |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
24 |
const Order *order; |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
25 |
|
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
26 |
FOR_VEHICLE_ORDERS(v, order) { |
9740
a98f20bce404
(svn r12220) [NoAI] -Fix: minor type in AIVehicleStation, and missing security check
truebrain
parents:
9724
diff
changeset
|
27 |
if (order->type == OT_GOTO_STATION && order->dest == station_id) { |
9647
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
28 |
this->AddItem(v->index); |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
29 |
break; |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
30 |
} |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
31 |
} |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
32 |
} |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
33 |
} |
c17046b1b8a2
(svn r10540) [NoAI] -Add: added AIStationVehicleList, which lists all vehicles that go to a given station
truelight
parents:
9633
diff
changeset
|
34 |
} |