A bid on a listed player can be taken back
transfer.submit {action: withdrawBid, listingId} removes the manager's bid
before the seller decides. The orders list of the transfer market does it
with its delete button.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ec8295c84
commit
83bd96c1ff
9 files changed
+77
-4
No files matched your search
@@ -40,6 +40,7 @@ describe deliberate changes; they are not a list of every known compatibility li
|
||||
- [src/modern/app/modern_session.cpp](../src/modern/app/modern_session.cpp): in Modern a new manager's assistant adapts the attitude to the score (as the computer clubs do) until the manager sets it himself; Classic starts at the most defensive attitude for whole matches.
|
||||
- [src/modern/game/career.cpp](../src/modern/game/career.cpp): retains an existing Modern club's league slot when a human joins, preserving its played results.
|
||||
- [src/modern/game/career.hpp](../src/modern/game/career.hpp): uses the supported player-generation ranges and excludes reserved calendar positions when assigning managers.
|
||||
- [src/modern/game/desk_actions.cpp](../src/modern/game/desk_actions.cpp): in Modern a manager can take back a bid he made on a listed player.
|
||||
- [src/modern/game/desk_actions.cpp](../src/modern/game/desk_actions.cpp): in Modern a manager can take a player he listed off the transfer list again.
|
||||
- [src/modern/game/desk_actions.cpp](../src/modern/game/desk_actions.cpp): uses the supported transfer-fee arithmetic and designated set-piece fields.
|
||||
- [src/modern/game/desk_actions.cpp](../src/modern/game/desk_actions.cpp): Modern training camps have grades up to six stars with a capped step, a higher limit and recovery extras.
|
||||
|
||||
@@ -88,6 +88,7 @@ Die UI ruft diese über `DataSource::read_almanac` und `read_statistics` direkt
|
||||
| `budget.commit` | `budgetId` (`budget:merchandise`, `budget:press`, `budget:fans`), `amount` (`Money`) | setzt ein Budget; Fehler `unknown_budget`, `invalid_amount`, `advertising_refused` (z. B. Lieferung läuft, zu wenig Geld) |
|
||||
| `ticket.commit` | `price` (`Money`, 8–25 €) | der Eintrittspreis; Fehler `invalid_amount`, `ticket_refused` |
|
||||
| `transfer.submit` | `action: list`, `playerId`, optional `loan`; oder `action: bid`, `listingId`, `fee`, `monthlySalary` (`Money`), `years` 1–4 (Leihe 1–2), optional `loan`, optional `bonuses` (sieben gespeicherte Stufen: zuerst 0–20, dann 0–200) | setzt einen eigenen Spieler auf die Liste (bzw. bietet ihn zum Verleih an) oder gibt über den Angebotseditor des Originals ein Gebot ab (öffnen, Felder setzen, abschicken). `outcome`: `applied` (sofort angenommen), `offer_pending` (Antwort mit der nächsten Woche), `offer_rejected` (zu niedrig/abgelehnt). Fragt die Engine einen menschlichen Verkäufer (Abwerben), wird zurückgerollt: `decision_pending` (noch nicht unterstützt). Abgelehnte Listung: `listing_refused`, vollständige Rücknahme. Geldfelder verlangen EUR/2 und ganze Euro ohne Überlauf. Fehler `unknown_player`, `already_listed`, `unknown_listing`, `own_player`, `no_bid_slot`, `transfer_refused` |
|
||||
| `transfer.submit` (Zusatz) | `action: "withdrawBid"`, `listingId` | zieht das eigene Gebot auf einen gelisteten Spieler zurück, bevor der Verkäufer entscheidet (neu in Modern). Spätere Gebote rücken auf; keine Zufallszahl. Fehler: `unknown_listing`, `no_bid` |
|
||||
| `transfer.submit` (Zusatz) | `action: "withdraw"`, `playerId` | nimmt einen eigenen Spieler wieder von der Transferliste (neu in Modern). Der Listenplatz endet wie ohne Käufer: Gebote verfallen, der Platz wird frei; keine Zufallszahl. Fehler: `unknown_player`, `not_listed`, `bid_waiting` (ein Mitspieler hat geboten) |
|
||||
| `friendly.book` | `opponentId`, optional `home`, `date`, `acceptCost`, bei menschlichem Gegner `opponentConsent` | am Schreibtisch des Bundestrainers das Länderspiel (Rückmeldung mit Bonus, wenn das Original ihn gewährt); vereinbart das Freundschaftsspiel; Fehler `declined` (Kosten nicht bestätigt), `opponent_declined`, `insufficient_funds`, `date_unavailable`, `plan_full` u. a. |
|
||||
| `fixture.reschedule` | `matchId`, `date`; oder `action: undo`, `date` | verlegt eine eigene Ligapartie bzw. nimmt die Verlegung zurück; Fehler `invalid_day`, `day_full`, `team_clash`, `no_free_slot`, `no_moved_match` |
|
||||
|
||||
@@ -10710,6 +10710,14 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
if (!listed_result) { restore(); return refuse("transfer_refused", error); }
|
||||
if(listed_result->status!=TransferActionStatus::accepted) {restore();return refuse("listing_refused","Der Spieler konnte nicht auf die Transferliste gesetzt werden.");}
|
||||
feedback = loan ? "Der Spieler wird zum Verleih angeboten." : "Der Spieler steht auf der Transferliste.";
|
||||
} else if (action == "withdrawBid") {
|
||||
// {action: "withdrawBid", listingId}: the manager takes back his bid before the seller decides
|
||||
int entry = -1;
|
||||
if (std::sscanf(ui_text(*payload, "listingId").c_str(), "listing:%d", &entry) != 1) return refuse("unknown_listing", "listingId fehlt.");
|
||||
if (transfer_offer_editor_) return refuse("decision_pending", "Bitte das offene Angebot zuerst abschließen.");
|
||||
if (modern::withdraw_manager_bid(g_, manager, entry).status != TransferActionStatus::accepted)
|
||||
return refuse("no_bid", "Auf diesen Spieler liegt kein eigenes Gebot vor.");
|
||||
feedback = "Das Gebot ist zurückgezogen.";
|
||||
} else if (action == "withdraw") {
|
||||
// {action: "withdraw", playerId}: a listed player of the manager's club leaves the list again
|
||||
const std::string id = ui_text(*payload, "playerId");
|
||||
@@ -10903,7 +10911,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return refuse("invalid_payload", "action ist list, withdraw, bid, poach, poachOffer oder poachCancel.");
|
||||
return refuse("invalid_payload", "action ist list, withdraw, withdrawBid, bid, poach, poachOffer oder poachCancel.");
|
||||
}
|
||||
} catch (const std::exception& ex) {
|
||||
restore();
|
||||
|
||||
@@ -575,6 +575,37 @@ TransferActionResult withdraw_manager_player(ModernState& g, int manager, int pl
|
||||
return out;
|
||||
}
|
||||
|
||||
// OpenBMH deviates from the original: in Modern a manager can take back a bid he made on a listed player.
|
||||
TransferActionResult withdraw_manager_bid(ModernState& g, int manager, int list_entry) {
|
||||
TransferActionResult out;
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size()) {
|
||||
out.status = TransferActionStatus::invalid_manager;
|
||||
return out;
|
||||
}
|
||||
out.status = TransferActionStatus::invalid_request;
|
||||
const int team = g.manager_teams[size_t(manager)];
|
||||
const uint32_t row = ::bmh::layout::EditorList + uint32_t(list_entry) * 0x58;
|
||||
if (team < 0 || team >= league_clubs() || list_entry < 0 || list_entry >= 40 || !g.memory.has(row + 0x57) ||
|
||||
(g.squad_slots.at(modern::transfer_list_slot() + size_t(list_entry)) & 0xfff) == 0xfff) return out;
|
||||
StaticMemory& mem = g.memory;
|
||||
uint32_t bid = 0;
|
||||
while (bid < 4 && mem.u16(row + bid * 2) != uint16_t(team)) ++bid;
|
||||
if (bid == 4) return out;
|
||||
// the bids behind it move up: club, salary, fee, term and the seven bonuses
|
||||
for (uint32_t k = bid; k < 3; ++k) {
|
||||
mem.set16(row + k * 2, mem.u16(row + (k + 1) * 2));
|
||||
mem.set32(row + 0xc + k * 4, mem.u32(row + 0xc + (k + 1) * 4));
|
||||
mem.set32(row + 0x1c + k * 4, mem.u32(row + 0x1c + (k + 1) * 4));
|
||||
mem.set8(row + 0x34 + k, mem.u8(row + 0x34 + k + 1));
|
||||
for (uint32_t b = 0; b < 7; ++b) mem.set8(row + 0x38 + k * 7 + b, mem.u8(row + 0x38 + (k + 1) * 7 + b));
|
||||
}
|
||||
mem.set16(row + 3 * 2, 0xffff);
|
||||
out.status = TransferActionStatus::accepted;
|
||||
out.player = g.squad_slots.at(modern::transfer_list_slot() + size_t(list_entry)) & 0xfff;
|
||||
out.list_entry = list_entry;
|
||||
return out;
|
||||
}
|
||||
|
||||
TransferActionResult list_manager_player(ModernState& g, int manager, int squad_row, WatcomRandom& rand,
|
||||
MinuteReport& report) {
|
||||
TransferActionResult out;
|
||||
|
||||
@@ -134,6 +134,11 @@ TransferActionResult submit_transfer_bid_source_human_buyer(ModernState& g,
|
||||
// manager's club; rejected while another human manager's bid waits on the entry.
|
||||
TransferActionResult withdraw_manager_player(ModernState& g, int manager, int player);
|
||||
|
||||
// A Modern rule: the manager takes back his club's bid on list entry 0-39 before the seller
|
||||
// decides. The later bids of the entry move up, as when a bidding club drops out. Draws no
|
||||
// random number. accepted, or invalid_request when his club has no bid there.
|
||||
TransferActionResult withdraw_manager_bid(ModernState& g, int manager, int list_entry);
|
||||
|
||||
// Put one of the manager's squad rows on the list. The request consumes the original
|
||||
// listing-price RNG and returns the new stable entry index through the result.
|
||||
TransferActionResult list_manager_player(ModernState& g, int manager, int squad_row,
|
||||
|
||||
@@ -172,7 +172,9 @@ Json engine_transfer_command(const Json &b, const Json &draft,
|
||||
const auto kind = draft.at("kind").get<std::string>(),
|
||||
player = draft.at("player").get<std::string>();
|
||||
Json payload;
|
||||
if (kind == "withdraw") {
|
||||
if (kind == "withdrawBid") {
|
||||
payload = {{"action", "withdrawBid"}, {"listingId", draft.at("listing")}};
|
||||
} else if (kind == "withdraw") {
|
||||
const auto it =
|
||||
std::find_if(d.at("squad").begin(), d.at("squad").end(),
|
||||
[&](const auto &p) { return p.at("playerId") == player; });
|
||||
|
||||
@@ -469,6 +469,17 @@ bool App::engine_transfer_action(const std::string &action,
|
||||
close_transfer();
|
||||
return true;
|
||||
}
|
||||
if (action == "transfer-order-delete" && target) {
|
||||
// an order of the list is the manager's bid on a listed player: it can be taken back
|
||||
const int index = target->GetAttribute<int>("data-index", -1);
|
||||
const auto &orders = engine_transfer_value_.at("orders");
|
||||
if (index < 0 || size_t(index) >= orders.size()) return true;
|
||||
const Json draft = {{"kind", "withdrawBid"}, {"player", orders[size_t(index)].at("player")}, {"listing", orders[size_t(index)].at("listing")}};
|
||||
transfer_dialog_.clear(); // the question lies under the list otherwise
|
||||
confirmation("Das Gebot für " + orders[size_t(index)].at("name").get<std::string>() + " zurückziehen?", [send, draft] { send(draft); });
|
||||
popup_accept_ = "Zurückziehen";
|
||||
return true;
|
||||
}
|
||||
if (action == "transfer-orders") {
|
||||
transfer_dialog_ = "orders";
|
||||
transfer_return_focus_ = target->GetId();
|
||||
|
||||
@@ -552,8 +552,7 @@ std::string App::render_transfer_dialog() {
|
||||
const auto &o = rows[i];
|
||||
body += "<div class=\"pg-tr\">" + pg_td("<strong>" + esc(o.at("name").get<std::string>()) + "</strong>", 0) + pg_td(esc(engine_mode_ ? "Gebot" : o.at("poached") == true ? "Abwerben" : kinds.at(o.at("kind"))), 110) +
|
||||
pg_td(esc(transfer_money(o.at("fee").get<int64_t>())), 170, "r") + pg_td(std::to_string(o.at("months").get<int>()) + " Monate", 120, "r") +
|
||||
pg_td(btn("transfer-order-delete", "×", "pg-btn round tm-small", "id=\"transfer-order-delete-" + std::to_string(i) + "\" data-index=\"" + std::to_string(i) + "\" aria-label=\"Auftrag zurücknehmen\" " +
|
||||
std::string(engine_mode_ ? "disabled title=\"Noch nicht angebunden\"" : "")), 60, "r", true) + "</div>";
|
||||
pg_td(btn("transfer-order-delete", "×", "pg-btn round tm-small", "id=\"transfer-order-delete-" + std::to_string(i) + "\" data-index=\"" + std::to_string(i) + "\" aria-label=\"Auftrag zurücknehmen\""), 60, "r", true) + "</div>";
|
||||
}
|
||||
body += "</div></div></div>";
|
||||
}
|
||||
|
||||
@@ -415,6 +415,21 @@ int main(int argc, char** argv) {
|
||||
std::printf("(bid on %s: %s)\n", listing.c_str(), cli::dump_json(bid).substr(0, 260).c_str());
|
||||
check((s(at(bid, "messageType")) == "command_result" && rev == b2 + 1) ||
|
||||
(s(at(bid, "messageType")) == "error" && rev == b2), "bid answered or refused cleanly");
|
||||
// a bid that waits for the seller can be taken back, once
|
||||
const auto own_bid = [&] {
|
||||
const J now = session.ui_read(O{{"kind", "transfer"}}, rev);
|
||||
const auto* rows = at(at(now, "data"), "listings").array();
|
||||
if (rows) for (const auto& row : *rows) if (s(at(row, "id")) == listing) return at(row, "ownBid").object() != nullptr;
|
||||
return false;
|
||||
};
|
||||
if (own_bid()) {
|
||||
const uint64_t b3 = rev;
|
||||
const J back = session.ui_command(cmd("request:t10b", "transfer.submit", O{{"action", "withdrawBid"}, {"listingId", listing}}), rev);
|
||||
check(s(at(back, "messageType")) == "command_result" && rev == b3 + 1 && !own_bid(), "the waiting bid is taken back");
|
||||
std::printf("(bid withdrawn)\n");
|
||||
}
|
||||
check(s(at(session.ui_command(cmd("request:t10c", "transfer.submit", O{{"action", "withdrawBid"}, {"listingId", listing}}), rev), "code")) == "no_bid",
|
||||
"no bid to take back");
|
||||
}
|
||||
check(s(at(session.ui_command(cmd("request:t11", "transfer.submit", O{{"action", "bid"}, {"listingId", "listing:999"}}), rev), "code")) ==
|
||||
"unknown_listing", "unknown listing refused");
|
||||
|
||||
Reference in new issue
Block a user