Ask whether to take a listed player off the market when selling him

VERKAUFEN on a player who stands on the transfer list only showed a message
when no offer had arrived yet. The original first asks whether the player
should be taken off the transfer market: yes frees the list slot (the player
stays in the squad), no continues to the offers. Controller and UI tests cover
both answers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-11-08 12:57:27 +01:00
1 parent adcaa9b569
commit 6aa7c4f4a2
8 files changed
+66 -10

No files matched your search

+4
View File
@@ -24,6 +24,10 @@ separate in [OpenBMH-Extended](https://github.com/Weyoune/OpenBMH-extended).
dialog, which refused the whole offer. Both exist now. A refused offer or
transfer action also shows its reason (and writes it to the debug log)
instead of a dead button.
- **Verkaufen on a listed player.** Clicking a player who is already on the transfer
list and then VERKAUFEN did nothing when no offer had arrived yet. It now asks
the question of the original, "Wollen Sie ... vom Transfermarkt holen?": yes takes
the player off the list (he stays in the squad), no leads on to the offers.
- **Pressed buttons.** Suchen, Vorschlag, Abwerben and the other buttons of
the market are drawn pressed while the mouse button is held.
- **Scouting message.** Confirming the search dialog first shows the message
+13 -1
View File
@@ -4440,9 +4440,21 @@ std::optional<TransferActionResult> CareerSession::dispatch_transfer_market(
TransferActionResult result;
if (request.kind == ui::TransferMarketRequestKind::review_offers) {
const auto view = project_transfer_offer_list(next_state, request.bid.list_entry);
const int selected = view.offer_count ? review(next_state, view) : -1;
result.player = view.player; result.list_entry = view.list_entry;
result.status = TransferActionStatus::pending;
// VERKAUFEN on a listed player: "Wollen Sie <name> vom Transfermarkt holen?". Yes frees the list
// slot (the player stays in the squad), no goes on to the offers.
bool withdrawn = false;
if (request.ask_withdraw && hooks.confirm) {
const std::string question = message_text(next_state, ::bmh::layout::TransferMarket_WithdrawQuestion_TextPointer) +
next_state.player_name(view.player) +
message_text(next_state, ::bmh::layout::TransferMarket_WithdrawQuestion_TextPointer2);
if (hooks.confirm(next_state, request.manager_slot, question)) {
next_state.squad_slots.at(0xb70u + size_t(view.list_entry)) = 0xfff;
withdrawn = true;
}
}
const int selected = !withdrawn && view.offer_count ? review(next_state, view) : -1;
if (selected != -1) {
auto allocator = TransferAllocatorContext::unsupported;
if (turn_driver_.transfer_allocator_context == PendingOfferAllocatorGate::zero)
+2 -1
View File
@@ -605,7 +605,8 @@ void serve_transfer_action(ui::StartupFlow& flow, CareerSession& session,
notice = applied.action.status == TransferActionStatus::accepted
? "Das Angebot wurde angenommen."
: applied.action.status == TransferActionStatus::pending
? "Spieler bleibt auf der Transferliste."
? (applied.changed ? "Spieler wurde von der Transferliste genommen."
: "Spieler bleibt auf der Transferliste.")
: "Angebot abgelehnt; Transferliste unverändert.";
}
if (!applied.changed && source_finished) flow.acknowledge_unchanged_transfer_market();
+2
View File
@@ -1417,6 +1417,8 @@ inline constexpr auto Month_SearchProfileNews_TextPointer = 0xaedd8;
inline constexpr auto Month_SearchProfileNews_TextPointer2 = 0xaf254;
inline constexpr auto Month_SearchProfileNews_TextPointer3 = 0xaf258; // ending of the message box after "Suchen"
inline constexpr auto Month_SearchProfileNews_TextPointer4 = 0xaf25c; // "Ihre Scouting-Abteilung ...": shown first when the dialog is confirmed
inline constexpr auto TransferMarket_WithdrawQuestion_TextPointer = 0xaf2a4; // "Wollen Sie " (+ player name)
inline constexpr auto TransferMarket_WithdrawQuestion_TextPointer2 = 0xaf2a8; // " vom Transfermarkt holen?"
inline constexpr auto NationalFriendlyPayerPrefixText = 0xa000f;
inline constexpr auto NextDeskManager = 0xbd6cc;
inline constexpr auto NoClubText = 0xaec74;
+7 -4
View File
@@ -343,7 +343,8 @@ std::string transfer_market_request_json(const TransferMarketRequest& r) {
out << "],\"search_profile\":[";
for (size_t i = 0; i < r.search_profile.size(); ++i) { if (i) out << ','; out << unsigned(r.search_profile[i]); }
out << "],\"search_cancelled\":" << (r.search_cancelled ? "true" : "false")
<< ",\"search_apply\":" << (r.search_apply ? "true" : "false");
<< ",\"search_apply\":" << (r.search_apply ? "true" : "false")
<< ",\"ask_withdraw\":" << (r.ask_withdraw ? "true" : "false");
out << ",\"selected_players\":[";
for(size_t n=0;n<r.selected_players.size();++n){if(n)out<<',';const auto& p=r.selected_players[n];out<<"{\"list_entry\":"<<p.list_entry<<",\"source_slot\":"<<p.source_slot<<",\"player\":"<<p.player<<",\"seller\":"<<p.seller<<",\"squad_row\":"<<p.squad_row<<'}';}
out << "]}";
@@ -650,7 +651,7 @@ TransferMarketRequest TransferMarketScreen::make_listing(bool loan) {
if (item.already_listed) {
const auto listing = std::find_if(state_.items.begin(), state_.items.end(),
[&](const auto& row) { return row.player == item.player && row.own_listing; });
if (listing != state_.items.end()) return make_review(*listing);
if (listing != state_.items.end()) return make_review(*listing, true);
feedback_ = "Spieler steht bereits auf der Liste"; return {};
}
TransferMarketRequest request;
@@ -689,11 +690,13 @@ TransferMarketRequest TransferMarketScreen::make_preview(bool purchase) {
pending_=request;preview_.reset();return request;
}
// Creates a request to review the bids on one of the player's own listings; refuses if there are none.
TransferMarketRequest TransferMarketScreen::make_review(const TransferMarketItem& item) {
TransferMarketRequest TransferMarketScreen::make_review(const TransferMarketItem& item, bool ask_withdraw) {
if (pending_) return {};
if (item.offers == 0) { feedback_ = "Noch keine Angebote für diesen Spieler."; return {}; }
// Without offers there is nothing to review; VERKAUFEN still has to ask whether the player leaves the list.
if (item.offers == 0 && !ask_withdraw) { feedback_ = "Noch keine Angebote für diesen Spieler."; return {}; }
TransferMarketRequest request;
request.kind = TransferMarketRequestKind::review_offers;
request.ask_withdraw = ask_withdraw;
request.manager_slot = state_.manager_slot; request.runtime_club = state_.runtime_club;
request.revision = state_.revision; request.bid.manager = state_.manager_slot;
request.bid.list_entry = item.list_entry; request.bid.player = item.player;
+4 -1
View File
@@ -96,6 +96,9 @@ struct TransferMarketRequest {
// (the profile is kept but switched off), `search_apply` = closed with the "Suchen" button (list the matches).
SearchProfile search_profile{};
bool search_cancelled = false, search_apply = false;
// review_offers started by VERKAUFEN on an already listed own player: the original first asks
// "Wollen Sie <name> vom Transfermarkt holen?" (yes = off the list, no = look at the offers).
bool ask_withdraw = false;
};
std::string transfer_market_request_json(const TransferMarketRequest&);
@@ -175,7 +178,7 @@ private:
TransferMarketRequest close_search(bool cancelled);
void draw_text(Image&, int x, int y, std::string_view, uint8_t color) const;
void commit_numeric_field();
TransferMarketRequest make_review(const TransferMarketItem&);
TransferMarketRequest make_review(const TransferMarketItem&, bool ask_withdraw = false);
TransferMarketRequest make_bid();
TransferMarketRequest make_listing(bool loan=false);
TransferMarketRequest make_open_offer(bool loan=false);
+4 -3
View File
@@ -94,9 +94,10 @@ int main(int argc,char** argv){
review.acknowledge_unchanged();
listed.items[0].offers=0;TransferMarketScreen waiting(argv[1],listed);
auto hover_waiting=waiting.click(20,32);waiting.acknowledge_preview(listed,quote(hover_waiting));
check(waiting.key("V").kind==TransferMarketRequestKind::none&&
waiting.state_json().find("Noch keine Angebote")!=std::string::npos,
"an own listing without incoming offers gives visible feedback");
const auto withdraw=waiting.key("V");
check(withdraw.kind==TransferMarketRequestKind::review_offers&&withdraw.ask_withdraw&&withdraw.bid.list_entry==4&&
transfer_market_request_json(withdraw).find("\"ask_withdraw\":true")!=std::string::npos,
"selling a listed own player without offers still asks whether he leaves the list");
auto expired=fixture();expired.squad_slots[2932]=0x0fff;
check(!transfer_market_from_game(expired,5).squad[0].already_listed,
"cleared rejected/expired pool entry immediately makes the player listable again");
+30
View File
@@ -516,6 +516,36 @@ void check_transfer_market_controller(const std::filesystem::path& data) {
for (int e = 0; e < 40; ++e) listed_again |= (game.squad_slots.at(0xb70 + size_t(e)) & 0xfff) ==
(game.squad_slots.at(squad_range(before.runtime_club).first + size_t(row2)) & 0xfff);
check(listed_again, "the declined player stands on the transfer list again");
// VERKAUFEN on a listed player asks "Wollen Sie ... vom Transfermarkt holen?"; no keeps the listing, yes takes him off
const auto player_id = game.squad_slots.at(squad_range(before.runtime_club).first + size_t(row2)) & 0xfff;
const auto on_list = [&] {
for (int e = 0; e < 40; ++e) if ((game.squad_slots.at(0xb70 + size_t(e)) & 0xfff) == player_id) return true;
return false;
};
std::string asked;
bool answer = false;
relist_hooks.confirm = [&](const GameState&, int, const std::string& text) { asked = text; return answer; };
for (const bool yes : {false, true}) {
answer = yes; asked.clear();
auto selected = FlowResult{};
auto sell_again = flow.click(200, 207); // after a "no" the player is still selected
if (sell_again.request != FlowRequest::submenu_action) {
selected = flow.click(20, y2);
if (selected.request == FlowRequest::submenu_action) check(serve_relist(selected).empty(), "the listed player's preview is served");
sell_again = flow.click(200, 207);
}
check(sell_again.request == FlowRequest::submenu_action && std::holds_alternative<TransferMarketRequest>(sell_again.submenu_action) &&
std::get<TransferMarketRequest>(sell_again.submenu_action).kind == TransferMarketRequestKind::review_offers &&
std::get<TransferMarketRequest>(sell_again.submenu_action).ask_withdraw,
"selling a listed player starts the withdraw question even without offers");
const app::TransferOfferPresenter no_bid = [](const GameState&, const TransferOfferListView&) { return -1; };
check(app::serve_flow_request(flow, sell_again, session, data, data, 0x1789abcd, revision, playback, audio_session, false,
{}, no_bid, {}, {}, {}, {}, {}, {}, {}, app::PendingOfferEntryPolicy::legacy_unpresented, relist_hooks,
app::HumanBuyerMarketEntryPolicy::normal_interactive).empty(), "the withdraw question is served");
check(!asked.empty(), "the question 'vom Transfermarkt holen' was asked");
check(on_list() == !yes, yes ? "answering yes takes the player off the transfer list" : "answering no keeps the player on the list");
}
}
{ // the search dialog behind the buttons Suchen and Vorschlag (Source sub_19409)