summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2019-12-16 18:51:20 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-12-21 20:13:03 +0100
commit00c2a98cf395d6e2a85290048e7be7a7f6ce0d04 (patch)
tree78cc73b1290a8076f3a1b7d6bbfad9aef1acba8d /src/script/api
parent4ae829cb272225c7e07e233a94c2d945077f432a (diff)
downloadopenttd-00c2a98cf395d6e2a85290048e7be7a7f6ce0d04.tar.xz
Codechange: Replace FOR_ALL_INDUSTRIES with range-based for loops
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/script_industrylist.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/script/api/script_industrylist.cpp b/src/script/api/script_industrylist.cpp
index 464d6a0bb..de28f418d 100644
--- a/src/script/api/script_industrylist.cpp
+++ b/src/script/api/script_industrylist.cpp
@@ -15,17 +15,14 @@
ScriptIndustryList::ScriptIndustryList()
{
- Industry *i;
- FOR_ALL_INDUSTRIES(i) {
+ for (const Industry *i : Industry::Iterate()) {
this->AddItem(i->index);
}
}
ScriptIndustryList_CargoAccepting::ScriptIndustryList_CargoAccepting(CargoID cargo_id)
{
- const Industry *i;
-
- FOR_ALL_INDUSTRIES(i) {
+ for (const Industry *i : Industry::Iterate()) {
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
if (i->accepts_cargo[j] == cargo_id) this->AddItem(i->index);
}
@@ -34,9 +31,7 @@ ScriptIndustryList_CargoAccepting::ScriptIndustryList_CargoAccepting(CargoID car
ScriptIndustryList_CargoProducing::ScriptIndustryList_CargoProducing(CargoID cargo_id)
{
- const Industry *i;
-
- FOR_ALL_INDUSTRIES(i) {
+ for (const Industry *i : Industry::Iterate()) {
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == cargo_id) this->AddItem(i->index);
}