From 5f983bbb3f0462f6100704b0bca2dcea08b15fcf Mon Sep 17 00:00:00 2001 From: kdsystem1337 <65427854+kdsystem1337@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:48:53 +0100 Subject: [PATCH 1/5] Fix CSettlers4Api::RemoveSelection --- S4ModApi/CS4Selection.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/S4ModApi/CS4Selection.cpp b/S4ModApi/CS4Selection.cpp index 66b8298..3760818 100644 --- a/S4ModApi/CS4Selection.cpp +++ b/S4ModApi/CS4Selection.cpp @@ -46,7 +46,7 @@ BOOL CSettlers4Api::GetSelection(PWORD out, SIZE_T outlen, PSIZE_T selectionCoun auto elementsToCopy = min(ct, outlen); if (selectionCount) *selectionCount = ct; LOG("s->BasePtr == " << HEXNUM(s->BasePtr)) - if (out && elementsToCopy) memget_s(out, s->BasePtr, elementsToCopy * sizeof(*s->BasePtr)); + if (out && elementsToCopy) memget_s(out, s->BasePtr, elementsToCopy * sizeof(*s->BasePtr)); return TRUE; } @@ -59,9 +59,8 @@ BOOL CSettlers4Api::RemoveSelection(PWORD settlers, SIZE_T settlerslen, PSIZE_T } auto& s = S4::GetInstance().Selection; if (!s) return FALSE; - auto ppool = S4::GetInstance().EntityPool; - if (!ppool) return FALSE; - auto pool = *ppool; + auto pool = S4::GetInstance().EntityPool; + if (!pool) return FALSE; // build a set for settlers to remove std::unordered_set removeSet; @@ -74,7 +73,7 @@ BOOL CSettlers4Api::RemoveSelection(PWORD settlers, SIZE_T settlerslen, PSIZE_T auto cur = s->BasePtr; for (auto sp = cur; sp < end; ++sp) { if (removeSet.find(*sp) != removeSet.end()) { - pool[*sp].clrSelectionVisibility(); + pool[*sp]->clrSelectionVisibility(); continue; } *cur = *sp; From 82a17b5e22417ee22168b437d109d667d2c29ea9 Mon Sep 17 00:00:00 2001 From: kdsystem1337 <65427854+kdsystem1337@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:49:11 +0100 Subject: [PATCH 2/5] updated to latest platform toolset --- S4ModApi.sln | 7 ++---- S4ModApi/S4ModApi.vcxproj | 50 +++------------------------------------ 2 files changed, 5 insertions(+), 52 deletions(-) diff --git a/S4ModApi.sln b/S4ModApi.sln index 90da351..6850144 100644 --- a/S4ModApi.sln +++ b/S4ModApi.sln @@ -1,21 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29503.13 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34714.143 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "S4ModApi", "S4ModApi\S4ModApi.vcxproj", "{80F4B5D7-9AB1-4DA7-B3A9-C13241352964}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 - Debug142|x86 = Debug142|x86 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {80F4B5D7-9AB1-4DA7-B3A9-C13241352964}.Debug|x86.ActiveCfg = Debug|Win32 {80F4B5D7-9AB1-4DA7-B3A9-C13241352964}.Debug|x86.Build.0 = Debug|Win32 - {80F4B5D7-9AB1-4DA7-B3A9-C13241352964}.Debug142|x86.ActiveCfg = Debug142|Win32 - {80F4B5D7-9AB1-4DA7-B3A9-C13241352964}.Debug142|x86.Build.0 = Debug142|Win32 {80F4B5D7-9AB1-4DA7-B3A9-C13241352964}.Release|x86.ActiveCfg = Release|Win32 {80F4B5D7-9AB1-4DA7-B3A9-C13241352964}.Release|x86.Build.0 = Release|Win32 EndGlobalSection diff --git a/S4ModApi/S4ModApi.vcxproj b/S4ModApi/S4ModApi.vcxproj index 01009bf..460c32d 100644 --- a/S4ModApi/S4ModApi.vcxproj +++ b/S4ModApi/S4ModApi.vcxproj @@ -1,10 +1,6 @@  - - Debug142 - Win32 - Debug Win32 @@ -20,22 +16,18 @@ Win32Proj S4Hooks S4ModApi + 10.0 DynamicLibrary true - v141_xp - - - DynamicLibrary - true - v142 + v143 DynamicLibrary false - v141_xp + v143 false @@ -46,9 +38,6 @@ - - - @@ -60,13 +49,6 @@ $(ProjectDir)lib;$(SourcePath) AllRules.ruleset - - true - $(ProjectDir)lib\lua321\Release\;$(ProjectDir)lib\$(Configuration)\;$(LibraryPath) - $(ProjectDir)lib\lua321\include\;$(ProjectDir)lib\;$(VC_IncludePath);$(WindowsSDK_IncludePath); - $(ProjectDir)lib;$(SourcePath) - AllRules.ruleset - false $(ProjectDir)lib\lua321\Release\;$(ProjectDir)lib\$(Configuration)\;$(LibraryPath) @@ -100,32 +82,6 @@ true - - - Level4 - Disabled - true - WIN32;S4MODAPI;_DEBUG;S4MODAPI_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - MultiThreadedDebug - true - false - ProgramDatabase - /D_WIN32_WINNT=0x0501 %(AdditionalOptions) - - - Windows - true - false - Enabled - Precompiled.lib;Lua321.lib;%(AdditionalDependencies) - - - if exist "$(OutDir)deploy.bat" (call "$(OutDir)deploy.bat" ) - - - true - - Level4 From 345d6c10c933202415f22b97642168db52340ef1 Mon Sep 17 00:00:00 2001 From: kdsystem1337 <65427854+kdsystem1337@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:49:26 +0100 Subject: [PATCH 3/5] updated to 2.3.2 --- S4ModApi/S4ModApi.rc | Bin 5234 -> 5312 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/S4ModApi/S4ModApi.rc b/S4ModApi/S4ModApi.rc index 6b0351fb44522a1c6f342512ffe85c9ad1b8c0ec..72f530566ee941fe92d11e81e349835d6e56fbda 100644 GIT binary patch delta 143 zcmeyQaX@p!0cJrBhCGH;hEj$Sh9ZVUh8zaX$%(?kn=debV`Ma%e4N#g(P;Be*6&O} z&PR^h>IMwD3`PtFKy1RG0MuE@kOtJ3&EUY0&XCJc!Jr2=tz_~-cJavtoMM}QaY}*A S`N$!?*npc6hh+{tMjQYc$0X_i delta 66 zcmX@0`AK8L0p`tDnAw;Z4JY4bHDom0%**y2#PR2ro~*!mfYE63Mh@N0CR|dCKslfw T Date: Fri, 29 Mar 2024 17:56:10 +0100 Subject: [PATCH 4/5] Fix Formatter --- S4ModApi/CS4Selection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/S4ModApi/CS4Selection.cpp b/S4ModApi/CS4Selection.cpp index 3760818..d220977 100644 --- a/S4ModApi/CS4Selection.cpp +++ b/S4ModApi/CS4Selection.cpp @@ -45,8 +45,8 @@ BOOL CSettlers4Api::GetSelection(PWORD out, SIZE_T outlen, PSIZE_T selectionCoun auto ct = s->count(); auto elementsToCopy = min(ct, outlen); if (selectionCount) *selectionCount = ct; - LOG("s->BasePtr == " << HEXNUM(s->BasePtr)) - if (out && elementsToCopy) memget_s(out, s->BasePtr, elementsToCopy * sizeof(*s->BasePtr)); + LOG("s->BasePtr == " << HEXNUM(s->BasePtr)); + if (out && elementsToCopy) memget_s(out, s->BasePtr, elementsToCopy * sizeof(*s->BasePtr)); return TRUE; } From 6e9709dff5abf9297a1a2dacf5de9e8ce22c8287 Mon Sep 17 00:00:00 2001 From: kdsystem1337 <65427854+kdsystem1337@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:02:25 +0100 Subject: [PATCH 5/5] Update Lib --- Examples/HelloWorld/HelloWorld/S4ModApi.lib | Bin 30118 -> 30118 bytes Examples/LuaExample/LuaExample/S4ModApi.lib | Bin 30118 -> 30118 bytes .../SelectionLimitExample/S4ModApi.lib | Bin 30118 -> 30118 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Examples/HelloWorld/HelloWorld/S4ModApi.lib b/Examples/HelloWorld/HelloWorld/S4ModApi.lib index 32a7de30e460b43855a1ac38cb16496546d51423..92fc658b0d54aa6ff8946a0ff93f59ce02ea8d81 100644 GIT binary patch delta 412 zcmbu4OG^S_7=_O_P1sNgLXi;NeLBAtpF4TU=3x}G z$nY$1znq>(`iNh~9WCG27ytB7L_hd9Ct5;(&wf|x)ACCp(8lb8pC z@V7niA3bFp71IpDm`3P_r52-&q862pI+J};Fw||B8y`DpKpUoyk*uiVvq&kwO6OjW v(7;Q-ty1^0cIv6s9>}gaNc6{lTkd8fCyuAD>eR1YH-jf_ur=l8K-u>Vu%C9? delta 416 zcmbu4yGuf07{;IPc)|{qgp1)(JW-~!xJao-8e1AVOLot+i(M?Utn6aiZD|tT2FF6M zvEU1e{t26cmIxY+prF|lZEb1$@!a4klvts}ZaxIwr|V+$E@-5AHGV5THBnfR>CxOw z-NrTwDxKtVNc3WtDWf>3Y?ms!%(F(P#LrsYjNi*SMoH^AX;x=i&ww!uV+5l}U=v%2 zVGVI?BZ(bEF@psxVhPKbM+9@2#ROI{junJ4jY)*Cjtxv9h&>!(A4537E{>5x0H1S)WZ9fs7cBXUcMPBKO3oC?V-=!gec=KPBEW@ yvL3fk!3&=`|LS24f#>qq16frYiN45h%2i7w#njcnH(Au{no(3c>Q!#==e$4Az;{~! diff --git a/Examples/LuaExample/LuaExample/S4ModApi.lib b/Examples/LuaExample/LuaExample/S4ModApi.lib index 32a7de30e460b43855a1ac38cb16496546d51423..92fc658b0d54aa6ff8946a0ff93f59ce02ea8d81 100644 GIT binary patch delta 412 zcmbu4OG^S_7=_O_P1sNgLXi;NeLBAtpF4TU=3x}G z$nY$1znq>(`iNh~9WCG27ytB7L_hd9Ct5;(&wf|x)ACCp(8lb8pC z@V7niA3bFp71IpDm`3P_r52-&q862pI+J};Fw||B8y`DpKpUoyk*uiVvq&kwO6OjW v(7;Q-ty1^0cIv6s9>}gaNc6{lTkd8fCyuAD>eR1YH-jf_ur=l8K-u>Vu%C9? delta 416 zcmbu4yGuf07{;IPc)|{qgp1)(JW-~!xJao-8e1AVOLot+i(M?Utn6aiZD|tT2FF6M zvEU1e{t26cmIxY+prF|lZEb1$@!a4klvts}ZaxIwr|V+$E@-5AHGV5THBnfR>CxOw z-NrTwDxKtVNc3WtDWf>3Y?ms!%(F(P#LrsYjNi*SMoH^AX;x=i&ww!uV+5l}U=v%2 zVGVI?BZ(bEF@psxVhPKbM+9@2#ROI{junJ4jY)*Cjtxv9h&>!(A4537E{>5x0H1S)WZ9fs7cBXUcMPBKO3oC?V-=!gec=KPBEW@ yvL3fk!3&=`|LS24f#>qq16frYiN45h%2i7w#njcnH(Au{no(3c>Q!#==e$4Az;{~! diff --git a/Examples/SelectionLimitExample/SelectionLimitExample/S4ModApi.lib b/Examples/SelectionLimitExample/SelectionLimitExample/S4ModApi.lib index 32a7de30e460b43855a1ac38cb16496546d51423..92fc658b0d54aa6ff8946a0ff93f59ce02ea8d81 100644 GIT binary patch delta 412 zcmbu4OG^S_7=_O_P1sNgLXi;NeLBAtpF4TU=3x}G z$nY$1znq>(`iNh~9WCG27ytB7L_hd9Ct5;(&wf|x)ACCp(8lb8pC z@V7niA3bFp71IpDm`3P_r52-&q862pI+J};Fw||B8y`DpKpUoyk*uiVvq&kwO6OjW v(7;Q-ty1^0cIv6s9>}gaNc6{lTkd8fCyuAD>eR1YH-jf_ur=l8K-u>Vu%C9? delta 416 zcmbu4yGuf07{;IPc)|{qgp1)(JW-~!xJao-8e1AVOLot+i(M?Utn6aiZD|tT2FF6M zvEU1e{t26cmIxY+prF|lZEb1$@!a4klvts}ZaxIwr|V+$E@-5AHGV5THBnfR>CxOw z-NrTwDxKtVNc3WtDWf>3Y?ms!%(F(P#LrsYjNi*SMoH^AX;x=i&ww!uV+5l}U=v%2 zVGVI?BZ(bEF@psxVhPKbM+9@2#ROI{junJ4jY)*Cjtxv9h&>!(A4537E{>5x0H1S)WZ9fs7cBXUcMPBKO3oC?V-=!gec=KPBEW@ yvL3fk!3&=`|LS24f#>qq16frYiN45h%2i7w#njcnH(Au{no(3c>Q!#==e$4Az;{~!