(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 b4337eba83
commit 46650c54b6
27 changed files with 190 additions and 294 deletions

View File

@@ -273,7 +273,7 @@ void GenerateTrees()
CommandCost CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
StringID msg = INVALID_STRING_ID;
CommandCost cost;
CommandCost cost(EXPENSES_OTHER);
int ex;
int ey;
int sx, sy, x, y;
@@ -282,8 +282,6 @@ CommandCost CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Check the tree type. It can be random or some valid value within the current climate */
if (p1 != (uint)-1 && p1 - _tree_base_by_landscape[_opt.landscape] >= _tree_count_by_landscape[_opt.landscape]) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_OTHER);
// make sure sx,sy are smaller than ex,ey
ex = TileX(tile);
ey = TileY(tile);
@@ -499,7 +497,7 @@ static CommandCost ClearTile_Trees(TileIndex tile, byte flags)
if (flags & DC_EXEC) DoClearSquare(tile);
return CommandCost(num * _price.remove_trees);
return CommandCost(EXPENSES_CONSTRUCTION, num * _price.remove_trees);
}
static void GetAcceptedCargo_Trees(TileIndex tile, AcceptedCargo ac)