summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-15 05:55:59 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commitddabfed1cd3efa9ee229214207a60fc7cb3e0641 (patch)
tree824eddd3155d04363864731a43a6863cd7fbd2a3 /src/script
parent3a14cea068d130e11b5d9dde11d4451dd7dec453 (diff)
downloadopenttd-ddabfed1cd3efa9ee229214207a60fc7cb3e0641.tar.xz
Codechange: Replace station related FOR_ALL with range-based for loops
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_depotlist.cpp3
-rw-r--r--src/script/api/script_stationlist.cpp3
-rw-r--r--src/script/api/script_town.cpp3
-rw-r--r--src/script/api/script_waypointlist.cpp3
4 files changed, 4 insertions, 8 deletions
diff --git a/src/script/api/script_depotlist.cpp b/src/script/api/script_depotlist.cpp
index be0071473..ab2e09cfd 100644
--- a/src/script/api/script_depotlist.cpp
+++ b/src/script/api/script_depotlist.cpp
@@ -26,8 +26,7 @@ ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type)
case ScriptTile::TRANSPORT_AIR: {
/* Hangars are not seen as real depots by the depot code. */
- const Station *st;
- FOR_ALL_STATIONS(st) {
+ for (const Station *st : Station::Iterate()) {
if (st->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) {
for (uint i = 0; i < st->airport.GetNumHangars(); i++) {
this->AddItem(st->airport.GetHangarTile(i));
diff --git a/src/script/api/script_stationlist.cpp b/src/script/api/script_stationlist.cpp
index 9c2a56da9..9b9e67e7a 100644
--- a/src/script/api/script_stationlist.cpp
+++ b/src/script/api/script_stationlist.cpp
@@ -18,8 +18,7 @@
ScriptStationList::ScriptStationList(ScriptStation::StationType station_type)
{
- Station *st;
- FOR_ALL_STATIONS(st) {
+ for (Station *st : Station::Iterate()) {
if ((st->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY) && (st->facilities & station_type) != 0) this->AddItem(st->index);
}
}
diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp
index fb5589707..1cb6e32bb 100644
--- a/src/script/api/script_town.cpp
+++ b/src/script/api/script_town.cpp
@@ -346,8 +346,7 @@
}
int num = 0;
- const Station *st;
- FOR_ALL_STATIONS(st) {
+ for (const Station *st : Station::Iterate()) {
if (st->town == t && (st->facilities & FACIL_AIRPORT) && st->airport.type != AT_OILRIG) num++;
}
return max(0, 2 - num);
diff --git a/src/script/api/script_waypointlist.cpp b/src/script/api/script_waypointlist.cpp
index 12f5f6bf1..1c0a804d1 100644
--- a/src/script/api/script_waypointlist.cpp
+++ b/src/script/api/script_waypointlist.cpp
@@ -17,8 +17,7 @@
ScriptWaypointList::ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_type)
{
- const Waypoint *wp;
- FOR_ALL_WAYPOINTS(wp) {
+ for (const Waypoint *wp : Waypoint::Iterate()) {
if ((wp->facilities & waypoint_type) &&
(wp->owner == ScriptObject::GetCompany() || ScriptObject::GetCompany() == OWNER_DEITY || wp->owner == OWNER_NONE)) this->AddItem(wp->index);
}