diff --git a/docs/release/1.0.10/RELEASE_NOTES.md b/docs/release/1.0.10/RELEASE_NOTES.md index d5f9072..c10498d 100644 --- a/docs/release/1.0.10/RELEASE_NOTES.md +++ b/docs/release/1.0.10/RELEASE_NOTES.md @@ -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 diff --git a/src/app/career_session.cpp b/src/app/career_session.cpp index 9716204..866314d 100644 --- a/src/app/career_session.cpp +++ b/src/app/career_session.cpp @@ -4440,9 +4440,21 @@ std::optional 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 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) diff --git a/src/app/controller.cpp b/src/app/controller.cpp index 1bd4340..0c088d9 100644 --- a/src/app/controller.cpp +++ b/src/app/controller.cpp @@ -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(); diff --git a/src/formats/executable_layout.hpp b/src/formats/executable_layout.hpp index cb02f9f..492443b 100644 --- a/src/formats/executable_layout.hpp +++ b/src/formats/executable_layout.hpp @@ -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; diff --git a/src/ui/transfer_market.cpp b/src/ui/transfer_market.cpp index a9f1d19..e63984c 100644 --- a/src/ui/transfer_market.cpp +++ b/src/ui/transfer_market.cpp @@ -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 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); diff --git a/src/ui/transfer_market_tests.cpp b/src/ui/transfer_market_tests.cpp index 79f050b..ee5f740 100644 --- a/src/ui/transfer_market_tests.cpp +++ b/src/ui/transfer_market_tests.cpp @@ -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"); diff --git a/tests/app_controller_tests.cpp b/tests/app_controller_tests.cpp index 6cbc973..00ed707 100644 --- a/tests/app_controller_tests.cpp +++ b/tests/app_controller_tests.cpp @@ -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(sell_again.submenu_action) && + std::get(sell_again.submenu_action).kind == TransferMarketRequestKind::review_offers && + std::get(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)