Require an owned mouse release in transfer modals (by Codex)
Late or repeated releases from a post-match table cannot decline the immediately following transfer or acknowledge its confirmation. Track presses within each release-driven modal; keep semantic Source DOWN actions and fresh left/right gestures. Reproduced and verified through the real post-match table-to-transfer GUI flow. Refs: #44
This commit is contained in:
1 parent
a5aa4c6a08
commit
8862bd4f89
5 files changed
+58
-5
No files matched your search
+11
-5
@@ -2225,10 +2225,13 @@ int main(int argc, char** argv) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return -1; }
|
||||
std::optional<int> answer;
|
||||
if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) {
|
||||
answer = offer_screen.click(event.button.x, event.button.y,
|
||||
event.button.button == SDL_BUTTON_RIGHT);
|
||||
offer_screen.pointer_down(event.button.button == SDL_BUTTON_RIGHT);
|
||||
} else if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) {
|
||||
answer = offer_screen.pointer_up(event.button.x, event.button.y,
|
||||
event.button.button == SDL_BUTTON_RIGHT);
|
||||
offer_dirty = true;
|
||||
} else if (event.type == SDL_KEYDOWN) {
|
||||
if (offer_screen.notice_active()) {
|
||||
@@ -2293,9 +2296,12 @@ int main(int argc, char** argv) {
|
||||
SDL_Event event;
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return; }
|
||||
if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT))
|
||||
(void)decision_screen.click(event.button.x, event.button.y,
|
||||
decision_screen.pointer_down(event.button.button == SDL_BUTTON_RIGHT);
|
||||
else if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT))
|
||||
(void)decision_screen.pointer_up(event.button.x, event.button.y,
|
||||
event.button.button == SDL_BUTTON_RIGHT, elapsed);
|
||||
}
|
||||
if (confirmation ? decision_screen.confirmation_dismissed() : decision_screen.outcome_dismissed()) return;
|
||||
|
||||
@@ -530,6 +530,17 @@ bool IncomingTransferScreen::dismiss_notice() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void IncomingTransferScreen::pointer_down(bool right) {
|
||||
pointer_buttons_ |= right ? 2 : 1;
|
||||
}
|
||||
|
||||
std::optional<int> IncomingTransferScreen::pointer_up(int x, int y, bool right, uint64_t elapsed_ms) {
|
||||
const uint8_t button = right ? 2 : 1;
|
||||
if (!(pointer_buttons_ & button)) return std::nullopt;
|
||||
pointer_buttons_ &= uint8_t(~button);
|
||||
return click(x, y, right, elapsed_ms);
|
||||
}
|
||||
|
||||
std::optional<int> IncomingTransferScreen::click(int x, int y, bool right, uint64_t elapsed_ms) {
|
||||
if (confirmation_mode_) {
|
||||
if (!right && x >= 95 && x <= 220 && y >= 166 && y <= 176)
|
||||
|
||||
@@ -142,6 +142,10 @@ public:
|
||||
void show_confirmation(uint32_t original_text_address, const Image& backdrop);
|
||||
bool confirmation_dismissed() const { return confirmation_dismissed_; }
|
||||
bool outcome_dismissed() const { return outcome_dismissed_; }
|
||||
// Raw release-driven presenters must own a press in this visible modal.
|
||||
// Semantic Source DOWN actions can continue to use click directly.
|
||||
void pointer_down(bool right = false);
|
||||
std::optional<int> pointer_up(int x, int y, bool right = false, uint64_t elapsed_ms = 0);
|
||||
std::optional<int> click(int x, int y, bool right = false, uint64_t elapsed_ms = 0);
|
||||
std::optional<int> key(std::string_view name);
|
||||
bool dismiss_notice();
|
||||
@@ -159,6 +163,7 @@ private:
|
||||
Image background_, negotiation_;
|
||||
bool gradient_text_ = true;
|
||||
std::optional<int> answer_;
|
||||
uint8_t pointer_buttons_ = 0;
|
||||
bool notice_active_ = false;
|
||||
int outcome_row_count_ = -1;
|
||||
int outcome_accepted_bid_index_ = -1;
|
||||
|
||||
@@ -93,6 +93,24 @@ int main(int argc, char** argv) {
|
||||
"raw Source 0xfff pool seller resolves without indexing a club or national-team token");
|
||||
|
||||
auto state = fixture();
|
||||
IncomingTransferScreen release_owner(argv[1], state);
|
||||
const auto undecided_pixels = release_owner.render().pixels;
|
||||
check(!release_owner.pointer_up(310,230,true) &&
|
||||
!release_owner.pointer_up(309,229,true) && !release_owner.answer() &&
|
||||
release_owner.render().pixels == undecided_pixels,
|
||||
"late/repeated table releases cannot decline the following transfer");
|
||||
release_owner.pointer_down();
|
||||
release_owner.pointer_down(); // Repeated DOWN still owns a single left gesture.
|
||||
check(!release_owner.pointer_up(310,230,true) && !release_owner.answer(),
|
||||
"an orphan right release does not consume an owned left press");
|
||||
check(release_owner.pointer_up(10,150) == 0 &&
|
||||
!release_owner.pointer_up(10,150) && release_owner.answer() == 0,
|
||||
"fresh left gesture selects its raw offer once despite repeated DOWN/UP");
|
||||
IncomingTransferScreen right_owner(argv[1], state);
|
||||
right_owner.pointer_down(true);right_owner.pointer_down(true);
|
||||
check(right_owner.pointer_up(309,229,true) == -1 &&
|
||||
!right_owner.pointer_up(309,229,true) && right_owner.answer() == -1,
|
||||
"fresh moved right gesture still declines exactly once");
|
||||
IncomingTransferScreen screen(argv[1], state);
|
||||
const auto frame = screen.render();
|
||||
check(frame.width == 320 && frame.height == 240 && frame.pixels.size() == 320u * 240u,
|
||||
@@ -247,6 +265,13 @@ int main(int argc, char** argv) {
|
||||
"only a left click inside KLICK can acknowledge the confirmation");
|
||||
check(!confirm.click(95,166) && confirm.confirmation_dismissed() && !confirm.answer(),
|
||||
"KLICK acknowledges without submitting a new transfer decision");
|
||||
IncomingTransferScreen confirmation_owner(argv[1],confirm_state);
|
||||
confirmation_owner.show_confirmation(::bmh::layout::PendingOffer_FormatError_ExecutableField2,settled_image);
|
||||
check(!confirmation_owner.pointer_up(150,170) && !confirmation_owner.confirmation_dismissed(),
|
||||
"an inherited left release cannot acknowledge the next confirmation");
|
||||
confirmation_owner.pointer_down();
|
||||
check(!confirmation_owner.pointer_up(150,170) && confirmation_owner.confirmation_dismissed(),
|
||||
"a fresh complete left gesture acknowledges its owned confirmation");
|
||||
IncomingTransferScreen confirm_edge(argv[1],confirm_state);
|
||||
confirm_edge.show_confirmation(::bmh::layout::PendingOffer_FormatError_ExecutableField2,settled_image);
|
||||
check(!confirm_edge.click(221,176) && !confirm_edge.confirmation_dismissed(),
|
||||
|
||||
Reference in new issue
Block a user