Made SheetBuilder rely on global settings rather than global renderer.
Additionally exposed an InitializeSettings method on game to initialize the global settings so that other classes can set up all the secret dependencies on the global settings required.
This commit is contained in:
@@ -46,6 +46,7 @@ namespace OpenRA.Editor
|
|||||||
miniMapBox.Image = null;
|
miniMapBox.Image = null;
|
||||||
currentMod = toolStripComboBox1.SelectedItem as string;
|
currentMod = toolStripComboBox1.SelectedItem as string;
|
||||||
|
|
||||||
|
Game.InitializeSettings(Arguments.Empty);
|
||||||
Game.modData = new ModData(currentMod);
|
Game.modData = new ModData(currentMod);
|
||||||
GlobalFileSystem.LoadFromManifest(Game.modData.Manifest);
|
GlobalFileSystem.LoadFromManifest(Game.modData.Manifest);
|
||||||
Program.Rules = Game.modData.RulesetCache.LoadDefaultRules();
|
Program.Rules = Game.modData.RulesetCache.LoadDefaultRules();
|
||||||
@@ -471,7 +472,6 @@ namespace OpenRA.Editor
|
|||||||
FileName = Path.ChangeExtension(loadedMapName, ".png"),
|
FileName = Path.ChangeExtension(loadedMapName, ".png"),
|
||||||
RestoreDirectory = true
|
RestoreDirectory = true
|
||||||
})
|
})
|
||||||
|
|
||||||
if (DialogResult.OK == sfd.ShowDialog())
|
if (DialogResult.OK == sfd.ShowDialog())
|
||||||
miniMapBox.Image.Save(sfd.FileName);
|
miniMapBox.Image.Save(sfd.FileName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,13 +175,18 @@ namespace OpenRA
|
|||||||
public static Modifiers GetModifierKeys() { return modifiers; }
|
public static Modifiers GetModifierKeys() { return modifiers; }
|
||||||
internal static void HandleModifierKeys(Modifiers mods) { modifiers = mods; }
|
internal static void HandleModifierKeys(Modifiers mods) { modifiers = mods; }
|
||||||
|
|
||||||
|
public static void InitializeSettings(Arguments args)
|
||||||
|
{
|
||||||
|
Settings = new Settings(Platform.ResolvePath("^", "settings.yaml"), args);
|
||||||
|
}
|
||||||
|
|
||||||
internal static void Initialize(Arguments args)
|
internal static void Initialize(Arguments args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Platform is {0}", Platform.CurrentPlatform);
|
Console.WriteLine("Platform is {0}", Platform.CurrentPlatform);
|
||||||
|
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
|
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
|
||||||
|
|
||||||
Settings = new Settings(Platform.ResolvePath("^", "settings.yaml"), args);
|
InitializeSettings(args);
|
||||||
|
|
||||||
Log.AddChannel("perf", "perf.log");
|
Log.AddChannel("perf", "perf.log");
|
||||||
Log.AddChannel("debug", "debug.log");
|
Log.AddChannel("debug", "debug.log");
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace OpenRA.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SheetBuilder(SheetType t)
|
public SheetBuilder(SheetType t)
|
||||||
: this(t, Game.Renderer.SheetSize) { }
|
: this(t, Game.Settings.Graphics.SheetSize) { }
|
||||||
|
|
||||||
public SheetBuilder(SheetType t, int sheetSize)
|
public SheetBuilder(SheetType t, int sheetSize)
|
||||||
: this(t, () => AllocateSheet(sheetSize)) { }
|
: this(t, () => AllocateSheet(sheetSize)) { }
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ namespace OpenRA.Lint
|
|||||||
FieldLoader.UnknownFieldAction = (s, f) => EmitError("FieldLoader: Missing field `{0}` on `{1}`".F(s, f.Name));
|
FieldLoader.UnknownFieldAction = (s, f) => EmitError("FieldLoader: Missing field `{0}` on `{1}`".F(s, f.Name));
|
||||||
|
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
|
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
|
||||||
Game.Renderer = new Graphics.Renderer(
|
Game.InitializeSettings(Arguments.Empty);
|
||||||
new GraphicSettings() { Renderer = "Null", NumTempBuffers = 0, SheetSize = 0 },
|
|
||||||
new ServerSettings());
|
|
||||||
Game.modData = new ModData(mod);
|
Game.modData = new ModData(mod);
|
||||||
|
|
||||||
IEnumerable<Map> maps;
|
IEnumerable<Map> maps;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace OpenRA.Utility
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Game.InitializeSettings(Arguments.Empty);
|
||||||
var modData = new ModData(modName);
|
var modData = new ModData(modName);
|
||||||
args = args.Skip(1).ToArray();
|
args = args.Skip(1).ToArray();
|
||||||
var actions = new Dictionary<string, Action<ModData, string[]>>();
|
var actions = new Dictionary<string, Action<ModData, string[]>>();
|
||||||
|
|||||||
Reference in New Issue
Block a user