Transfer market review fixes: pressed buttons, scouting message, poaching agreement notice, visible refusal reasons
- The notice dialog refused Source notices it did not know, which silently refused the whole action: the agreement of a
poached player ("Ihr erstes Angebot wird angenommen!") made the Angebot button of the Abwerben dialog fail, and the new
search boxes never appeared. Both text families are known now; the test turns every notice of the transfer routes into
its dialog like the graphical client does.
- Suchen/Vorschlag/Abwerben and the other market buttons are drawn pressed while the mouse button is held.
- Confirming the search dialog first reports "Ihre Scouting-Abteilung ..." (text 0xAF25C) as in the original, then the matches.
- A refused transfer or offer action shows its reason, writes it to stderr and the debug log.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
65df52ae2c
commit
fbb2ab66b0
8 files changed
+82
-12
No files matched your search
+15
-4
@@ -555,6 +555,12 @@ void serve_transfer_action(ui::StartupFlow& flow, CareerSession& session,
|
||||
const auto result = session.dispatch_search_profile(request.manager_slot, request.search_profile,
|
||||
request.search_cancelled, request.search_apply, revision, error);
|
||||
if (!result) return false;
|
||||
// Confirming ("Suchen") first reports that the scouting department looks (Source sub_19409 sub_57ECA with
|
||||
// text 0xAF25C), then one box per listing that fits (sub_190B5).
|
||||
if (presenters.notice && request.search_apply)
|
||||
presenters.notice(session.state(), HumanBuyerSaleNotice{request.manager_slot, -1, -1,
|
||||
::bmh::layout::Month_SearchProfileNews_TextPointer4,
|
||||
message_text(session.state(), ::bmh::layout::Month_SearchProfileNews_TextPointer4), 0x40});
|
||||
if (presenters.notice)
|
||||
for (const auto& hit : result->hits)
|
||||
presenters.notice(session.state(), HumanBuyerSaleNotice{request.manager_slot, hit.entry, -1,
|
||||
@@ -607,8 +613,10 @@ void serve_transfer_action(ui::StartupFlow& flow, CareerSession& session,
|
||||
else flow.acknowledge_preparation(session.preparation_projection(revision), std::move(notice));
|
||||
}, review);
|
||||
if (!outcome) throw FormatError(error);
|
||||
} catch (const std::exception&) {
|
||||
flow.reject_preparation_action("Diese Transferaktion konnte nicht übernommen werden.");
|
||||
} catch (const std::exception& e) {
|
||||
std::fprintf(stderr, "transfer action: %s\n", e.what());
|
||||
if (app::debug::enabled()) app::debug::log(std::string("transfer action refused: ") + e.what());
|
||||
flow.reject_preparation_action(std::string("Diese Transferaktion konnte nicht übernommen werden (") + e.what() + ").");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,8 +641,11 @@ void serve_transfer_offer(ui::StartupFlow& flow, CareerSession& session,
|
||||
flow.acknowledge_transfer_offer(std::move(applied.preparation), std::move(applied.editor));
|
||||
});
|
||||
if (!result) throw FormatError(error);
|
||||
} catch (const std::exception&) {
|
||||
flow.reject_transfer_offer("Diese Angebotsaktion konnte nicht übernommen werden.");
|
||||
} catch (const std::exception& e) {
|
||||
// The reason goes to the debug log and to stderr, and the player sees it: a refused offer must not look like a dead button.
|
||||
std::fprintf(stderr, "transfer offer: %s\n", e.what());
|
||||
if (app::debug::enabled()) app::debug::log(std::string("transfer offer refused: ") + e.what());
|
||||
flow.reject_transfer_offer(std::string("Diese Angebotsaktion konnte nicht übernommen werden (") + e.what() + ").");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "cli/console/detail.hpp"
|
||||
#include "game/desk_actions.hpp"
|
||||
#include "game/human_buyer_sale.hpp"
|
||||
#include "game/messages.hpp"
|
||||
#include "game/poach.hpp"
|
||||
#include "game/schedule.hpp"
|
||||
#include "ui/club_info.hpp"
|
||||
@@ -543,6 +544,7 @@ void Console::register_transfer_commands() {
|
||||
std::string error;
|
||||
const auto result = session_->dispatch_search_profile(manager, suggestion, false, true, revision_, error);
|
||||
if (!result) require_engine(false, "search profile", error);
|
||||
emit('i', utf8(message_text(session_->state(), ::bmh::layout::Month_SearchProfileNews_TextPointer4)));
|
||||
emit('+', std::to_string(result->hits.size()) + " listed player(s) fit the profile");
|
||||
for (const auto& hit : result->hits) emit('i', utf8(hit.message));
|
||||
}
|
||||
@@ -577,6 +579,7 @@ void Console::register_transfer_commands() {
|
||||
emit('+', result->active ? "search profile stored"
|
||||
: "search profile stored but switched off (all values 0 or all 1 count as no search)");
|
||||
if (v.boolean("apply", true)) {
|
||||
emit('i', utf8(message_text(session_->state(), ::bmh::layout::Month_SearchProfileNews_TextPointer4)));
|
||||
emit('+', std::to_string(result->hits.size()) + " listed player(s) fit the profile");
|
||||
for (const auto& hit : result->hits) emit('i', utf8(hit.message));
|
||||
}
|
||||
|
||||
@@ -1416,6 +1416,7 @@ inline constexpr auto Month_ReturnLoans_TextPointer8 = 0xaee48;
|
||||
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 NationalFriendlyPayerPrefixText = 0xa000f;
|
||||
inline constexpr auto NextDeskManager = 0xbd6cc;
|
||||
inline constexpr auto NoClubText = 0xaec74;
|
||||
|
||||
@@ -182,6 +182,9 @@ TaxDialogProjection pending_offer_notice_dialog(const GameState& game,
|
||||
case ::bmh::layout::PendingOffer_FormatError_ExecutableField2: // SystemIdentity(manager|0x80): interactive ACK after normal settlement.
|
||||
case ::bmh::layout::PendingOffer_ConstructionNoticeDialog_TextPointer: // SettleHumanBuyerSale -> SystemIdentity: buyer subsidy, composed amounts.
|
||||
case ::bmh::layout::PendingOffer_FormatError_ExecutableField3: // SettleHumanBuyerSale -> SystemIdentity: buyer subsidy threshold exceeded.
|
||||
case ::bmh::layout::DeskActions_SubmitTransferOfferEditorSource_ExecutableField: // poached player agrees: "Ihr erstes Angebot wird angenommen!" (without it the Angebot button of the Abwerben dialog failed).
|
||||
case ::bmh::layout::Month_SearchProfileNews_TextPointer3: // search dialog -> sub_57ECA: a listed player fits the profile.
|
||||
case ::bmh::layout::Month_SearchProfileNews_TextPointer4: // search dialog -> sub_57ECA: "your scouting department ..." after Suchen.
|
||||
out.source_manager_flags = uint8_t(notice.manager) | 0x80;
|
||||
break;
|
||||
case ::bmh::layout::PendingOffer_PendingOfferNoticeDialog_ExecutableField2: // SDLFlushEvents3(manager|0x40): timed warning.
|
||||
|
||||
@@ -1254,6 +1254,9 @@ FlowResult StartupFlow::pointer_down(int x,int y,bool right) {
|
||||
}
|
||||
if (environment_) return {environment_->pointer_down(x,y,right)};
|
||||
if (advertising_) return {advertising_->move(x,y)};
|
||||
// The transfer market draws the held button pressed (Suchen, Vorschlag, Abwerben, Data ...); the action follows on the release.
|
||||
if (transfer_market_ && !player_card_ && !outgoing_transfer_ && !toto_ && !pitch_ && !lineup_)
|
||||
return {transfer_market_->press(x,y,right)};
|
||||
if(pitch_){
|
||||
const std::string before=pitch_->state_json();
|
||||
const auto request=pitch_->pointer_down(x,y,right);
|
||||
|
||||
@@ -573,11 +573,11 @@ void TransferMarketScreen::draw_market_overview(Image& out) const {
|
||||
}
|
||||
original_text(out,201,183,padded(average[4]),0x6b);
|
||||
// Filter and mode buttons: positions and rectangles come from a table in the executable (6 bytes per entry).
|
||||
for(int n=4;n<13;++n)button(out,exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField + n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField2+n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField3+n*6),texts_[text_id(::bmh::layout::TransferMarket_Rect_TextPointer5)+size_t(n)],(view_flags_&(1u<<n))!=0);
|
||||
for(int n=4;n<13;++n)button(out,exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField + n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField2+n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField3+n*6),texts_[text_id(::bmh::layout::TransferMarket_Rect_TextPointer5)+size_t(n)],((view_flags_&(1u<<n))!=0)!=(pressed_button_==n));
|
||||
}
|
||||
button(out,1,215,51,texts_[text_id(data_b_?::bmh::layout::TransferMarket_Rect_TextPointer3: ::bmh::layout::TransferMarket_Rect_TextPointer4)],true);
|
||||
button(out,55,215,51,texts_[text_id(::bmh::layout::TransferMarket_Rect_TextPointer5)],full);
|
||||
for(int n=1;n<4;++n)if(!full&&state_.source_market_mode==3)button(out,exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField + n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField2+n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField3+n*6),texts_[text_id(::bmh::layout::TransferMarket_Rect_TextPointer5)+size_t(n)],(view_flags_&(1u<<n))!=0);
|
||||
button(out,1,215,51,texts_[text_id(data_b_?::bmh::layout::TransferMarket_Rect_TextPointer3: ::bmh::layout::TransferMarket_Rect_TextPointer4)],pressed_button_!=100);
|
||||
button(out,55,215,51,texts_[text_id(::bmh::layout::TransferMarket_Rect_TextPointer5)],full!=(pressed_button_==101));
|
||||
for(int n=1;n<4;++n)if(!full&&state_.source_market_mode==3)button(out,exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField + n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField2+n*6),exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField3+n*6),texts_[text_id(::bmh::layout::TransferMarket_Rect_TextPointer5)+size_t(n)],((view_flags_&(1u<<n))!=0)!=(pressed_button_==n));
|
||||
}
|
||||
// Formats an amount like the original: converted with the currency multiplier/divisor,
|
||||
// left-padded to 9 characters and followed by the currency suffix.
|
||||
@@ -743,6 +743,7 @@ TransferMarketRequest TransferMarketScreen::move(int x,int y) {
|
||||
// Left click handles the Data/Komplett buttons, poach and filter buttons, marking of rows, and the action bar
|
||||
// (y 202..212; the right part x>=254 means loan).
|
||||
TransferMarketRequest TransferMarketScreen::click(int x,int y,bool right) {
|
||||
pressed_button_=-1; // the release ends the held look of a button
|
||||
if(pending_||close_requested_)return {};
|
||||
if(search_open_)return click_search(x,y,right);
|
||||
if(right) {
|
||||
@@ -852,7 +853,7 @@ void TransferMarketScreen::draw_search(Image& out) const {
|
||||
auto price = original_money(10000 * (value / 10000));
|
||||
price.erase(0, price.find_first_not_of('%'));
|
||||
original_text(out, 216, 148, price, 0x7A);
|
||||
button(out, 277, 140, 40, texts_[text_id(::bmh::layout::TransferMarket_SearchButton_TextPointer)], false);
|
||||
button(out, 277, 140, 40, texts_[text_id(::bmh::layout::TransferMarket_SearchButton_TextPointer)], pressed_button_ == 200);
|
||||
}
|
||||
|
||||
// A click inside the dialog: the confirm button closes it and applies the profile, the right button closes it and
|
||||
@@ -897,6 +898,33 @@ TransferMarketRequest TransferMarketScreen::close_search(bool cancelled) {
|
||||
return request;
|
||||
}
|
||||
|
||||
// The button under the pointer (same hit areas as click()): 100 Data, 101 Komplett, 1..3 the buttons before Abwerben (mode III),
|
||||
// 4..10 the position and page buttons, 11/12 the action bar (purchase / loan), 200 the confirm button of the search dialog.
|
||||
int TransferMarketScreen::button_at(int x, int y) const {
|
||||
if (search_open_) return x >= 277 && x <= 317 && y >= 140 && y <= 150 ? 200 : -1;
|
||||
if (x >= 1 && x <= 52 && y >= 215 && y <= 225) return 100;
|
||||
if (x >= 55 && x <= 106 && y >= 215 && y <= 225) return 101;
|
||||
if (view_flags_ & 1) return -1;
|
||||
for (int n = 1; n <= 10; ++n) {
|
||||
if (n <= 3 && state_.source_market_mode != 3) continue;
|
||||
const int bx = exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField + n * 6);
|
||||
const int by = exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField2 + n * 6);
|
||||
const int width = exe_.u16(::bmh::layout::TransferMarket_Click_RuntimeField3 + n * 6);
|
||||
if (x >= bx && x <= bx + width && y >= by && y <= by + 10) return n;
|
||||
}
|
||||
if (y >= 202 && y <= 212 && x >= 185 && x <= 318) return x >= 254 ? 12 : 11;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Mouse DOWN: the button under the pointer is drawn pressed until the release (the action itself happens in click()).
|
||||
bool TransferMarketScreen::press(int x, int y, bool right) {
|
||||
if (pending_ || close_requested_) return false;
|
||||
const int id = right ? -1 : button_at(x, y);
|
||||
const bool changed = id != pressed_button_;
|
||||
pressed_button_ = id;
|
||||
return changed;
|
||||
}
|
||||
|
||||
// Keyboard shortcuts: Esc closes, B or Enter opens an offer for the selected market item,
|
||||
// V or Enter lists the selected squad player.
|
||||
TransferMarketRequest TransferMarketScreen::key(std::string_view key) {
|
||||
@@ -993,6 +1021,7 @@ std::string TransferMarketScreen::state_json() const {
|
||||
<< ",\"active_field\":" << active_field_ << ",\"numeric_input\":" << json_quote(numeric_input_)
|
||||
<< ",\"pending\":" << (pending_ ? transfer_market_request_json(*pending_) : "null")
|
||||
<< ",\"feedback\":" << json_quote(feedback_)
|
||||
<< ",\"pressed_button\":" << pressed_button_
|
||||
<< ",\"search_open\":" << (search_open_ ? "true" : "false") << ",\"search_edit\":[";
|
||||
for (size_t i = 0; i < search_edit_.size(); ++i) out << (i ? "," : "") << unsigned(search_edit_[i]);
|
||||
out << "],\"preview\":";
|
||||
|
||||
@@ -117,6 +117,8 @@ public:
|
||||
TransferMarketScreen(const std::filesystem::path&, TransferMarketState);
|
||||
Image render() const;
|
||||
TransferMarketRequest click(int x, int y, bool right = false);
|
||||
// Mouse DOWN on a button: the button is drawn pressed until the release (click). Returns whether the picture changed.
|
||||
bool press(int x, int y, bool right = false);
|
||||
// TransferMarketScreen hover preview; host acknowledges the quote before more input.
|
||||
TransferMarketRequest move(int x, int y);
|
||||
TransferMarketRequest key(std::string_view);
|
||||
@@ -164,6 +166,9 @@ private:
|
||||
bool close_requested_ = false;
|
||||
bool search_open_ = false;
|
||||
SearchProfile search_edit_{};
|
||||
// The button held by the mouse (draw id: 1..12 market buttons, 100 Data, 101 Komplett, 200 search confirm), -1 none.
|
||||
int pressed_button_ = -1;
|
||||
int button_at(int x, int y) const;
|
||||
void open_search(SearchProfile profile);
|
||||
void draw_search(Image&) const;
|
||||
TransferMarketRequest click_search(int x, int y, bool right);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "app/controller.hpp"
|
||||
#include "app/window_actions.hpp"
|
||||
#include "ui/manager.hpp"
|
||||
#include "ui/pending_offer.hpp"
|
||||
#include "ui/contracts.hpp"
|
||||
#include "game/month.hpp"
|
||||
#include "game/desk_actions.hpp"
|
||||
@@ -533,7 +534,21 @@ void check_transfer_market_controller(const std::filesystem::path& data) {
|
||||
hooks.allocator_gate = HumanBuyerSaleAllocatorGate::zero;
|
||||
hooks.direct_mode = HumanBuyerSaleDirectMode::ordinary_ai_purchase;
|
||||
std::vector<std::string> boxes;
|
||||
hooks.notice = [&](const GameState&, const HumanBuyerSaleNotice& notice) { boxes.push_back(notice.original_message); };
|
||||
// Like the graphical client, every notice is turned into its dialog (an unknown notice there refuses the whole action).
|
||||
hooks.notice = [&](const GameState& state, const HumanBuyerSaleNotice& notice) {
|
||||
(void)pending_offer_notice_dialog(state, PendingOfferNotice{notice.manager, notice.raw_offer_slot,
|
||||
notice.source_text_address, notice.original_message});
|
||||
boxes.push_back(notice.original_message);
|
||||
};
|
||||
// All notices the transfer routes can raise have a dialog (the poached player's agreement and the scouting boxes included).
|
||||
for (const uint32_t address : {::bmh::layout::DeskActions_SubmitTransferOfferEditorSource_TextPointer,
|
||||
::bmh::layout::DeskActions_SubmitTransferOfferEditorSource_RuntimeField,
|
||||
::bmh::layout::DeskActions_SubmitTransferOfferEditorSource_ExecutableField,
|
||||
::bmh::layout::DeskActions_SubmitTransferBidImpl_ExecutableField,
|
||||
::bmh::layout::DeskActions_Unsupported_ExecutableField, ::bmh::layout::DeskActions_Unsupported_ExecutableField2,
|
||||
::bmh::layout::DeskActions_Unsupported_ExecutableField3, ::bmh::layout::DeskActions_Unsupported_TextPointer3,
|
||||
::bmh::layout::Month_SearchProfileNews_TextPointer3, ::bmh::layout::Month_SearchProfileNews_TextPointer4})
|
||||
(void)pending_offer_notice_dialog(game, PendingOfferNotice{initial.manager_slot, -1, address, "x"});
|
||||
const auto serve_search = [&](const FlowResult& result) {
|
||||
return app::serve_flow_request(flow, result, session, data, data, 0x1789abcd, revision, playback, audio_session, false,
|
||||
{}, {}, {}, {}, {}, {}, {}, {}, {}, app::PendingOfferEntryPolicy::legacy_unpresented, hooks,
|
||||
@@ -564,8 +579,8 @@ void check_transfer_market_controller(const std::filesystem::path& data) {
|
||||
const auto stored = search_profile(game, manager);
|
||||
check(revision == before_store + 1 && !(stored[0] & kSearchProfileOff) && stored[2] == 0 && stored[5] == 24 && stored[7] == 99,
|
||||
"the stored profile is active and has the edits");
|
||||
check(boxes.size() == search_profile_hits(game, manager).size() && !boxes.empty(),
|
||||
"every listing that fits is announced through the notice presenter");
|
||||
check(boxes.size() == search_profile_hits(game, manager).size() + 1 && boxes.size() > 1,
|
||||
"the scouting department reports first, then every listing that fits gets its message box");
|
||||
check(flow.state_json().find("\"search_open\":false") != std::string::npos && !flow.pending_transfer_market(),
|
||||
"the dialog is closed and the request settled");
|
||||
// Vorschlag opens with the profile the squad asks for; leaving by right click keeps it but switches the search off
|
||||
|
||||
Reference in new issue
Block a user