diff --git a/docs/new_engine/datenformat.md b/docs/new_engine/datenformat.md index e9fb16b..37218f9 100644 --- a/docs/new_engine/datenformat.md +++ b/docs/new_engine/datenformat.md @@ -22,6 +22,7 @@ Status: *geplant* (noch nicht in der Engine), *umgesetzt* (Engine liest/prüft e | F8 | Spielstand | `save_profile: modern-career-v1` | M6 | Engine erledigt: Spielstand nennt seine Welt (ID, Revision), enthält nur die Karriere | | F9 | Schiedsrichter | eigener Schiedsrichter-Pool der Welt, mehr als 49 | M5 | Engine erledigt (Pool aus `staff`, neu: `perception`); Daten folgen mit 1.4 | | F10 | Almanach | alle gespielten Spiele im Spielstand (`history/…`) | M8 | Engine erledigt (Aufzeichnung, Spielstand); UI offen | +| F11 | Nationen | jede Spielernation mit eindeutiger ID und, wo vorhanden, Original-Index | 1.5 | Engine erledigt (Index 0–63); Daten: zwei doppelte Nationen zusammenführen | ## F1 · Manifest @@ -138,6 +139,17 @@ Die bestehende Regel `rule:training-camps` (Typ `training_camps`) bleibt und wir - Die Integritätsprüfung deckt `history/` mit ab. - **Editor:** keine Änderung (öffnet keine Spielstände). Eine Welt muss nichts liefern; sinnvoll sind stabile Vereins- und Spieler-IDs, die sich zwischen Datenrevisionen nicht ändern. +## F11 · Nationen + +- Die Nationalität eines Spielers hat in der Engine sechs Bit (Original: `w368` Bits 27–31 plus Bit 7 von `PlayerBonuses`, also 0–63); die Original-Nationen haben die Indizes 0–61 (`x-legacy.nationality_index`). Die Engine vergleicht Nationalitäten nur (deutsch oder ausländisch, gleiche Nation, Regionen bei Transfers), sie nutzt sie nicht als Tabellenindex. +- **Engine erledigt (25.10.2026):** Spieler aus Nationen mit Index 32–61 (Brasilien, Argentinien, USA, Japan …) bekamen bisher die Ausweich-Nationalität 31 (Wales); jetzt den richtigen Index samt Bit 7. Nationen ohne Original-Index erhalten 63 (keine Nation, keine Nationalmannschaft). Datensatz 1.4: 80 Spieler ohne Original-Index (vorher 223). +- **Daten (für Revision 1.5):** zwei Länder stehen doppelt in `world/nations.json` und müssen zusammengeführt werden (die Spieler auf die Nation mit Index umhängen oder der ISO-Nation den Index geben): + - Türkei: `nation:x-legacy-8` (Index 8) und `nation:tr` (ohne Index, 2 Spieler); + - Elfenbeinküste: `nation:x-legacy-59` (Index 59) und `nation:ci` (ohne Index, 13 Spieler). + Außerdem sollten die Platzhalter-IDs `nation:x-legacy-8/-59/-60` (Südkorea) zu ISO-IDs werden (`nation:tr`, `nation:ci`, `nation:kr`); IDs bleiben dabei stabil, wenn die Platzhalter als Alias erhalten bleiben. +- Die übrigen 65 Spieler kommen aus Nationen, die das Original nicht kennt (Mali, Georgien, Island …); für sie ist 63 richtig, solange die Engine keine eigenen Nationalmannschaften dafür hat. +- **Editor:** Prüfung auf doppelte Nationen (gleicher Name oder gleicher Index), auf Spielernationen ohne Eintrag in `nations.json` und auf Indizes außerhalb 0–63. + ## Modern-Prüfung (Engine und Editor) Eine Welt ist als Modern-Welt spielbar, wenn: diff --git a/src/modern/content/world_expand.cpp b/src/modern/content/world_expand.cpp index d7f2079..d429965 100644 --- a/src/modern/content/world_expand.cpp +++ b/src/modern/content/world_expand.cpp @@ -309,8 +309,11 @@ ExpandReport expand_to_world(ModernState& g, const World& world) { const WorldPlayer& p = *player_at[i]; const auto clamp7 = [](int v) { return uint32_t(std::clamp(v, 0, 127)); }; const auto skill = [](int v) { return uint32_t(std::clamp(v, 0, 3)); }; - int nationality = 31; - if (const auto it = world.nationality.find(p.nation); it != world.nationality.end() && it->second < 32) + // The nationality is six bits: w368 bits 27-31 and bit 7 of player_bonus (+32), the + // original nations 0-61. A nation without an original index gets 63, a code no nation + // and no national team uses (the engine only compares nationalities). + int nationality = 63; + if (const auto it = world.nationality.find(p.nation); it != world.nationality.end() && it->second >= 0 && it->second < 64) nationality = it->second; else ++report.fallback_nationalities; @@ -322,9 +325,9 @@ ExpandReport expand_to_world(ModernState& g, const World& world) { Player& pl = g.players[i]; pl.w35c = clamp7(p.form) | clamp7(p.technique) << 7 | clamp7(p.condition) << 14; pl.w368 = skill(p.teamplay) | skill(p.speed) << 2 | skill(p.shooting) << 4 | skill(p.passing) << 6 | - skill(p.tackling) << 8 | skill(p.free_kick) << 10 | skill(p.corner) << 12 | uint32_t(nationality) << 27; + skill(p.tackling) << 8 | skill(p.free_kick) << 10 | skill(p.corner) << 12 | uint32_t(nationality & 31) << 27; pl.w364 = uint32_t(p.position & 3) | uint32_t(age - 16) << 21; - g.player_bonus[i] = uint8_t(std::clamp(p.bonus, 0, 50)); + g.player_bonus[i] = uint8_t(std::clamp(p.bonus, 0, 50) | (nationality >= 32 ? 0x80 : 0)); g.player_name_offsets[i] = append_name(g.player_names, upper(legacy_encoding(p.last))); ++report.added_players; }