The interested clubs fill a sheet of their own
The change of club is a far-reaching decision: the clubs are listed large on the left, and the chosen one is shown on the right beside the manager's own club - the team part by part, its places over the season, the cash, the ground and the squad. Taking a club asks once more. The read "assembly" reports lines, places, squad size and ground per club. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
a2b9770d81
commit
101273f777
7 files changed
+226
-31
No files matched your search
@@ -8926,7 +8926,7 @@ namespace {
|
||||
// The annual general meeting and the interested clubs for the interface (read "assembly", and the
|
||||
// args of the advance's question): the vote of the three groups, whether it is due at this desk,
|
||||
// and the clubs with the cash they offer and the strength of their eleven.
|
||||
cli::Json assembly_data(const modern::ModernState& g, int manager, bool season_end) {
|
||||
cli::Json assembly_data(const modern::ModernState& g, const LeImage& exe, int manager, bool season_end) {
|
||||
using O = cli::Json::Object;
|
||||
using A = cli::Json::Array;
|
||||
const int team = manager >= 0 && size_t(manager) < g.manager_teams.size() ? g.manager_teams[size_t(manager)] : -1;
|
||||
@@ -8934,12 +8934,37 @@ cli::Json assembly_data(const modern::ModernState& g, int manager, bool season_e
|
||||
const auto vote = modern::assembly_vote(g, manager);
|
||||
const int voted = size_t(manager) < g.assembly.size() ? g.assembly[size_t(manager)].voted_season : -1;
|
||||
const uint16_t eleven = avg::CONDITION | avg::TECHNIQUE | avg::FORM | avg::MORALE | avg::ALL_POSITIONS | avg::LINEUP_ONLY;
|
||||
// the eleven by line: goal, defence, midfield, attack
|
||||
const auto lines = [&](int t) {
|
||||
const uint16_t base = avg::CONDITION | avg::TECHNIQUE | avg::FORM | avg::MORALE | avg::LINEUP_ONLY;
|
||||
return O{{"goal", team_average(g, t, base | avg::GOALKEEPER).value}, {"defence", team_average(g, t, base | avg::DEFENDER).value},
|
||||
{"midfield", team_average(g, t, base | avg::MIDFIELDER).value}, {"attack", team_average(g, t, base | avg::FORWARD).value}};
|
||||
};
|
||||
// the club's place after every round of the season (1 = first)
|
||||
const auto places = [&](int t) {
|
||||
A out;
|
||||
const int league = team_league(t);
|
||||
const int rounds = league >= 0 && size_t(league) < g.league_rounds.size() ? g.league_rounds[size_t(league)] : 0;
|
||||
for (int round = 0; round < rounds; ++round) {
|
||||
const size_t at = (size_t(round / 3) + size_t(t) * 13) * 2;
|
||||
if (at + 1 >= g.position_history.size()) break;
|
||||
const int word = int16_t(uint16_t(g.position_history[at] | g.position_history[at + 1] << 8));
|
||||
out.push_back(((word >> ((round % 3) * 5)) & 0x1f) + 1);
|
||||
}
|
||||
return out;
|
||||
};
|
||||
// the ground a manager gets with a club of this league (build_stadium): eight stands of equal size
|
||||
const auto capacity = [&](int league) {
|
||||
const uint32_t at = ::bmh::layout::Career_BuildStadium_RuntimeField4 + uint32_t(league > 2 ? league - 1 : league);
|
||||
return league >= 0 && exe.contains(at) ? cli::Json(int(exe.u8(at)) * 8000) : cli::Json(nullptr);
|
||||
};
|
||||
const auto club = [&](int t) {
|
||||
const int league = team_league(t);
|
||||
return O{{"teamId", modern::ui_team_id(g, t)},
|
||||
{"name", size_t(t) < g.world_club_name.size() ? g.world_club_name[size_t(t)] : std::string()},
|
||||
{"league", league >= 0 && size_t(league) < g.world_league_name.size() ? g.world_league_name[size_t(league)] : std::string()},
|
||||
{"leagueIndex", league}, {"strength", team_average(g, t, eleven).value},
|
||||
{"leagueIndex", league}, {"leagueSize", league_table_teams(league)}, {"strength", team_average(g, t, eleven).value},
|
||||
{"lines", lines(t)}, {"positions", places(t)}, {"squad", modern::squad_count(g, t, 2)}, {"stadiumCapacity", capacity(league)},
|
||||
{"position", modern::table_position(g, t) < 0 ? cli::Json(nullptr) : cli::Json(modern::table_position(g, t) + 1)}};
|
||||
};
|
||||
A offers;
|
||||
@@ -8952,7 +8977,8 @@ cli::Json assembly_data(const modern::ModernState& g, int manager, bool season_e
|
||||
{"dismissals", g.dismissals}, {"season", g.season},
|
||||
{"vote", O{{"sport", vote.sport}, {"finance", vote.finance}, {"supporters", vote.supporters},
|
||||
{"yes", vote.yes}, {"confirmed", vote.confirmed}}},
|
||||
{"club", club(team)}, {"offers", std::move(offers)}};
|
||||
{"club", club(team)}, {"cash", modern::ui_money(int64_t(int32_t(uint32_t(g.manager_records[size_t(manager) * 0xb0c + 0x314]) | uint32_t(g.manager_records[size_t(manager) * 0xb0c + 0x315]) << 8 | uint32_t(g.manager_records[size_t(manager) * 0xb0c + 0x316]) << 16 | uint32_t(g.manager_records[size_t(manager) * 0xb0c + 0x317]) << 24)))},
|
||||
{"offers", std::move(offers)}};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -9519,7 +9545,7 @@ cli::Json ModernSession::ui_read(const cli::Json& request, uint64_t revision) co
|
||||
// the annual general meeting and the clubs that want the manager (hauptversammlung.md). Pure.
|
||||
try {
|
||||
return modern::ui_snapshot(g_, context, request_id,
|
||||
assembly_data(g_, manager, turn_driver_.stage == TurnDriver::Stage::SeasonEndDesk));
|
||||
assembly_data(g_, exe_, manager, turn_driver_.stage == TurnDriver::Stage::SeasonEndDesk));
|
||||
} catch (const std::exception&) {
|
||||
return modern::ui_error(request_id, "assembly_unavailable", "Die Hauptversammlung ist hier nicht verfügbar.", revision, false);
|
||||
}
|
||||
@@ -9897,7 +9923,7 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
||||
const bool must_leave = !vote.confirmed && g_.dismissals;
|
||||
const cli::Json* asked = ui_field(*payload, "assembly");
|
||||
const auto ask = [&](const char* text) {
|
||||
cli::Json data = assembly_data(g_, manager, true);
|
||||
cli::Json data = assembly_data(g_, exe_, manager, true);
|
||||
restore(); managers_ = managers_before;
|
||||
cli::Json pending = refuse("decision_pending", text);
|
||||
auto& message = std::get<cli::Json::Object>(std::get<cli::Json::Object>(pending.value)["message"].value);
|
||||
|
||||
Reference in new issue
Block a user