From f33b381f1856f98947a2830161cab590d4d28a2c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 5 Nov 2026 12:17:30 +0100 Subject: [PATCH] Hide ANNEHMEN in the advertising offer browser when the offer cannot be accepted The original shows only ABBRECHEN while a running sponsor contract is not terminable; the button was always drawn here. Co-Authored-By: Claude Sonnet 5.5 --- src/ui/advertising.cpp | 13 ++++++++++++- src/ui/advertising.hpp | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ui/advertising.cpp b/src/ui/advertising.cpp index 56521da..f01b1f4 100644 --- a/src/ui/advertising.cpp +++ b/src/ui/advertising.cpp @@ -756,7 +756,10 @@ Image AdvertisingScreen::render() const { copy(image, logos_, 32, 217, 138, 174, 11, 14); button(image, 89, 191, 66, state_.cancel_label); - button(image, 164, 191, 66, state_.accept_label); + // The original shows ABBRECHEN only when the selected offer cannot be accepted + // (for example while a running sponsor contract is not terminable). + if (offer_acceptable()) + button(image, 164, 191, 66, state_.accept_label); } } if (hovered_target_ >= 0) { @@ -970,6 +973,14 @@ bool AdvertisingScreen::open_offers(int display_slot) { return true; } +bool AdvertisingScreen::offer_acceptable() const { + if (!offer_open_ || selected_contract_ < 0 || selected_contract_ >= 16 || selected_offer_ < 0) return false; + for (const auto& candidate : state_.offers[size_t(selected_contract_)].offers) + if (candidate.raw_slot == selected_offer_) + return candidate.present && candidate.can_accept && candidate.monthly_amount != 0; + return false; +} + void AdvertisingScreen::submit_selected_offer() { if (pending_ || !offer_open_ || selected_contract_ < 0 || selected_contract_ >= 16 || selected_offer_ < 0) return; diff --git a/src/ui/advertising.hpp b/src/ui/advertising.hpp index 4969d00..d11564c 100644 --- a/src/ui/advertising.hpp +++ b/src/ui/advertising.hpp @@ -158,6 +158,8 @@ private: int max_width = 310, bool use_gradient = true) const; void begin_offer_browser(int display_slot); void submit_selected_offer(); + // True when the selected offer of the open browser can be accepted (draws ANNEHMEN). + bool offer_acceptable() const; void open_spending_calculator(int display_slot); bool accept_spending_calculator(); void close_spending_calculator();