src/newgrf_cargo.cpp
branchgamebalance
changeset 9908 0fa543611bbe
parent 9907 3b068c3a1c74
child 7153 85b73fcc076b
equal deleted inserted replaced
9907:3b068c3a1c74 9908:0fa543611bbe
    92 	group = Resolve(cs->group, &object);
    92 	group = Resolve(cs->group, &object);
    93 	if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
    93 	if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
    94 
    94 
    95 	return group->g.callback.result;
    95 	return group->g.callback.result;
    96 }
    96 }
       
    97 
       
    98 
       
    99 CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile)
       
   100 {
       
   101 	/* Pre-version 7 uses the 'climate dependent' ID, i.e. cargo is the cargo ID */
       
   102 	if (grffile->grf_version < 7) return HASBIT(_cargo_mask, cargo) ? cargo : (CargoID) CT_INVALID;
       
   103 
       
   104 	/* If the GRF contains a translation table (and the cargo is in bounds)
       
   105 	 * then get the cargo ID for the label */
       
   106 	if (cargo < grffile->cargo_max) return GetCargoIDByLabel(grffile->cargo_list[cargo]);
       
   107 
       
   108 	/* Else the cargo value is a 'climate independent' 'bitnum' */
       
   109 	return GetCargoIDByBitnum(cargo);
       
   110 }