summaryrefslogtreecommitdiff
path: root/src/cargotype.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cargotype.h')
-rw-r--r--src/cargotype.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cargotype.h b/src/cargotype.h
index ae38dcb25..fee461d7f 100644
--- a/src/cargotype.h
+++ b/src/cargotype.h
@@ -163,13 +163,13 @@ static inline bool IsCargoInClass(CargoID c, CargoClass cc)
* @param var Reference getting the cargospec.
* @see CargoSpec
*/
-#define FOR_ALL_SORTED_CARGOSPECS(var) for (uint8 index = 0; var = _sorted_cargo_specs[index], index < _sorted_cargo_specs_size; index++)
+#define FOR_ALL_SORTED_CARGOSPECS(var) for (uint8 index = 0; index < _sorted_cargo_specs_size && (var = _sorted_cargo_specs[index], true) ; index++)
/**
* Loop header for iterating over 'real' cargoes, sorted by name. Phony cargoes like regearing cargoes are skipped.
* @param var Reference getting the cargospec.
* @see CargoSpec
*/
-#define FOR_ALL_SORTED_STANDARD_CARGOSPECS(var) for (uint8 index = 0; var = _sorted_cargo_specs[index], index < _sorted_standard_cargo_specs_size; index++)
+#define FOR_ALL_SORTED_STANDARD_CARGOSPECS(var) for (uint8 index = 0; index < _sorted_standard_cargo_specs_size && (var = _sorted_cargo_specs[index], true); index++)
#endif /* CARGOTYPE_H */