diff src/terraform_cmd.cpp @ 8230:5b61305fcdd4 draft

(svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
author rubidium <rubidium@openttd.org>
date Wed, 09 Jan 2008 16:55:48 +0000
parents 2191f47ab047
children 2495310e220f
line wrap: on
line diff
--- a/src/terraform_cmd.cpp
+++ b/src/terraform_cmd.cpp
@@ -148,7 +148,7 @@
  */
 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 @@
 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 @@
 	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);