From 6edb21231e264cd52dc98a2a765330cac4b7cdf4 Mon Sep 17 00:00:00 2001 From: darkvater Date: Tue, 4 Jan 2005 17:11:03 +0000 Subject: (svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky. --- rail_cmd.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'rail_cmd.c') diff --git a/rail_cmd.c b/rail_cmd.c index 3896ecf16..bc71e40c4 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -542,6 +542,8 @@ int32 CmdBuildRailroadTrack(int x, int y, uint32 flags, uint32 p1, uint32 p2) int32 ret, total_cost = 0; int railbit; + SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); + if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TILE_FROM_XY(x,y)); @@ -592,6 +594,8 @@ int32 CmdRemoveRailroadTrack(int x, int y, uint32 flags, uint32 p1, uint32 p2) int32 ret, total_cost = 0; int railbit; + SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); + if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TILE_FROM_XY(x,y)); @@ -820,6 +824,7 @@ static int32 RemoveTrainWaypoint(uint tile, uint32 flags, bool justremove) int32 CmdRemoveTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2) { uint tile = TILE_FROM_XY(x,y); + SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); return RemoveTrainWaypoint(tile, flags, true); } @@ -975,6 +980,8 @@ int32 CmdBuildManySignals(int x, int y, uint32 flags, uint32 p1, uint32 p2) byte signals = (p2 >> 8)&0xFF; mode = p2 & 0x1; // build/remove signals + SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); + /* unpack end tile */ ex = GET_TILE_X(p1)*16; ey = GET_TILE_Y(p1)*16; @@ -1134,6 +1141,8 @@ int32 CmdConvertRail(int ex, int ey, uint32 flags, uint32 p1, uint32 p2) int32 ret, cost, money; int sx,sy,x,y; + SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); + // make sure sx,sy are smaller than ex,ey sx = GET_TILE_X(p1)*16; sy = GET_TILE_Y(p1)*16; -- cgit v1.2.3-54-g00ecf