(bf037f9b0) Don't allow deleting vanilla subs or subs that are a part of some content package

This commit is contained in:
Joonas Rikkonen
2019-04-08 13:36:58 +03:00
parent 1ffe3e4ec0
commit 9594ea67a7
2 changed files with 37 additions and 2 deletions
@@ -416,6 +416,21 @@ namespace Barotrauma
}
}
public bool IsVanillaSubmarine()
{
var vanilla = GameMain.VanillaContent;
if (vanilla != null)
{
var vanillaSubs = vanilla.GetFilesOfType(ContentType.Submarine);
string pathToCompare = filePath.Replace(@"\", @"/").ToLowerInvariant();
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").ToLowerInvariant() == pathToCompare))
{
return true;
}
}
return false;
}
public void CheckForErrors()
{
List<string> errorMsgs = new List<string>();