Browse Source

Project Manager Prevent Modules From Adding Bad Dependencies

Modules can no longer add themselves as a dependency (which blows up the system) and they also can't add modules that are already added. The add button disables if there are no modules to add.
Peter Robinson 3 years ago
parent
commit
f0d0d71bbb

+ 2 - 4
editor/ProjectManager/scripts/NewDependencyDialog.cs

@@ -59,11 +59,9 @@ function NewDependencyDialog::populateModuleDropDown(%this)
 {
 {
 	%this.moduleDropDown.clearItems();
 	%this.moduleDropDown.clearItems();
 
 
-	%allModules = ModuleDatabase.findModules(false);
-
-	for(%i = 0; %i < getWordCount(%allModules); %i++)
+	for(%i = 0; %i < getWordCount(%this.dependList); %i++)
 	{
 	{
-		%mod = getWord(%allModules, %i);
+		%mod = getWord(%this.dependList, %i);
 		if(%mod.ModuleID !$= "AppCore")
 		if(%mod.ModuleID !$= "AppCore")
 		{
 		{
 			if(%this.versionList[%mod.ModuleID] $= "")
 			if(%this.versionList[%mod.ModuleID] $= "")

+ 31 - 0
editor/ProjectManager/scripts/ProjectModuleDependList.cs

@@ -91,6 +91,7 @@ function ProjectModuleDependList::addDependItem(%this, %name, %version, %isSynce
 
 
 function ProjectModuleDependList::addAddButton(%this)
 function ProjectModuleDependList::addAddButton(%this)
 {
 {
+	%this.dependList = %this.buildPossibleDependList();
 	%width = 140;
 	%width = 140;
 	%addButton = new GuiButtonCtrl()
 	%addButton = new GuiButtonCtrl()
 	{
 	{
@@ -105,6 +106,7 @@ function ProjectModuleDependList::addAddButton(%this)
 		Align = "Center";
 		Align = "Center";
 		VAlign = "Middle";
 		VAlign = "Middle";
 		TextExtend = 1;
 		TextExtend = 1;
+		Active = (getWordCount(%this.dependList) > 0);
 	};
 	};
 	ThemeManager.setProfile(%addButton, "subListProfile");
 	ThemeManager.setProfile(%addButton, "subListProfile");
 	%this.add(%addButton);
 	%this.add(%addButton);
@@ -127,6 +129,7 @@ function ProjectModuleDependList::onAddDepend(%this)
 		dialogSize = (%width + 8) SPC (%height + 8);
 		dialogSize = (%width + 8) SPC (%height + 8);
 		dialogCanClose = true;
 		dialogCanClose = true;
 		dialogText = "New Dependency";
 		dialogText = "New Dependency";
+		dependList = %this.dependList;
 	};
 	};
 	%dialog.init(%width, %height);
 	%dialog.init(%width, %height);
 	%this.startListening(%dialog);
 	%this.startListening(%dialog);
@@ -158,3 +161,31 @@ function ProjectModuleDependList::deleteDialog(%this)
 {
 {
 	%this.dialog.delete();
 	%this.dialog.delete();
 }
 }
+
+function ProjectModuleDependList::buildPossibleDependList(%this)
+{
+	%allModules = ModuleDatabase.findModules(false);
+	%list = "";
+	for(%i = 0; %i < getWordCount(%allModules); %i++)
+	{
+		%mod = getWord(%allModules, %i);
+		if(%mod.ModuleID !$= "AppCore" && %mod.ModuleID !$= %this.activeModule.ModuleID)
+		{
+			%hasDep = false;
+			for(%j = 0; %j < %this.activeModule.getdependencyCount(); %j++)
+			{
+				%dep = %this.activeModule.getDependency(%j);
+				if(getWord(%dep, 0) $= %mod.ModuleID)
+				{
+					%hasDep = true;
+				}
+			}
+
+			if(!%hasDep)
+			{
+				%list = %list SPC %mod;
+			}
+		}
+	}
+	return trim(%list);
+}

+ 1 - 0
library/Audio/audio.cs

@@ -13,6 +13,7 @@ function Audio::create(%this)
 
 
 function Audio::destroy( %this )
 function Audio::destroy( %this )
 {
 {
+	alxStopAll();
 	OpenALShutdownDriver();
 	OpenALShutdownDriver();
 }
 }
 
 

+ 1 - 1
library/Audio/module.taml

@@ -1,7 +1,7 @@
 <ModuleDefinition
 <ModuleDefinition
 	ModuleId="Audio"
 	ModuleId="Audio"
 	VersionId="1"
 	VersionId="1"
-	BuildID="1"
+	BuildID="2"
 	Synchronized="1"
 	Synchronized="1"
 	Description="Provides basic audio functionality for music and sound effects."
 	Description="Provides basic audio functionality for music and sound effects."
 	ScriptFile="audio.cs"
 	ScriptFile="audio.cs"