summaryrefslogtreecommitdiff
path: root/src/cargotype.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cargotype.cpp')
-rw-r--r--src/cargotype.cpp11
1 files changed, 11 insertions, 0 deletions
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;
+}