Skip to content

Commit 078acb6

Browse files
committed
Prevent swapping if leveled item has encounter zone and was skipped
1 parent a569602 commit 078acb6

6 files changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
FOMOD_AE_DESCR: 'Select this if you are using Skyrim Anniversary Edition v1.6.1130 or higher (latest update).'
3131
FOMOD_AE_MIN_GAME_VERSION: '1.6.1130.0'
3232
PUBLISH_ARCHIVE_TYPE: '7z'
33-
VCPKG_COMMIT_ID: 'b8ac6696e3af59f4f0666ab81a48ae589cde00a8'
33+
VCPKG_COMMIT_ID: '41626fd77bf42f29e8f7e43dc1f2f05780588cde'

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.20)
22
set(NAME "po3_BaseObjectSwapper" CACHE STRING "")
3-
set(VERSION 3.3.0 CACHE STRING "")
3+
set(VERSION 3.3.1 CACHE STRING "")
44
set(VR_VERSION 1)
55
set(AE_VERSION 1)
66

extern/CommonLibSSE

Submodule CommonLibSSE updated 845 files

extern/CommonLibVR

Submodule CommonLibVR updated 3488 files

src/Manager.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,25 +217,27 @@ namespace FormSwap
217217
return { nullptr, std::nullopt };
218218
};
219219

220+
// references -> conditional forms -> forms
220221
if (!a_ref->IsDynamicForm()) {
221222
swapData = get_swap_base(a_ref, swapRefs);
222223
}
223-
224224
if (!swapData.first) {
225225
swapData = GetSwapFormConditional(a_ref, a_base);
226226
}
227-
228227
if (!swapData.first) {
229228
swapData = get_swap_base(a_base, swapForms);
230229
}
231230

231+
// process leveled swaps. do not swap if leveled item has encounter zone
232232
if (const auto swapLvlBase = swapData.first ? swapData.first->As<RE::TESLevItem>() : nullptr) {
233233
if (a_ref->GetEncounterZone() == nullptr) {
234234
RE::BSScrapArray<RE::CALCED_OBJECT> calcedObjects{};
235235
swapLvlBase->CalculateCurrentFormList(a_ref->GetCalcLevel(false), 1, calcedObjects, 0, true);
236236
if (!calcedObjects.empty()) {
237237
swapData.first = static_cast<RE::TESBoundObject*>(calcedObjects.front().form);
238238
}
239+
} else {
240+
swapData.first = nullptr;
239241
}
240242
}
241243

@@ -255,14 +257,13 @@ namespace FormSwap
255257
return a_result && a_result->IsValid();
256258
};
257259

260+
// references -> conditional forms -> forms
258261
if (!has_properties(swapData.second) && !a_ref->IsDynamicForm()) {
259262
swapData.second = get_properties(a_ref);
260263
}
261-
262264
if (!has_properties(swapData.second)) {
263265
swapData.second = GetObjectPropertiesConditional(a_ref, a_base);
264266
}
265-
266267
if (!has_properties(swapData.second)) {
267268
swapData.second = get_properties(a_base);
268269
}

vcpkg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "base-object-swapper",
3-
"version-string": "3.3.0",
3+
"version-string": "3.3.1",
44
"description": "Base Object Swapper",
55
"homepage": "",
66
"license": "MIT",
@@ -13,5 +13,5 @@
1313
"unordered-dense",
1414
"xbyak"
1515
],
16-
"builtin-baseline": "b8ac6696e3af59f4f0666ab81a48ae589cde00a8"
16+
"builtin-baseline": "41626fd77bf42f29e8f7e43dc1f2f05780588cde"
1717
}

0 commit comments

Comments
 (0)