From 20bd7e270f20541bc81245742e2efc9aaf850bdd Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Thu, 12 Jan 2023 21:04:21 +0800 Subject: [PATCH 1/5] Fix map preview --- FA2sp/Ext/CMapData/Body.Pack.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/FA2sp/Ext/CMapData/Body.Pack.cpp b/FA2sp/Ext/CMapData/Body.Pack.cpp index 1eb99d3..c8c5c58 100644 --- a/FA2sp/Ext/CMapData/Body.Pack.cpp +++ b/FA2sp/Ext/CMapData/Body.Pack.cpp @@ -55,15 +55,19 @@ void CMapDataExt::PackExt(bool UpdatePreview, bool Description) if (UpdatePreview) { + Logger::Raw("Removing old previewpack\n"); + INI.DeleteSection("PreviewPack"); + INI.DeleteSection("Preview"); + Logger::Raw("Packing previewpack\n"); - BITMAPINFO info; void* buffer; int stride; + BITMAPINFO info; unsigned char* buffer; int stride; GetMapPreview(buffer, &info, stride); const int width = info.bmiHeader.biWidth; const int height = info.bmiHeader.biHeight; auto rawdata = new unsigned char[3 * width * height]; - const unsigned char* p = (const unsigned char*)buffer; + auto p = buffer; for (int x = 0; x < width; ++x) { for (int y = 0; y < height; ++y) @@ -85,7 +89,7 @@ void CMapDataExt::PackExt(bool UpdatePreview, bool Description) ppmfc::CString size; size.Format("0,0,%d,%d", width, height); - INI.WriteString("PreviewPack", "Size", size); + INI.WriteString("Preview", "Size", size); Logger::Raw(" done\n"); } } From 2f1ae294d009f5376279f4553ece38d36c0b105e Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Thu, 12 Jan 2023 21:04:33 +0800 Subject: [PATCH 2/5] Update document --- CHANGELOG.md | 4 ++++ DOCUMENT.md | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40e797e..3eece9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # FINALALERT2 - SP CHANGELOG +## RELEASE 1.5.1 (2023-01-12) +- Fixed the bug that Preview was incorrectly saved in version 1.5.0 +- Built-in script params can be translated + ## RELEASE 1.5.0 (2023-01-03) - Implement Auto Property Brush - New ***ExtConfig*** : `DDrawInVideoMem` = **BOOLEAN**, defaults to true diff --git a/DOCUMENT.md b/DOCUMENT.md index 5ebb719..be643f8 100644 --- a/DOCUMENT.md +++ b/DOCUMENT.md @@ -630,6 +630,14 @@ NOTICE THAT UNDOREDO AND COPYPASTE HASN'T BEEN SUPPORTED YET!~~ AllieEditorOK = TEXT AllieEditorCancel = TEXT TileManagerTitle = TEXT + ; Script params + ; For example, ScriptParam.Status.0 + ScriptParam.Target.[0 - 11, except 8] = TEXT + ScriptParam.SplitGroup.[0 - 3] = TEXT + ScriptParam.Facing.[0 - 7] = TEXT + ScriptParam.TalkBubble.[0 - 3] = TEXT + ScriptParam.Status.[0 - 31] = TEXT + ScriptParam.Boolean.[0 - 1] = TEXT ``` ## WRITE IN THE END From 2a12cda47cc67b8cde45569ff9c6475e774837b8 Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Thu, 12 Jan 2023 21:04:41 +0800 Subject: [PATCH 3/5] Update FA2pp --- FA2pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FA2pp b/FA2pp index 84ef01e..0a2506f 160000 --- a/FA2pp +++ b/FA2pp @@ -1 +1 @@ -Subproject commit 84ef01e3c6793059effab56f404db563b381059b +Subproject commit 0a2506fc9c56be1d87782306afc3d4d49083f4a9 From a02576da8e100cd244a691f3f299823a1bc0798f Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Thu, 12 Jan 2023 21:09:49 +0800 Subject: [PATCH 4/5] More translations allowed --- CHANGELOG.md | 1 + DOCUMENT.md | 1 + FA2sp/Ext/CScriptTypes/Body.CurrentScript.cpp | 10 +- FA2sp/Ext/CScriptTypes/Functional.h | 123 +++++++++--------- FA2sp/Ext/CTriggerOption/Hooks.cpp | 8 +- FA2sp/Helpers/Translations.cpp | 15 +++ FA2sp/Helpers/Translations.h | 1 + 7 files changed, 91 insertions(+), 68 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eece9c..267908e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## RELEASE 1.5.1 (2023-01-12) - Fixed the bug that Preview was incorrectly saved in version 1.5.0 - Built-in script params can be translated +- Trigger repeat type can be translated ## RELEASE 1.5.0 (2023-01-03) - Implement Auto Property Brush diff --git a/DOCUMENT.md b/DOCUMENT.md index be643f8..03b039b 100644 --- a/DOCUMENT.md +++ b/DOCUMENT.md @@ -638,6 +638,7 @@ NOTICE THAT UNDOREDO AND COPYPASTE HASN'T BEEN SUPPORTED YET!~~ ScriptParam.TalkBubble.[0 - 3] = TEXT ScriptParam.Status.[0 - 31] = TEXT ScriptParam.Boolean.[0 - 1] = TEXT + ScriptExtraParam.Preference.[0 - 3] = TEXT ``` ## WRITE IN THE END diff --git a/FA2sp/Ext/CScriptTypes/Body.CurrentScript.cpp b/FA2sp/Ext/CScriptTypes/Body.CurrentScript.cpp index 90a6347..f1aa1a9 100644 --- a/FA2sp/Ext/CScriptTypes/Body.CurrentScript.cpp +++ b/FA2sp/Ext/CScriptTypes/Body.CurrentScript.cpp @@ -4,6 +4,8 @@ #include #include +#include "../../Helpers/Translations.h" + CurrentScript* CScriptTypesExt::ExtCurrentScript; ppmfc::CString CurrentScript::ToString() { @@ -194,10 +196,10 @@ void CurrentScript::LoadExtraParamBox(ppmfc::CComboBox& comboBox, int actionInde if (actionIndex == 46 || actionIndex == 47 || actionIndex == 56 || actionIndex == 58) { - comboBox.SetItemData(comboBox.AddString("0 - Min Threat"), 0); - comboBox.SetItemData(comboBox.AddString("1 - Max Threat"), 1); - comboBox.SetItemData(comboBox.AddString("2 - Nearest"), 2); - comboBox.SetItemData(comboBox.AddString("3 - Farthest"), 3); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptExtraParam.Preference.0", "0 - Min Threat")), 0); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptExtraParam.Preference.1", "1 - Max Threat")), 1); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptExtraParam.Preference.2", "2 - Nearest")), 2); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptExtraParam.Preference.3", "3 - Farthest")), 3); return; } diff --git a/FA2sp/Ext/CScriptTypes/Functional.h b/FA2sp/Ext/CScriptTypes/Functional.h index 4c7a848..d41c50a 100644 --- a/FA2sp/Ext/CScriptTypes/Functional.h +++ b/FA2sp/Ext/CScriptTypes/Functional.h @@ -9,6 +9,7 @@ #include "../../Helpers/STDHelpers.h" #include "../../Helpers/ControlHelpers.h" #include "../../FA2sp.h" +#include "../../Helpers/Translations.h" class CScriptTypesFunctions { @@ -117,17 +118,17 @@ static void CScriptTypes_LoadParams_Target(ppmfc::CComboBox& comboBox) { comboBox.DeleteAllStrings(); - comboBox.SetItemData(comboBox.AddString("0 - Not specified"), 0); - comboBox.SetItemData(comboBox.AddString("1 - Anything (uses auto-targeting)"), 1); - comboBox.SetItemData(comboBox.AddString("2 - Buildings"), 2); - comboBox.SetItemData(comboBox.AddString("3 - Harvesters"), 3); - comboBox.SetItemData(comboBox.AddString("4 - Infantry"), 4); - comboBox.SetItemData(comboBox.AddString("5 - Vehicles"), 5); - comboBox.SetItemData(comboBox.AddString("6 - Factories"), 6); - comboBox.SetItemData(comboBox.AddString("7 - Base defenses"), 7); - comboBox.SetItemData(comboBox.AddString("9 - Power plants"), 9); - comboBox.SetItemData(comboBox.AddString("10 - Occupiables"), 10); - comboBox.SetItemData(comboBox.AddString("11 - Tech Buildings"), 11); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.0", "0 - Not specified")), 0); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.1", "1 - Anything (uses auto-targeting)")), 1); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.2", "2 - Buildings")), 2); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.3", "3 - Harvesters")), 3); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.4", "4 - Infantry")), 4); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.5", "5 - Vehicles")), 5); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.6", "6 - Factories")), 6); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.7", "7 - Base defenses")), 7); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.9", "9 - Power plants")), 9); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.10", "10 - Occupiables")), 10); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Target.11", "11 - Tech Buildings")), 11); } // 2 @@ -220,10 +221,10 @@ static void CScriptTypes_LoadParams_SplitGroup(ppmfc::CComboBox& comboBox) { comboBox.DeleteAllStrings(); - comboBox.SetItemData(comboBox.AddString("0 - Keep Transports, Keep Units"), 0); - comboBox.SetItemData(comboBox.AddString("1 - Keep Transports, Lose Units"), 1); - comboBox.SetItemData(comboBox.AddString("2 - Lose Transports, Keep Units"), 2); - comboBox.SetItemData(comboBox.AddString("3 - Lose Transports, Lose Units"), 3); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.SplitGroup.0", "0 - Keep Transports, Keep Units")), 0); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.SplitGroup.1", "1 - Keep Transports, Lose Units")), 1); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.SplitGroup.2", "2 - Lose Transports, Keep Units")), 2); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.SplitGroup.3", "3 - Lose Transports, Lose Units")), 3); } // 5 @@ -415,14 +416,14 @@ static void CScriptTypes_LoadParams_Facing(ppmfc::CComboBox& comboBox) { comboBox.DeleteAllStrings(); - comboBox.SetItemData(comboBox.AddString("0 - NE"), 0); - comboBox.SetItemData(comboBox.AddString("1 - E"), 1); - comboBox.SetItemData(comboBox.AddString("2 - SE"), 2); - comboBox.SetItemData(comboBox.AddString("3 - S"), 3); - comboBox.SetItemData(comboBox.AddString("4 - SW"), 4); - comboBox.SetItemData(comboBox.AddString("5 - W"), 5); - comboBox.SetItemData(comboBox.AddString("6 - NW"), 6); - comboBox.SetItemData(comboBox.AddString("7 - N"), 7); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.0", "0 - NE")), 0); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.1", "1 - E")), 1); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.2", "2 - SE")), 2); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.3", "3 - S")), 3); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.4", "4 - SW")), 4); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.5", "5 - W")), 5); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.6", "6 - NW")), 6); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Facing.7", "7 - N")), 7); } // 16 @@ -442,10 +443,10 @@ static void CScriptTypes_LoadParams_TalkBubble(ppmfc::CComboBox& comboBox) { comboBox.DeleteAllStrings(); - comboBox.SetItemData(comboBox.AddString("0 - None"), 0); - comboBox.SetItemData(comboBox.AddString("1 - Asterisk(*)"), 1); - comboBox.SetItemData(comboBox.AddString("2 - Question mark(?)"), 2); - comboBox.SetItemData(comboBox.AddString("3 - Exclamation mark(!)"), 3); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.TalkBubble.0", "0 - None")), 0); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.TalkBubble.1", "1 - Asterisk(*)")), 1); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.TalkBubble.2", "2 - Question mark(?)")), 2); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.TalkBubble.3", "3 - Exclamation mark(!)")), 3); } // 19 @@ -454,38 +455,38 @@ static void CScriptTypes_LoadParams_Status(ppmfc::CComboBox& comboBox) comboBox.DeleteAllStrings(); int i = 0; - comboBox.SetItemData(comboBox.AddString("0 - Sleep"), i++); - comboBox.SetItemData(comboBox.AddString("1 - Attack nearest enemy"), i++); - comboBox.SetItemData(comboBox.AddString("2 - Move"), i++); - comboBox.SetItemData(comboBox.AddString("3 - QMove"), i++); - comboBox.SetItemData(comboBox.AddString("4 - Retreat home for R&R"), i++); - comboBox.SetItemData(comboBox.AddString("5 - Guard"), i++); - comboBox.SetItemData(comboBox.AddString("6 - Sticky (never recruit)"), i++); - comboBox.SetItemData(comboBox.AddString("7 - Enter object"), i++); - comboBox.SetItemData(comboBox.AddString("8 - Capture object"), i++); - comboBox.SetItemData(comboBox.AddString("9 - Move into & get eaten"), i++); - comboBox.SetItemData(comboBox.AddString("10 - Harvest"), i++); - comboBox.SetItemData(comboBox.AddString("11 - Area Guard"), i++); - comboBox.SetItemData(comboBox.AddString("12 - Return (to refinery)"), i++); - comboBox.SetItemData(comboBox.AddString("13 - Stop"), i++); - comboBox.SetItemData(comboBox.AddString("14 - Ambush (wait until discovered)"), i++); - comboBox.SetItemData(comboBox.AddString("15 - Hunt"), i++); - comboBox.SetItemData(comboBox.AddString("16 - Unload"), i++); - comboBox.SetItemData(comboBox.AddString("17 - Sabotage (move in & destroy)"), i++); - comboBox.SetItemData(comboBox.AddString("18 - Construction"), i++); - comboBox.SetItemData(comboBox.AddString("19 - Deconstruction"), i++); - comboBox.SetItemData(comboBox.AddString("20 - Repair"), i++); - comboBox.SetItemData(comboBox.AddString("21 - Rescue"), i++); - comboBox.SetItemData(comboBox.AddString("22 - Missile"), i++); - comboBox.SetItemData(comboBox.AddString("23 - Harmless"), i++); - comboBox.SetItemData(comboBox.AddString("24 - Open"), i++); - comboBox.SetItemData(comboBox.AddString("25 - Patrol"), i++); - comboBox.SetItemData(comboBox.AddString("26 - Paradrop approach drop zone"), i++); - comboBox.SetItemData(comboBox.AddString("27 - Paradrop overlay drop zone"), i++); - comboBox.SetItemData(comboBox.AddString("28 - Wait"), i++); - comboBox.SetItemData(comboBox.AddString("29 - Attack again"), i++); - comboBox.SetItemData(comboBox.AddString("30 - Spyplane approach"), i++); - comboBox.SetItemData(comboBox.AddString("31 - Spyplane overfly"), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.0", "0 - Sleep")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.1", "1 - Attack nearest enemy")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.2", "2 - Move")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.3", "3 - QMove")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.4", "4 - Retreat home for R&R")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.5", "5 - Guard")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.6", "6 - Sticky (never recruit)")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.7", "7 - Enter object")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.8", "8 - Capture object")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.9", "9 - Move into & get eaten")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.10", "10 - Harvest")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.11", "11 - Area Guard")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.12", "12 - Return (to refinery)")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.13", "13 - Stop")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.14", "14 - Ambush (wait until discovered)")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.15", "15 - Hunt")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.16", "16 - Unload")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.17", "17 - Sabotage (move in & destroy)")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.18", "18 - Construction")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.19", "19 - Deconstruction")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.20", "20 - Repair")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.21", "21 - Rescue")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.22", "22 - Missile")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.23", "23 - Harmless")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.24", "24 - Open")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.25", "25 - Patrol")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.26", "26 - Paradrop approach drop zone")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.27", "27 - Paradrop overlay drop zone")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.28", "28 - Wait")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.29", "29 - Attack again")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.30", "30 - Spyplane approach")), i++); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Status.31", "31 - Spyplane overfly")), i++); } // 20 @@ -493,8 +494,8 @@ static void CScriptTypes_LoadParams_Boolean(ppmfc::CComboBox& comboBox) { comboBox.DeleteAllStrings(); - comboBox.SetItemData(comboBox.AddString("0 - FALSE"), 0); - comboBox.SetItemData(comboBox.AddString("1 - TRUE"), 1); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Boolean.0", "0 - FALSE")), 0); + comboBox.SetItemData(comboBox.AddString(Translations::TranslateOrDefault("ScriptParam.Boolean.1", "1 - TRUE")), 1); } }; \ No newline at end of file diff --git a/FA2sp/Ext/CTriggerOption/Hooks.cpp b/FA2sp/Ext/CTriggerOption/Hooks.cpp index c6a24e9..911d938 100644 --- a/FA2sp/Ext/CTriggerOption/Hooks.cpp +++ b/FA2sp/Ext/CTriggerOption/Hooks.cpp @@ -2,6 +2,8 @@ #include +#include "../../Helpers/Translations.h" + DEFINE_HOOK(502E66, CTriggerOption_OnInitDialog_RepeatTypeFix, 7) { GET(CTriggerOption*, pThis, ESI); @@ -9,9 +11,9 @@ DEFINE_HOOK(502E66, CTriggerOption_OnInitDialog_RepeatTypeFix, 7) pThis->CCBHouse.DeleteAllStrings(); pThis->CCBRepeatType.DeleteAllStrings(); - pThis->CCBRepeatType.AddString("0 - One Time OR"); - pThis->CCBRepeatType.AddString("1 - One Time AND"); - pThis->CCBRepeatType.AddString("2 - Repeating OR"); + pThis->CCBRepeatType.AddString(Translations::TranslateOrDefault("TriggerRepeatType.OneTimeOr", "0 - One Time OR")); + pThis->CCBRepeatType.AddString(Translations::TranslateOrDefault("TriggerRepeatType.OneTimeAnd", "1 - One Time AND")); + pThis->CCBRepeatType.AddString(Translations::TranslateOrDefault("TriggerRepeatType.RepeatingOr", "2 - Repeating OR")); return 0; } \ No newline at end of file diff --git a/FA2sp/Helpers/Translations.cpp b/FA2sp/Helpers/Translations.cpp index 645861a..8ec3fd9 100644 --- a/FA2sp/Helpers/Translations.cpp +++ b/FA2sp/Helpers/Translations.cpp @@ -55,6 +55,21 @@ bool Translations::GetTranslationItem(const char* pLabelName, ppmfc::CString& re return false; } +const char* Translations::TranslateOrDefault(const char* lpLabelName, const char* lpDefault) +{ + for (const auto& language : Translations::pLanguage) + { + if (auto section = CINI::FALanguage->GetSection(language)) + { + auto itr = section->GetEntities().find(lpLabelName); + if (itr != section->GetEntities().end()) + return itr->second; + } + } + + return lpDefault; +} + void Translations::TranslateItem(CWnd* pWnd, int nSubID, const char* lpKey) { ppmfc::CString buffer; diff --git a/FA2sp/Helpers/Translations.h b/FA2sp/Helpers/Translations.h index c7e6597..46e7efa 100644 --- a/FA2sp/Helpers/Translations.h +++ b/FA2sp/Helpers/Translations.h @@ -20,6 +20,7 @@ class Translations static void TranslateItem(CWnd* pWnd, const char* lpKey); static void TranslateItem(ppmfc::CWnd* pWnd, int nSubID, const char* lpKey) { TranslateItem((CWnd*)pWnd, nSubID, lpKey); } static void TranslateItem(ppmfc::CWnd* pWnd, const char* lpKey) { TranslateItem((CWnd*)pWnd, lpKey); }; + static const char* TranslateOrDefault(const char* lpLabelName, const char* lpDefault); static char pLanguage[4][0x400]; }; From 0a3a2ba6b85a1bd369b8d369c23f54b996827f52 Mon Sep 17 00:00:00 2001 From: secsome <302702960@qq.com> Date: Thu, 12 Jan 2023 21:15:52 +0800 Subject: [PATCH 5/5] Update product version macro and increase revision number --- FA2sp/FA2sp.Constants.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/FA2sp/FA2sp.Constants.h b/FA2sp/FA2sp.Constants.h index 198fae0..7c27ebc 100644 --- a/FA2sp/FA2sp.Constants.h +++ b/FA2sp/FA2sp.Constants.h @@ -5,10 +5,14 @@ #define PRODUCT_MAJOR 1 #define PRODUCT_MINOR 5 -#define PRODUCT_REVISION 0 -#define PRODUCT_HOTFIX 0 +#define PRODUCT_REVISION 1 + +#ifdef NDEBUG +#define PRODUCT_STR __str(PRODUCT_MAJOR) "." __str(PRODUCT_MINOR) "." __str(PRODUCT_REVISION) +#else +#define PRODUCT_STR __DATE__ " " __TIME__ +#endif -#define PRODUCT_STR __str(PRODUCT_MAJOR) "." __str(PRODUCT_MINOR) "." __str(PRODUCT_REVISION) "." __str(PRODUCT_HOTFIX) #define DISPLAY_STR PRODUCT_STR #define PRODUCT_NAME "FA2sp" #define VERSION_STRVER PRODUCT_NAME " " PRODUCT_STR