(f6e171bd5) Fixed: Server not buildable in DebugMac configuration

This commit is contained in:
Joonas Rikkonen
2019-06-13 11:44:59 +03:00
parent a34a6bf1db
commit 45bce243bf
2 changed files with 42 additions and 0 deletions

View File

@@ -894,6 +894,47 @@ namespace Barotrauma
return configFile;
}
private static IEnumerable<string> characterConfigFiles;
private static IEnumerable<string> CharacterConfigFiles
{
#if SERVER
if (GameMain.Server != null && IsRemotePlayer)
{
if (characterConfigFiles == null)
{
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
}
return characterConfigFiles;
}
}
/// <summary>
/// Searches for a character config file from all currently selected content packages,
/// or from a specific package if the contentPackage parameter is given.
/// </summary>
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
{
string configFile = null;
if (contentPackage == null)
{
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
}
else
{
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
}
if (configFile == null)
{
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
return string.Empty;
}
return configFile;
}
private static IEnumerable<string> characterConfigFiles;
private static IEnumerable<string> CharacterConfigFiles
{

View File

@@ -338,6 +338,7 @@ Global
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|x64
{85232B20-074D-4723-B0C6-91495391E448}.DebugMac|Any CPU.Build.0 = DebugMac|x64
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x64.ActiveCfg = Debug|Any CPU