A listed player can be taken off the market again

transfer.submit {action: withdraw, playerId} ends the manager's own list
entry as it ends without a buyer. The transfer market's first button does
it for a listed player.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-17 14:02:17 +01:00
1 parent ce8b871202
commit 1ec8295c84
9 files changed
+85 -4

No files matched your search

+17
View File
@@ -381,6 +381,23 @@ int main(int argc, char** argv) {
const J listed = session.ui_command(cmd("request:t9", "transfer.submit", O{{"action", "list"}, {"playerId", seller}}), rev);
if (s(at(listed, "messageType")) != "command_result") std::fprintf(stderr, "list: %s\n", cli::dump_json(listed).c_str());
check(s(at(listed, "messageType")) == "command_result" && rev == before + 1, "own player listed");
// a second player goes on the list and is taken off the market again
const std::string second = s(at((*squad)[squad->size() - 2], "playerId"));
const auto listed_now = [&](const std::string& id) {
const J now = session.ui_read(O{{"kind", "transfer"}}, rev);
const auto* rows = at(at(now, "data"), "squad").array();
if (rows) for (const auto& row : *rows) if (s(at(row, "playerId")) == id) return truth(at(row, "listed"));
return false;
};
check(s(at(session.ui_command(cmd("request:t9b", "transfer.submit", O{{"action", "withdraw"}, {"playerId", second}}), rev), "code")) == "not_listed",
"a player who is not listed cannot be withdrawn");
session.ui_command(cmd("request:t9c", "transfer.submit", O{{"action", "list"}, {"playerId", second}}), rev);
check(listed_now(second), "second player listed");
const uint64_t listed_rev = rev;
const J withdrawn = session.ui_command(cmd("request:t9d", "transfer.submit", O{{"action", "withdraw"}, {"playerId", second}}), rev);
if (s(at(withdrawn, "messageType")) != "command_result") std::fprintf(stderr, "withdraw: %s\n", cli::dump_json(withdrawn).c_str());
check(s(at(withdrawn, "messageType")) == "command_result" && rev == listed_rev + 1 && !listed_now(second) && listed_now(seller),
"the player is off the market, the other listing stays");
}
std::string listing;
J fee, salary;