src/cargotype.cpp
changeset 6143 dbca54e64e01
parent 6123 04eb770ec17e
child 6148 5247b66aad19
equal deleted inserted replaced
6142:80f876e7bb9f 6143:dbca54e64e01
    73 
    73 
    74 bool CargoSpec::IsValid() const
    74 bool CargoSpec::IsValid() const
    75 {
    75 {
    76 	return bitnum != INVALID_CARGO;
    76 	return bitnum != INVALID_CARGO;
    77 }
    77 }
       
    78 
       
    79 
       
    80 CargoID GetCargoIDByLabel(CargoLabel cl)
       
    81 {
       
    82 	for (CargoID c = 0; c < lengthof(_cargo); c++) {
       
    83 		if (_cargo[c].label == cl) return c;
       
    84 	}
       
    85 
       
    86 	/* No matching label was found, so it is invalid */
       
    87 	return CT_INVALID;
       
    88 }