From 9f2c7c850d5329e8823937253ff5f32d35be1987 Mon Sep 17 00:00:00 2001 From: Shiny Metagross <30511800+ShinyMetagross@users.noreply.github.com> Date: Thu, 30 Jun 2022 22:38:57 -0700 Subject: [PATCH] Update p_actionfunctions.cpp - Let's fix some of the compile warnings - We don't want to include models that were already parsed by modelDef, or already in savedModelFiles --- src/playsim/p_actionfunctions.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 626dce04b..94e283f70 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -5076,27 +5076,25 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeModel) mobj->modelData->modelIDs.Insert(index, queryModel); mobj->modelData->skinIDs.Insert(index, skin != NAME_None ? LoadSkin(skinpath.GetChars(), skin.GetChars()) : FNullTextureID()); - //[SM] - We need to serialize file paths and model names so that they are pushed on loading save files. + //[SM] - We need to serialize file paths and model names so that they are pushed on loading save files. Likewise, let's not include models that were already parsed when initialized. if (model != NAME_None) { FString fullName; fullName.Format("%s%s", modelpath, model.GetChars()); bool allowPush = true; - for (unsigned i = 0; i < savedModelFiles.Size(); i++) - if (!savedModelFiles[i].CompareNoCase(fullName)) allowPush = false; + for (unsigned i = 0; i < savedModelFiles.Size(); i++) if (!savedModelFiles[i].CompareNoCase(fullName)) allowPush = false; + for (unsigned i = 0; i < Models.Size()-1; i++) if (!Models[i]->mFileName.CompareNoCase(fullName)) allowPush = false; if(allowPush) savedModelFiles.Push(fullName); } //[SM] - if an indice of modelIDs or skinIDs comes up blank and it's the last one, just delete it. For using very large amounts of indices, common sense says to just not run this repeatedly. - int i = 0; - - for (i = 0; i < maxModels; i++) + for (int i = 0; i < maxModels; i++) { if (mobj->modelData->modelIDs.Last() == -1) mobj->modelData->modelIDs.Pop(mobj->modelData->modelIDs.Last()); else break; } - for (i = 0; i < maxSkins; i++) + for (int i = 0; i < maxSkins; i++) { if (mobj->modelData->skinIDs.Last() == FNullTextureID()) mobj->modelData->skinIDs.Pop(mobj->modelData->skinIDs.Last()); else break;