summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-09 16:55:48 +0000
committerrubidium <rubidium@openttd.org>2008-01-09 16:55:48 +0000
commit0365c1f33ba130bcfc663309b806fe65d730381f (patch)
treea0181571819fca45c3cc170c7ce718009cb12535 /src/industry_cmd.cpp
parent98b4fa7c070f2433539f2c399129c24fba842632 (diff)
downloadopenttd-0365c1f33ba130bcfc663309b806fe65d730381f.tar.xz
(svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 7f4fd40b9..5a8e9b1c9 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -400,7 +400,7 @@ static CommandCost ClearTile_Industry(TileIndex tile, byte flags)
}
if (flags & DC_EXEC) delete i;
- return CommandCost(indspec->GetRemovalCost());
+ return CommandCost(EXPENSES_CONSTRUCTION, indspec->GetRemovalCost());
}
static void TransportIndustryGoods(TileIndex tile)
@@ -1590,8 +1590,6 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
const IndustrySpec *indspec;
- SET_EXPENSES_TYPE(EXPENSES_OTHER);
-
indspec = GetIndustrySpec(p1);
/* Check if the to-be built/founded industry is available for this climate. */
@@ -1646,7 +1644,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (CreateNewIndustryHelper(tile, p1, flags, indspec, num) == NULL) return CMD_ERROR;
}
- return CommandCost(indspec->GetConstructionCost());
+ return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
}
@@ -2263,10 +2261,10 @@ static CommandCost TerraformTile_Industry(TileIndex tile, uint32 flags, uint z_n
if (HasBit(itspec->callback_flags, CBM_INDT_AUTOSLOPE)) {
/* If the callback fails, allow autoslope. */
uint16 res = GetIndustryTileCallback(CBID_INDUSTRY_AUTOSLOPE, 0, 0, gfx, GetIndustryByTile(tile), tile);
- if ((res == 0) || (res == CALLBACK_FAILED)) return _price.terraform;
+ if ((res == 0) || (res == CALLBACK_FAILED)) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
} else {
/* allow autoslope */
- return _price.terraform;
+ return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
}
}
}