From a23b4594edfa0e8e0322dafc0ed22a418a165295 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sat, 24 Feb 2007 19:36:47 +0000 Subject: (svn r8886) -Codechange: (NewGRF) Add (partial) cargo translation table support, applied to action 3s only. --- src/cargotype.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/cargotype.cpp') diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 5593b82bf..63253847b 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -75,3 +75,14 @@ bool CargoSpec::IsValid() const { return bitnum != INVALID_CARGO; } + + +CargoID GetCargoIDByLabel(CargoLabel cl) +{ + for (CargoID c = 0; c < lengthof(_cargo); c++) { + if (_cargo[c].label == cl) return c; + } + + /* No matching label was found, so it is invalid */ + return CT_INVALID; +} -- cgit v1.2.3-54-g00ecf