The stadium has a name of its own, and the name can be sold
A manager renames his stadium on the stadium page. On the advertising page three sponsors offer to buy the name for one to five years; the sponsor pays with every month change, the stadium is called after him, and until the contract ends it can be neither renamed nor sold again. The match sheet shows the name. Engine: naming_rights.hpp; read stadium (name, nameEditable, namingRights, namingOffers), commands stadium.rename and stadium.namingRights, live read stadiumName; saved in state/modern.json. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
83bd96c1ff
commit
2639f37def
26 files changed
+507
-9
No files matched your search
@@ -980,6 +980,29 @@ int main(int argc, char** argv) {
|
||||
const J curves = session.read_statistics_screen(O{{"section", 2}});
|
||||
check(!club_desk || (at(curves, "series").array() && at(curves, "series").array()->size() == 6), "the six curves of the original");
|
||||
}
|
||||
// the stadium's name and its naming rights
|
||||
{
|
||||
const auto ground = [&] { return at(session.ui_read(O{{"kind", "stadium"}}, rev), "data"); };
|
||||
const J first = ground();
|
||||
if (first.object() && at(first, "namingOffers").array()) {
|
||||
check(truth(at(first, "nameEditable")) && at(first, "namingOffers").array()->size() == 3 && std::holds_alternative<std::nullptr_t>(at(first, "namingRights").value),
|
||||
"stadium: the name is free, three sponsors offer");
|
||||
const uint64_t n0 = rev;
|
||||
check(s(at(session.ui_command(cmd("request:n1", "stadium.rename", O{{"name", " "}}), rev), "code")) == "invalid_name" && rev == n0, "an empty stadium name is refused");
|
||||
const J renamed = session.ui_command(cmd("request:n2", "stadium.rename", O{{"name", "Waldstadion"}}), rev);
|
||||
check(s(at(renamed, "messageType")) == "command_result" && rev == n0 + 1 && s(at(ground(), "name")) == "Waldstadion", "the stadium is renamed");
|
||||
const std::string offer = s(at(at(ground(), "namingOffers").array()->front(), "id"));
|
||||
check(s(at(session.ui_command(cmd("request:n3", "stadium.namingRights", O{{"offerId", offer}}), rev), "code")) == "confirmation_required", "selling the name needs the confirmation");
|
||||
const J sold = session.ui_command(cmd("request:n4", "stadium.namingRights", O{{"offerId", offer}, {"confirmed", true}}), rev);
|
||||
const J after = ground();
|
||||
check(s(at(sold, "messageType")) == "command_result" && rev == n0 + 2 && !truth(at(after, "nameEditable")) && at(after, "namingRights").object() &&
|
||||
at(after, "namingOffers").array()->empty() && s(at(after, "name")) != "Waldstadion",
|
||||
"the name is sold: the sponsor's arena, no further offers");
|
||||
check(s(at(session.ui_command(cmd("request:n5", "stadium.rename", O{{"name", "Nordpark"}}), rev), "code")) == "name_sold" &&
|
||||
s(at(session.ui_command(cmd("request:n6", "stadium.namingRights", O{{"offerId", offer}, {"confirmed", true}}), rev), "code")) == "name_sold",
|
||||
"a sold name can be neither changed nor sold again");
|
||||
}
|
||||
}
|
||||
// the annual general meeting and the interested clubs: the read, then a change of club
|
||||
{
|
||||
const J meeting = at(session.ui_read(O{{"kind", "assembly"}}, rev), "data");
|
||||
|
||||
Reference in new issue
Block a user