]> git.pond.sub.org Git - empserver/commit
buy set trade: Fix taking lots off the market
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 10 May 2018 08:28:49 +0000 (10:28 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 5 Jan 2021 06:25:18 +0000 (07:25 +0100)
commit6bcd72e24177e7158357f8255c1579c5e02d627f
tree8c0e8436a78560270fa2b601b971be6501a78b10
parent5f0ddfd95053689c6c9b8e555f48fffdb2ad787b
buy set trade: Fix taking lots off the market

To find out whether a lot is in use, some places check for zero
trd_owner, others for negative trd_unitid.  The former is reliable,
the latter is not: set() fails to change trd_unitid when it takes a
lot off the market.  The next trade-related command then runs
check_trade(), which logs "Something weird" and cleans up the mess.
Broken in commit e16e38dfabc (v4.2.18).

Replace the unreliable checks by reliable ones.

Clean up set() not to implictly rely on unused lots having negative
trd_unitid.

The trd_unitid = -1 are unnecessary now, so drop them.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/buy.c
src/lib/commands/set.c
src/lib/commands/trad.c