summaryrefslogtreecommitdiff
path: root/src/unmovable_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-18 19:53:50 +0000
committerrubidium <rubidium@openttd.org>2007-06-18 19:53:50 +0000
commit773a7c9cb64856bd2bca11f9c38eea049b353e4e (patch)
tree62843984493ffedb69f91d7b85cb631ecb61ff3e /src/unmovable_cmd.cpp
parentbcdb89906b06a64c368e89d2f267cd617b2210c1 (diff)
downloadopenttd-773a7c9cb64856bd2bca11f9c38eea049b353e4e.tar.xz
(svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
Diffstat (limited to 'src/unmovable_cmd.cpp')
-rw-r--r--src/unmovable_cmd.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 97a558caa..c1921e9a0 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -49,7 +49,7 @@ static CommandCost DestroyCompanyHQ(PlayerID pid, uint32 flags)
}
/* cost of relocating company is 1% of company value */
- return CalculateCompanyValue(p) / 100;
+ return CommandCost((int32)(CalculateCompanyValue(p) / 100));
}
void UpdateCompanyHQ(Player *p, uint score)
@@ -85,16 +85,14 @@ CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
{
Player *p = GetPlayer(_current_player);
CommandCost cost;
- CommandCost ret;
SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
- ret = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
- if (CmdFailed(ret)) return ret;
- cost = ret;
+ cost = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
+ if (CmdFailed(cost)) return cost;
if (p->location_of_house != 0) { // Moving HQ
- cost += DestroyCompanyHQ(_current_player, flags);
+ cost.AddCost(DestroyCompanyHQ(_current_player, flags));
}
if (flags & DC_EXEC) {
@@ -244,7 +242,7 @@ static CommandCost ClearTile_Unmovable(TileIndex tile, byte flags)
DoClearSquare(tile);
}
- return 0;
+ return CommandCost();
}
static void GetAcceptedCargo_Unmovable(TileIndex tile, AcceptedCargo ac)