(svn r23147) -Change: [NewGRF v8] Unify the return values of boolean callbacks, and check the results for validity.
This commit is contained in:
@@ -741,7 +741,7 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, int
|
||||
if (HasBit(spec->callback_mask, CBM_OBJ_AUTOSLOPE)) {
|
||||
/* If the callback fails, allow autoslope. */
|
||||
uint16 res = GetObjectCallback(CBID_OBJECT_AUTOSLOPE, 0, 0, spec, Object::GetByTile(tile), tile);
|
||||
if ((res == 0) || (res == CALLBACK_FAILED)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
||||
if (res == CALLBACK_FAILED || !ConvertBooleanCallback(spec->grf_prop.grffile, CBID_OBJECT_AUTOSLOPE, res)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
||||
} else if (spec->enabled) {
|
||||
/* allow autoslope */
|
||||
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
|
||||
|
Reference in New Issue
Block a user