summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-04-29 17:51:05 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-04-29 21:08:24 +0200
commit9a8756d7ed6fdde20bad9be8c8b8bc8fda0170f9 (patch)
tree54941350dff9cc05ee0e9b32e116df385f977a46 /src/newgrf.cpp
parent14e92bd8e241998ced263ee542965a71bbdd77a5 (diff)
downloadopenttd-9a8756d7ed6fdde20bad9be8c8b8bc8fda0170f9.tar.xz
Codechange: Replace FOR_ALL_CARGOSPECS with range-based for loops
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 46bd5a655..19cc436dd 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -5332,8 +5332,7 @@ static CargoID TranslateCargo(uint8 feature, uint8 ctype)
return CT_INVALID;
}
- const CargoSpec *cs;
- FOR_ALL_CARGOSPECS(cs) {
+ for (const CargoSpec *cs : CargoSpec::Iterate()) {
if (cs->bitnum == ctype) {
grfmsg(6, "TranslateCargo: Cargo bitnum %d mapped to cargo type %d.", ctype, cs->Index());
return cs->Index();
@@ -8811,8 +8810,7 @@ static void CalculateRefitMasks()
if (_gted[engine].cargo_allowed != 0) {
/* Build up the list of cargo types from the set cargo classes. */
- const CargoSpec *cs;
- FOR_ALL_CARGOSPECS(cs) {
+ for (const CargoSpec *cs : CargoSpec::Iterate()) {
if (_gted[engine].cargo_allowed & cs->classes) SetBit(mask, cs->Index());
if (_gted[engine].cargo_disallowed & cs->classes) SetBit(not_mask, cs->Index());
}