From c706a46dc4aada97848f6056ed23a34e31d98751 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Tue, 15 Aug 2023 22:44:49 +0300 Subject: [PATCH] ESM4::RACE: fix loading more than 5 head parts in FO4 --- components/esm4/loadrace.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/esm4/loadrace.cpp b/components/esm4/loadrace.cpp index 1b568379dd..a2da871a4a 100644 --- a/components/esm4/loadrace.cpp +++ b/components/esm4/loadrace.cpp @@ -287,7 +287,7 @@ void ESM4::Race::load(ESM4::Reader& reader) } else if (isTES4) mHeadParts.resize(9); // assumed based on Construction Set - else + else // Optimized for TES5 { mHeadPartIdsMale.resize(5); mHeadPartIdsFemale.resize(5); @@ -593,9 +593,17 @@ void ESM4::Race::load(ESM4::Reader& reader) { // FIXME: no order? head, mouth, eyes, brow, hair if (isMale) + { + if (currentIndex >= mHeadPartIdsMale.size()) + mHeadPartIdsMale.resize(currentIndex + 1); mHeadPartIdsMale[currentIndex] = formId; + } else + { + if (currentIndex >= mHeadPartIdsFemale.size()) + mHeadPartIdsFemale.resize(currentIndex + 1); mHeadPartIdsFemale[currentIndex] = formId; + } } // std::cout << mEditorId << (isMale ? " male head " : " female head ")