Quellcode durchsuchen

Fixes issue where nested callOnModules would thrash the queued exec lists from other invokes
Also removes unwanted reference ids from the OptionsMenu gui object and disabled the ability for dynamic fields to be saved on it to prevent it from happening again.

JeffR vor 3 Jahren
Ursprung
Commit
f204a4c646

+ 29 - 17
Templates/BaseGame/game/core/utility/scripts/module.tscript

@@ -6,7 +6,8 @@ if (!isObject(ExecFilesList))
 function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
 function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
 {   
 {   
    //clear per module group file execution chain
    //clear per module group file execution chain
-   ExecFilesList.empty();
+   %execArray = new ArrayObject("callOn" @ %functionName @ "_" @ %moduleGroup);
+   ExecFilesList.push_back(%execArray);
    //Get our modules so we can exec any specific client-side loading/handling
    //Get our modules so we can exec any specific client-side loading/handling
    %modulesList = ModuleDatabase.findModules(false);
    %modulesList = ModuleDatabase.findModules(false);
    for(%i=0; %i < getWordCount(%modulesList); %i++)
    for(%i=0; %i < getWordCount(%modulesList); %i++)
@@ -23,12 +24,21 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3,
         %module.scopeSet.call(%functionName, %var0, %var1, %var2, %var3, %var4, %var5, %var6);
         %module.scopeSet.call(%functionName, %var0, %var1, %var2, %var3, %var4, %var5, %var6);
    }
    }
    
    
-   %execFilecount = ExecFilesList.count();
+   %execFilecount = %execArray.count();
+   
+   if($traceModuleCalls)
+   {
+      error("ExecFilesList at actual exec point:");
+      %execArray.echo();
+   }
+   
    for (%i=0;%i<%execFilecount;%i++)
    for (%i=0;%i<%execFilecount;%i++)
    {
    {
-        %filename = ExecFilesList.getKey(%i);
+        %filename = %execArray.getKey(%i);
         exec(%filename);
         exec(%filename);
    }
    }
+   
+   ExecFilesList.pop_back(); //cleanup
 }
 }
 
 
 function loadModuleMaterials(%moduleGroup)
 function loadModuleMaterials(%moduleGroup)
@@ -213,7 +223,7 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
       return;
       return;
    }
    }
    
    
-   if(!isObject(ExecFilesList))
+   if(!isObject(ExecFilesList) || ExecFilesList.count() == 0)
    {
    {
       error("Module::queueExec() - ExecFilesList array object doesn't exist!");
       error("Module::queueExec() - ExecFilesList array object doesn't exist!");
       return;
       return;
@@ -225,10 +235,11 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
    %fullPath = pathConcat(%moduleDef.ModulePath, %execFilePath);
    %fullPath = pathConcat(%moduleDef.ModulePath, %execFilePath);
    ///go through all entries
    ///go through all entries
    %locked = false;
    %locked = false;
-   %execFilecount = ExecFilesList.count();
+   %execFileList = ExecFilesList.getKey(ExecFilesList.count()-1);
+   %execFilecount = %execFileList.count();
    for (%i=0;%i<%execFilecount;%i++)
    for (%i=0;%i<%execFilecount;%i++)
    {
    {
-        %check = ExecFilesList.getKey(%i);
+        %check = %execFileList.getKey(%i);
         //look for a substring match
         //look for a substring match
         %isMatch = strIsMatchExpr("*"@ strReplace(%execFilePath,"./","/"),%check );
         %isMatch = strIsMatchExpr("*"@ strReplace(%execFilePath,"./","/"),%check );
         if (%isMatch)
         if (%isMatch)
@@ -237,13 +248,13 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
             //and kill off any duplicates
             //and kill off any duplicates
             //do note that doing it in this order means setting exclusive twice
             //do note that doing it in this order means setting exclusive twice
             //allows one to override exclusive with exclusive
             //allows one to override exclusive with exclusive
-            %locked = ExecFilesList.getValue(%i);
+            %locked = %execFileList.getValue(%i);
             if ((%locked && !%isExclusive)&&($reportModuleFileConflicts))
             if ((%locked && !%isExclusive)&&($reportModuleFileConflicts))
                 error("found" SPC %execFilePath SPC "duplicate file!");
                 error("found" SPC %execFilePath SPC "duplicate file!");
             if (%isExclusive)
             if (%isExclusive)
             { // Replacing an existing entry, update in-place
             { // Replacing an existing entry, update in-place
-                ExecFilesList.setKey(%fullPath, %i);
-                ExecFilesList.setValue(%isExclusive, %i);
+                %execFileList.setKey(%fullPath, %i);
+                %execFileList.setValue(%isExclusive, %i);
                 %locked = true; //Done, but don't return and bypass trace logging below
                 %locked = true; //Done, but don't return and bypass trace logging below
             }
             }
             break;
             break;
@@ -251,9 +262,9 @@ function SimSet::queueExec(%scopeSet, %execFilePath, %isExclusive)
    }
    }
    //if we're not locked, go ahead and add it to the pile
    //if we're not locked, go ahead and add it to the pile
    if (!%locked)
    if (!%locked)
-       ExecFilesList.add(%fullPath,%isExclusive);
+       %execFileList.add(%fullPath,%isExclusive);
    if ($traceModuleCalls)       
    if ($traceModuleCalls)       
-      ExecFilesList.echo();
+      %execFileList.echo();
 }
 }
 
 
 function SimSet::unQueueExec(%scopeSet, %execFilePath)
 function SimSet::unQueueExec(%scopeSet, %execFilePath)
@@ -269,7 +280,7 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath)
       return;
       return;
    }
    }
    
    
-   if(!isObject(ExecFilesList))
+   if(!isObject(ExecFilesList) || ExecFilesList.count() == 0)
    {
    {
       error("Module::unRegisterDatablock() - ExecFilesList array object doesn't exist!");
       error("Module::unRegisterDatablock() - ExecFilesList array object doesn't exist!");
       return;
       return;
@@ -280,23 +291,24 @@ function SimSet::unQueueExec(%scopeSet, %execFilePath)
    %fullPath = pathConcat(%moduleDef.ModulePath, %relativePath);
    %fullPath = pathConcat(%moduleDef.ModulePath, %relativePath);
    ///go through all entries
    ///go through all entries
    %locked = false;
    %locked = false;
-   %execFilecount = ExecFilesList.count();
+   %execFileList = ExecFilesList.getKey(ExecFilesList.count()-1);
+   %execFilecount = %execFileList.count();
    for (%i=0;%i<%execFilecount;%i++)
    for (%i=0;%i<%execFilecount;%i++)
    {
    {
-        %check = ExecFilesList.getKey(%i);
+        %check = %execFileList.getKey(%i);
         //look for a substring match
         //look for a substring match
         %isMatch = strIsMatchExpr("*"@ %execFilePath,%check );
         %isMatch = strIsMatchExpr("*"@ %execFilePath,%check );
         if (%isMatch)
         if (%isMatch)
         {
         {
             //check if we're already locked in. if not, kill it.
             //check if we're already locked in. if not, kill it.
-            %locked = ExecFilesList.getValue(%i);
+            %locked = %execFileList.getValue(%i);
             if (!%locked)
             if (!%locked)
             {
             {
-                ExecFilesList.erase(%i);
+                %execFileList.erase(%i);
             }
             }
         }
         }
    }
    }
    if ($traceModuleCalls)
    if ($traceModuleCalls)
-      ExecFilesList.echo();
+      %execFileList.echo();
 }
 }
 
 

+ 1 - 9
Templates/BaseGame/game/data/UI/guis/optionsMenu.gui

@@ -4,15 +4,7 @@ $guiContent = new GuiControl(OptionsMenu) {
    profile = "GuiDefaultProfile";
    profile = "GuiDefaultProfile";
    tooltipProfile = "GuiToolTipProfile";
    tooltipProfile = "GuiToolTipProfile";
    isContainer = "1";
    isContainer = "1";
-   canSaveDynamicFields = "1";
-      currentCategory = "Display";
-      optionsCategories = "17177";
-      pageTabIndex = "0";
-      returnGui = "MainMenuGui";
-      tamlReader = "20088";
-      tile = "0";
-      unappliedChanges = "17178";
-      useVariable = "0";
+   canSaveDynamicFields = "0";
 
 
    new GuiControl() {
    new GuiControl() {
       position = "48 56";
       position = "48 56";