From 3e32f6db11681da8492e1af1195ad0b48ff447fc Mon Sep 17 00:00:00 2001 From: AlexMog Date: Tue, 23 Feb 2021 18:54:47 +0100 Subject: [PATCH] Added missing configuration --- Longship/Managers/ConfigurationManager.cs | 2 ++ Longship/Patches/PatchServerInfo.cs | 16 +++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Longship/Managers/ConfigurationManager.cs b/Longship/Managers/ConfigurationManager.cs index 513c21b..7b46ebf 100644 --- a/Longship/Managers/ConfigurationManager.cs +++ b/Longship/Managers/ConfigurationManager.cs @@ -37,6 +37,8 @@ public override void Init() "WARNING: This value WILL allow the server to use more bandwith. So be careful.\n" + "Info: The value is in bytes (in this configuration, that means that the server is limited " + "to ~250 Ko/s)"); + Configuration.WorldName = _pluginConfigFile.Bind("Server", "WorldName", "Dedicated", + "Name of the world to use"); } } } diff --git a/Longship/Patches/PatchServerInfo.cs b/Longship/Patches/PatchServerInfo.cs index 91b1b10..0b49705 100644 --- a/Longship/Patches/PatchServerInfo.cs +++ b/Longship/Patches/PatchServerInfo.cs @@ -23,16 +23,14 @@ static void PatchZNetAwake(ref int ___m_serverPlayerLimit) [HarmonyPatch(typeof(FejdStartup), "ParseServerArguments")] static bool PatchFejdStartupParseServerArguments(FejdStartup __instance, ref bool __result) { - string[] commandLineArgs = Environment.GetCommandLineArgs(); - string name = Longship.Instance.ConfigurationManager.Configuration.WorldName.Value; - for (int index = 0; index < commandLineArgs.Length; ++index) + var commandLineArgs = Environment.GetCommandLineArgs(); + var name = Longship.Instance.ConfigurationManager.Configuration.WorldName.Value; + for (var index = 0; index < commandLineArgs.Length; ++index) { - string str1 = commandLineArgs[index]; - if (str1 == "-savedir") - { - Utils.SetSaveDataPath(commandLineArgs[index + 1]); - ++index; - } + var str1 = commandLineArgs[index]; + if (str1 != "-savedir") continue; + Utils.SetSaveDataPath(commandLineArgs[index + 1]); + ++index; } var createWorld = World.GetCreateWorld(name); var password = Longship.Instance.ConfigurationManager.Configuration.ServerPassword.Value;