Create real careers from the native wizard and preserve manager presentation (by Codex)

This commit is contained in:
Codex committed 2026-10-29 01:11:41 +01:00
1 parent 738ecc7a09
commit ce1535fe2d
38 files changed
+466 -75

No files matched your search

@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "modern/content/ui_contract.hpp"
#include "modern/game/modern_state.hpp"
#include <iostream>
#include <stdexcept>
using namespace bmh;
namespace {using J=cli::Json;using O=J::Object;const J& at(const J& j,const char* k){return j.object()->at(k);}void check(bool ok,const char* why){if(!ok)throw std::runtime_error(why);}}
int main() try {
modern::ModernState g;g.manager_teams={0};g.manager_ids={"manager:1"};g.manager_serial=1;g.manager_records.resize(0xb0c);g.world_club_id={"club:one"};g.world_club_name={"Synthetic"};const std::string original="M}ller";for(size_t i=0;i<original.size();++i)g.manager_records[0xa8+i]=original[i];
const std::string unicode="J\xc3\xb6rg M\xc3\xbcller";g.manager_presentations.push_back({"manager:1",unicode,"painted"});modern::UiContext c;c.manager=0;
const auto read=modern::ui_read(g,c,O{{"kind","session"}});const auto &m=at(at(read,"data"),"managers").array()->at(0);check(*at(m,"name").string()==unicode,"UTF-8 manager name lost");check(*at(m,"portraitStyle").string()=="painted"&&*at(m,"portraitGuiKey").string()=="gui:manager/painted/0","portrait style lost");check(!g.manager_presentation(1)&&!g.manager_presentation(-1),"presentation crossed slot bounds");check(g.manager_records[0xa8+1]=='}',"display metadata modified original bytes");
g.manager_presentations.clear();const auto fallback=modern::ui_read(g,c,O{{"kind","session"}});const auto &old=at(at(fallback,"data"),"managers").array()->at(0);check(*at(old,"name").string()=="M\xc3\xbcller"&&*at(old,"portraitStyle").string()=="photo","old saves lost original-name/photo fallback");std::cout<<"Modern UTF-8 presentation, original bytes and older-save fallback passed\n";return 0;
} catch(const std::exception& e){std::cerr<<e.what()<<'\n';return 1;}