From aac53ce71d4d2eee6560815eaad92acef00f0d42 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 22 Jul 2026 12:14:25 -0300 Subject: [PATCH] let ScreenMsg take a format string it will not write to STR16 is CHAR16*, so ScreenMsg asked for a mutable format string it has no intention of mutating: the body only hands it to va_start and vswprintf, and vswprintf takes it as const. Calls that pass a literal are accepted anyway under the MSVC rules clang-cl applies. Calls that pass anything else are not, and DynamicDialogue.cpp picks the format at runtime: ScreenMsg( FONT_MCOLOR_LTGREEN, MSG_INTERFACE, ...sOpinionModifier >= 0 ? L"%s: %s +%d" : L"%s: %s %d", ... ); The conditional has type const wchar_t*, and there is nowhere for it to go. Declaring the parameter const CHAR16* is what the function always meant. Every existing caller still compiles: a literal and a CHAR16* both convert. Verification: ninja -C build parse # DynamicDialogue.cpp clean ninja -C build -k 0 # Release, four applications, green ninja -C build-debug -k 0 # Debug, four applications, green Co-Authored-By: Claude Opus 4.8 --- Utils/message.cpp | 2 +- Utils/message.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Utils/message.cpp b/Utils/message.cpp index 0b73c4614..f9e2a0537 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -610,7 +610,7 @@ void UnHideMessagesDuringNPCDialogue( void ) return; } -void ScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...) +void ScreenMsg( UINT16 usColor, UINT8 ubPriority, const CHAR16* pStringA, ...) { //__try //{ diff --git a/Utils/message.h b/Utils/message.h index d071fae60..3ed1568ad 100644 --- a/Utils/message.h +++ b/Utils/message.h @@ -55,7 +55,7 @@ extern BOOLEAN fDisableJustForIan; // are we allowed to beep on message scroll in tactical extern BOOLEAN fOkToBeepNewMessage; -void ScreenMsg( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...); +void ScreenMsg( UINT16 usColor, UINT8 ubPriority, const CHAR16* pStringA, ...); // same as screen message, but only display to mapscreen message system, not tactical void MapScreenMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...);