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. --- command.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'command.c') diff --git a/command.c b/command.c index 09b803b84..6c0e0d7c9 100644 --- a/command.c +++ b/command.c @@ -356,8 +356,8 @@ int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc) } } - // execute the command here. - _yearly_expenses_type = 0; + /* Execute the command here. All cost-relevant functions set the expenses type + * themselves with "SET_EXPENSES_TYPE(...);" at the beginning of the function */ res = proc(x, y, flags, p1, p2); if ((uint32)res >> 16 == 0x8000) { if (res & 0xFFFF) _error_message = res & 0xFFFF; @@ -470,8 +470,9 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, // update last build coordinate of player. if ( tile != 0 && _current_player < MAX_PLAYERS) DEREF_PLAYER(_current_player)->last_build_coordinate = tile; - // actually try and execute the command. - _yearly_expenses_type = 0; + /* Actually try and execute the command. If no cost-type is given + * use the construction one */ + _yearly_expenses_type = EXPENSES_CONSTRUCTION; res2 = proc(x,y, flags|DC_EXEC, p1, p2); // If notest is on, it means the result of the test can be different than -- cgit v1.2.3-54-g00ecf