Transfer market: the search dialog behind Suchen and Vorschlag; asking fee display follows Diamond 3.7
TransferMarketScreen gets the dialog of the original (KB/69.VGA panel at 184,20, seven bar rows from the EXE table, click rules of sub_19409, confirm button, price estimate). Suchen opens it with the stored profile, Vorschlag with the suggestion the squad asks for (computed in the projection). Closing posts a store_search_profile request; the controller stores it and announces the matching listings through the notice presenter, like the original's message boxes. Right button or Esc leaves with the search switched off. Controller test drives the whole route. The market list showed the asking fee scaled by 0x30d4 (older Diamond); 3.7 rounds to 10000 (sub_3C940), now also in the projection. Four tests computed the old base and follow. Fixes #79 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
933567232e
commit
0a95dbcba6
12 files changed
+255
-17
No files matched your search
@@ -56,13 +56,18 @@ bool search_profile_valid(SearchProfile profile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool search_profile_active(SearchProfile profile, bool cancelled) {
|
||||
profile[0] &= 0x3F;
|
||||
int sum = 0;
|
||||
for (uint8_t value : profile) sum += value;
|
||||
return !(sum == 0 || sum == 18 || cancelled);
|
||||
}
|
||||
|
||||
bool set_search_profile(GameState& g, int manager, SearchProfile profile, bool cancelled) {
|
||||
if (manager < 0 || size_t(manager) >= g.manager_teams.size() ||
|
||||
(size_t(manager) + 1) * kRecord > g.manager_records.size() || !search_profile_valid(profile)) return false;
|
||||
profile[0] &= 0x3F;
|
||||
int sum = 0;
|
||||
for (uint8_t value : profile) sum += value;
|
||||
if (sum == 0 || sum == 18 || cancelled) profile[0] |= kSearchProfileOff;
|
||||
if (!search_profile_active(profile, cancelled)) profile[0] |= kSearchProfileOff;
|
||||
for (size_t i = 0; i < profile.size(); ++i)
|
||||
g.manager_records.at(size_t(manager) * kRecord + kSearchProfileOffset + i) = profile[i];
|
||||
return (profile[0] & kSearchProfileOff) == 0;
|
||||
|
||||
@@ -28,6 +28,11 @@ SearchProfile search_profile(const GameState& g, int manager);
|
||||
// ignored in byte 0), the age bar has 25 cells (bytes 4 and 5 are 0..24) and the strength bar 100 (bytes 6 and 7 are 0..99).
|
||||
bool search_profile_valid(SearchProfile profile);
|
||||
|
||||
// Whether a profile closed with `cancelled` (right click) or not counts as an active search: the "off" bit of
|
||||
// byte 0 is ignored, every value 0 or every value 1 (the sum is 0 or 18) switches the search off, and so does
|
||||
// leaving the dialog by right click. The dialog uses the result for the button state, the engine for the stored bit.
|
||||
bool search_profile_active(SearchProfile profile, bool cancelled);
|
||||
|
||||
// Stores the profile the way the original dialog does when it is closed: a profile with every value 0 or
|
||||
// every value 1 is switched off (bit 0x40), and so is any profile that was left by right click
|
||||
// (`cancelled`). Returns whether the stored profile is active. Fails (false, nothing stored) for an
|
||||
|
||||
Reference in new issue
Block a user