From 49220cc6f1e3570dc1b9001c40af2a8a4e35b649 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 18 Jun 2007 19:53:50 +0000 Subject: (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified. --- src/unmovable_cmd.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/unmovable_cmd.cpp') 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) -- cgit v1.2.3-54-g00ecf