Windcatcher
09-13-2005, 07:59 AM
I've verified this in 0.5.5, and the code in 0.5.8 is the same. It also looks like it will rear its head in 0.6.1, though I haven't tried it.
- Player 1 hands a copper piece to player 2
- Player 2 clicks accept
- Player 1 clicks accept
Player 1 has the money deducted, but player 2 never receives it. The problem has to do with who accepts the trade first. When player 2 accepts first, the trade isn't completed until player 1 also accepts. The server code calls FinishTrade() for player 1 first, since it is his acceptance that caused the trade to finally complete. The problem is that FinishTrade() calls trade->Reset() before it completes, which zeroes out the coin amounts. Therefore, when the server gets around to calling FinishTrade() for player 2, the coin amounts have been zeroed, and player 2 never gets the money.
Basically, the person who first accepts the trade can never receive money in the trade. The solution, as I see it, is that trade->Reset() should be called separately from FinishTrade(), once for each player, after all calls to FinishTrade() have completed.
- Player 1 hands a copper piece to player 2
- Player 2 clicks accept
- Player 1 clicks accept
Player 1 has the money deducted, but player 2 never receives it. The problem has to do with who accepts the trade first. When player 2 accepts first, the trade isn't completed until player 1 also accepts. The server code calls FinishTrade() for player 1 first, since it is his acceptance that caused the trade to finally complete. The problem is that FinishTrade() calls trade->Reset() before it completes, which zeroes out the coin amounts. Therefore, when the server gets around to calling FinishTrade() for player 2, the coin amounts have been zeroed, and player 2 never gets the money.
Basically, the person who first accepts the trade can never receive money in the trade. The solution, as I see it, is that trade->Reset() should be called separately from FinishTrade(), once for each player, after all calls to FinishTrade() have completed.