(svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).

This commit is contained in:
rubidium
2008-01-09 16:55:48 +00:00
parent 98b4fa7c07
commit 0365c1f33b
27 changed files with 190 additions and 294 deletions

View File

@@ -148,7 +148,7 @@ static void TerraformAddDirtyTileAround(TerraformerState *ts, TileIndex tile)
*/
static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height)
{
CommandCost total_cost = CommandCost();
CommandCost total_cost(EXPENSES_CONSTRUCTION);
assert(tile < MapSize());
@@ -228,11 +228,9 @@ static CommandCost TerraformTileHeight(TerraformerState *ts, TileIndex tile, int
CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
TerraformerState ts;
CommandCost total_cost = CommandCost();
CommandCost total_cost(EXPENSES_CONSTRUCTION);
int direction = (p2 != 0 ? 1 : -1);
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
_terraform_err_tile = 0;
ts.modheight_count = ts.tile_table_count = 0;
@@ -358,12 +356,10 @@ CommandCost CmdLevelLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
uint h, oldh, curh;
CommandCost money;
CommandCost ret;
CommandCost cost;
CommandCost cost(EXPENSES_CONSTRUCTION);
if (p1 >= MapSize()) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
/* remember level height */
oldh = TileHeight(p1);