Create real careers from the native wizard and preserve manager presentation (by Codex)
This commit is contained in:
1 parent
738ecc7a09
commit
ce1535fe2d
38 files changed
+466
-75
No files matched your search
@@ -157,18 +157,11 @@ bool migrate_demo_opening(Json &state, const Catalog &world) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
std::string edit_demo_opening(Json &state, const Json &action,
|
||||
const Catalog &world) {
|
||||
std::string advance_opening_presentation(Json &source,const std::string &kind) {
|
||||
try {
|
||||
if (!action.is_object() || action.size() != 1 || !action.contains("kind") ||
|
||||
!action.at("kind").is_string())
|
||||
return "Ungültige Aktion der Saisonvorbereitung.";
|
||||
auto next = state;
|
||||
if (!migrate_demo_opening(next, world))
|
||||
return "Die gespeicherte Saisonvorbereitung ist ungültig.";
|
||||
auto &flow = next.at("opening_flow");
|
||||
const auto kind = action.at("kind").get<std::string>(),
|
||||
phase = flow.at("phase").get<std::string>();
|
||||
auto flow=source;
|
||||
if(!flow.at("order").is_array()||!flow.at("revealed").is_number_integer()||flow.at("revealed").get<int64_t>()<0||flow.at("revealed").get<uint64_t>()>flow.at("order").size()||!flow.at("playing").is_boolean())return "Ungültiger Darstellungszustand der Saisonvorbereitung.";
|
||||
const auto phase = flow.at("phase").get<std::string>();
|
||||
const auto total = flow.at("order").size();
|
||||
if (kind == "next") {
|
||||
if (phase == "uefa")
|
||||
@@ -212,6 +205,21 @@ std::string edit_demo_opening(Json &state, const Json &action,
|
||||
flow["playing"] = false;
|
||||
} else
|
||||
return "Unbekannte Aktion der Saisonvorbereitung.";
|
||||
source=std::move(flow);return {};
|
||||
}catch(const std::exception&){return "Ungültiger Darstellungszustand der Saisonvorbereitung.";}
|
||||
}
|
||||
std::string edit_demo_opening(Json &state, const Json &action,
|
||||
const Catalog &world) {
|
||||
try {
|
||||
if (!action.is_object() || action.size() != 1 || !action.contains("kind") ||
|
||||
!action.at("kind").is_string())
|
||||
return "Ungültige Aktion der Saisonvorbereitung.";
|
||||
auto next = state;
|
||||
if (!migrate_demo_opening(next, world))
|
||||
return "Die gespeicherte Saisonvorbereitung ist ungültig.";
|
||||
auto &flow = next.at("opening_flow");
|
||||
const auto error=advance_opening_presentation(flow,action.at("kind"));
|
||||
if(!error.empty())return error;
|
||||
const bool done = flow.at("phase").get<std::string>() == "done";
|
||||
next["opening"] = done ? "complete" : "pending";
|
||||
next["opening_created"] = done && flow.at("created").get<bool>();
|
||||
|
||||
Reference in new issue
Block a user