(svn r23151) -Change: [NewGRF v8] Deprecate callback 12, and use callback 36 instead.

This commit is contained in:
frosch 2011-11-08 17:28:05 +00:00
parent 8dcbd673cf
commit 7d4568361c
3 changed files with 12 additions and 3 deletions

View File

@ -1207,8 +1207,15 @@ static void LoadUnloadVehicle(Vehicle *front, int *cargo_left)
/* The default loadamount for mail is 1/4 of the load amount for passengers */
if (v->type == VEH_AIRCRAFT && !Aircraft::From(v)->IsNormalAircraft()) load_amount = CeilDiv(load_amount, 4);
if (_settings_game.order.gradual_loading && HasBit(e->info.callback_mask, CBM_VEHICLE_LOAD_AMOUNT)) {
uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
if (_settings_game.order.gradual_loading) {
uint16 cb_load_amount = CALLBACK_FAILED;
if (e->GetGRF() != NULL && e->GetGRF()->grf_version >= 8) {
/* Use callback 36 */
cb_load_amount = GetVehicleProperty(v, PROP_VEHICLE_LOAD_AMOUNT, CALLBACK_FAILED);
} else if (HasBit(e->info.callback_mask, CBM_VEHICLE_LOAD_AMOUNT)) {
/* Use callback 12 */
cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
}
if (cb_load_amount != CALLBACK_FAILED) {
if (e->GetGRF()->grf_version < 8) cb_load_amount = GB(cb_load_amount, 0, 8);
if (cb_load_amount >= 0x100) {

View File

@ -888,7 +888,7 @@ static ChangeInfoResult CommonVehicleChangeInfo(EngineInfo *ei, int prop, ByteRe
ei->climates = buf->ReadByte();
break;
case 0x07: // Loading speed
case PROP_VEHICLE_LOAD_AMOUNT: // 0x07 Loading speed
/* Amount of cargo loaded during a vehicle's "loading tick" */
ei->load_amount = buf->ReadByte();
break;

View File

@ -18,6 +18,8 @@
* @todo Currently the list only contains properties which are used more than once in the code. I.e. they are available for callback 0x36.
*/
enum PropertyID {
PROP_VEHICLE_LOAD_AMOUNT = 0x07, ///< Loading speed
PROP_TRAIN_SPEED = 0x09, ///< Max. speed: 1 unit = 1/1.6 mph = 1 km-ish/h
PROP_TRAIN_POWER = 0x0B, ///< Power in hp (if dualheaded: sum of both vehicles)
PROP_TRAIN_RUNNING_COST_FACTOR = 0x0D, ///< Yearly runningcost (if dualheaded: sum of both vehicles)