Skip to content

Commit

Permalink
Check script names as backup after editing SC
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonx254 committed Jul 17, 2024
1 parent e01fddb commit c4be882
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions RetroEDv2/tools/sceneeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,12 @@ SceneEditor::SceneEditor(QWidget *parent) : QWidget(parent), ui(new Ui::SceneEdi

int count = stageConfig.loadGlobalScripts ? gameConfig.objects.count() : 0;
int oldListCount = ui->objectList->count();

QList<QString> oldScriptName;
oldScriptName.append("Blank Object");
for (int i = 0; i < stageConfig.objects.count(); i++)
oldScriptName.append(stageConfig.objects[i].script);

switch (viewer->gameType) {
case ENGINE_v4: {
StageConfigEditorv4 *edit =
Expand Down Expand Up @@ -856,6 +862,8 @@ SceneEditor::SceneEditor(QWidget *parent) : QWidget(parent), ui(new Ui::SceneEdi
int id = count + 1;
for (FormatHelpers::StageConfig::ObjectInfo &stageObj : stageConfig.objects) {
int index = names.indexOf(stageObj.name);
if (index < 0)
index = oldScriptName.indexOf(stageObj.script);

SceneObject objInfo;
objInfo.name = stageObj.name;
Expand Down

0 comments on commit c4be882

Please sign in to comment.