From f759a6f40c04c77cd0e0344f95596b775a5729c0 Mon Sep 17 00:00:00 2001 From: ProgenyAlpha Date: Tue, 27 Oct 2026 16:21:32 -0400 Subject: [PATCH] Sync: fix the macOS build: parse widened floats without floating-point from_chars std::from_chars for double is unavailable before macOS 26 (build-mac failed on dev after #325). The shortest float text from to_chars is now read back through a classic-locale stream. --- mods/src/patches/parts/sync.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/src/patches/parts/sync.cc b/mods/src/patches/parts/sync.cc index 6f64bdd2c..0871b8eee 100644 --- a/mods/src/patches/parts/sync.cc +++ b/mods/src/patches/parts/sync.cc @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include #include @@ -2480,10 +2482,15 @@ namespace deployed_fleets return static_cast(value); } + // Floating-point std::from_chars needs macOS 26's libc++; a classic-locale stream reads the same text everywhere. char buffer[32]; double widened = value; if (const auto [end, ec] = std::to_chars(std::begin(buffer), std::end(buffer), value); ec == std::errc{}) { - std::from_chars(std::begin(buffer), end, widened); + std::istringstream in(std::string(std::begin(buffer), end)); + in.imbue(std::locale::classic()); + if (double parsed; in >> parsed) { + widened = parsed; + } } return widened; }