From 978a014b87b971306d37b47682411cc5f3f41955 Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 18 Oct 2026 11:40:04 +0200 Subject: [PATCH] Preserve prepared match groups and English save continuation (by Codex) --- CMakeLists.txt | 2 +- src/app/career_session.cpp | 10 ++++------ src/content/save.cpp | 5 +++-- src/launch/launcher_gtk.cpp | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 162f509..ed8cdbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.24) project(OpenBMH VERSION 0.2.0 LANGUAGES CXX C) if(APPLE) - enable_language(OBJCXX) + enable_language(OBJC OBJCXX) set(CMAKE_OBJCXX_STANDARD 20) set(CMAKE_OBJCXX_STANDARD_REQUIRED ON) endif() diff --git a/src/app/career_session.cpp b/src/app/career_session.cpp index 57e8f81..a26b40b 100644 --- a/src/app/career_session.cpp +++ b/src/app/career_session.cpp @@ -422,16 +422,14 @@ void restore_saved_turn_cursor(TurnDriver& driver, GameState& state, const Datab if (!unsupported_continuation.empty()) return; std::vector active_leagues; - // DayCompetitions2's competition bits expand to group leagues in this original order; - // bit 2 owns both league 2 and 3. The stale descriptors after the active group count - // are intentionally ignored. - static constexpr int first_league[8] = {0, 1, 2, 4, 5, 6, 7, 8}; - static constexpr int league_count[8] = {1, 1, 2, 1, 1, 1, 1, 1}; + // Expand the selected edition's groups. Only the German third divisions + // share bit 2; the English divisions each have their own calendar group. + // Stale descriptors beyond the active group count are ignored. for (int bit = 0; bit < 5; ++bit) { if (!((competitions >> bit) & 1u)) continue; const int first = bit, last = bit < 4 ? bit + 1 : 8; for (int k = first; k < last; ++k) - for (int league = first_league[k]; league < first_league[k] + league_count[k]; ++league) + for (int league = kGroupLeague[k]; league < kGroupLeague[k] + kGroupLeagues[k]; ++league) active_leagues.push_back(league); } if (active_leagues.size() > 6) diff --git a/src/content/save.cpp b/src/content/save.cpp index aaa0d73..fd6562a 100644 --- a/src/content/save.cpp +++ b/src/content/save.cpp @@ -92,8 +92,9 @@ MatchGroup group_json(const J &in) { g.ended = uint32_t(ended); g.kickoff_void_mask = uint32_t(mask); if ((g.desc.size() != 0xc0 && g.desc.size() != 0xd0) || g.fixtures.size() % 2 || g.matches() > 32 || - g.records.size() != size_t(g.matches()) * 18 || g.end_minute.size() != size_t(g.matches()) || - g.spectators.size() != size_t(g.matches())) + (!g.records.empty() && g.records.size() != size_t(g.matches()) * 18) || + (!g.end_minute.empty() && g.end_minute.size() != size_t(g.matches())) || + (!g.spectators.empty() && g.spectators.size() != size_t(g.matches()))) fail("invalid match dimensions"); return g; } diff --git a/src/launch/launcher_gtk.cpp b/src/launch/launcher_gtk.cpp index 62078ef..6f0b481 100644 --- a/src/launch/launcher_gtk.cpp +++ b/src/launch/launcher_gtk.cpp @@ -126,8 +126,8 @@ class GtkLauncher final : public LauncherUI { auto *dialog = gtk_file_chooser_dialog_new( title.c_str(), GTK_WINDOW(window_), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, "Abbrechen", GTK_RESPONSE_CANCEL, "Auswählen", GTK_RESPONSE_ACCEPT, nullptr); - if (!initial.empty()) - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), path_to_utf8(initial).c_str()); + const auto folder=initial.empty()?path_from_utf8(g_get_home_dir()):initial; + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),path_to_utf8(folder).c_str()); std::optional result; if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));