From b6debbd8e99b6eda362db129177da3acda63ec84 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 28 Feb 2017 22:49:33 +1100 Subject: [PATCH] Fix importing maps with upper case letters on linux. (Thanks Daeslender) --- MCGalaxy/Levels/IO/LvlProperties.cs | 2 +- MCGalaxy/Levels/Level.cs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/MCGalaxy/Levels/IO/LvlProperties.cs b/MCGalaxy/Levels/IO/LvlProperties.cs index 08fcc5053..aa2e89a28 100644 --- a/MCGalaxy/Levels/IO/LvlProperties.cs +++ b/MCGalaxy/Levels/IO/LvlProperties.cs @@ -45,7 +45,7 @@ namespace MCGalaxy.Levels.IO { } public static void LoadEnv(Level level) { - string path = "levels/level properties/" + level.MapName.ToLower() + ".env"; + string path = "levels/level properties/" + level.MapName + ".env"; PropertiesFile.Read(path, ref level, EnvLineProcessor); } diff --git a/MCGalaxy/Levels/Level.cs b/MCGalaxy/Levels/Level.cs index 67f80a921..0bbe89f47 100644 --- a/MCGalaxy/Levels/Level.cs +++ b/MCGalaxy/Levels/Level.cs @@ -74,7 +74,7 @@ namespace MCGalaxy { for (int i = 0; i < CustomBlockProps.Length; i++) CustomBlockProps[i] = BlockDefinition.GlobalProps[i]; - name = n; MapName = n; + name = n; MapName = n.ToLower(); BlockDB = new BlockDB(this); EdgeLevel = (short)(y / 2); CloudsHeight = (short)(y + 2); @@ -232,8 +232,10 @@ namespace MCGalaxy { public static Level FindExact(string name) { return LevelInfo.FindExact(name); } public static void SaveSettings(Level lvl) { + if (lvl.IsMuseum) return; // museums do not save properties + lock (lvl.savePropsLock) - LvlProperties.Save(lvl, LevelInfo.PropertiesPath(lvl.name)); + LvlProperties.Save(lvl, LevelInfo.PropertiesPath(lvl.MapName)); } // Returns true if ListCheck does not already have an check in the position. @@ -243,8 +245,9 @@ namespace MCGalaxy { } public void Save(bool Override = false, bool clearPhysics = false) { - if (blocks == null) return; - string path = LevelInfo.MapPath(name); + if (blocks == null || IsMuseum) return; // museums do not save properties + + string path = LevelInfo.MapPath(MapName); if (LevelSave != null) LevelSave(this); OnLevelSaveEvent.Call(this); if (cancelsave1) { cancelsave1 = false; return; }