summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes E. Krause <j.k@eclipso.de>2019-03-24 18:03:18 +0100
committerPeterN <peter@fuzzle.org>2019-03-27 10:44:21 +0000
commit1a4c7a4e545e275a60be1617e55d7ea4f65264f9 (patch)
treeb2aec39157f2cc4d7b89bac4aa30e8d68218c4e5
parent49f7332b758f0fdcc70c2798a91fc1f0a4010971 (diff)
downloadopenttd-1a4c7a4e545e275a60be1617e55d7ea4f65264f9.tar.xz
Cleanup: use switch for industry cargo vars
-rw-r--r--src/newgrf_industries.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 980059cab..19664fa6d 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -312,12 +312,14 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile);
int index = this->industry->GetCargoProducedIndex(cargo);
if (index < 0) return 0; // invalid cargo
- if (variable == 0x69) return this->industry->produced_cargo_waiting[index];
- if (variable == 0x6A) return this->industry->this_month_production[index];
- if (variable == 0x6B) return this->industry->this_month_transported[index];
- if (variable == 0x6C) return this->industry->last_month_production[index];
- if (variable == 0x6D) return this->industry->last_month_transported[index];
- NOT_REACHED();
+ switch (variable) {
+ case 0x69: return this->industry->produced_cargo_waiting[index];
+ case 0x6A: return this->industry->this_month_production[index];
+ case 0x6B: return this->industry->this_month_transported[index];
+ case 0x6C: return this->industry->last_month_production[index];
+ case 0x6D: return this->industry->last_month_transported[index];
+ default: NOT_REACHED();
+ }
}