From 11caa6529cd9652ac71b4e69d508e2accb166500 Mon Sep 17 00:00:00 2001 From: zwwooooo Date: Sun, 11 May 2025 00:33:08 +0800 Subject: [PATCH] Fix the issue of garbled UTF-8 text in the szTileSetDisplayName field of the StructureMove.xml file in the game's "Drag" menu.(Method provided by @Learner) --- Tactical/SkillMenu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tactical/SkillMenu.cpp b/Tactical/SkillMenu.cpp index 3ecd4aec..bb11f167 100644 --- a/Tactical/SkillMenu.cpp +++ b/Tactical/SkillMenu.cpp @@ -909,7 +909,9 @@ DragSelection::Setup( UINT32 aVal ) if ( xmlentry >= 0 ) { - swprintf( pStr, L"%hs (%s)", gStructureMovePossible[xmlentry].szTileSetDisplayName, FaceDirs[gOneCDirection[ubDirection]] ); + WCHAR buf[256]; + MultiByteToWideChar(CP_UTF8, 0, gStructureMovePossible[xmlentry].szTileSetDisplayName, -1, buf, 256); + swprintf(pStr, L"%s (%s)", buf, FaceDirs[gOneCDirection[ubDirection]]); // we have to use an offset of NOBODY in order to differentiate between person and corpse pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction( &Wrapper_Function_DragSelection_GridNo, sTempGridNo ) );