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;
|
||||
currentMod = toolStripComboBox1.SelectedItem as string;
|
||||
|
||||
Game.InitializeSettings(Arguments.Empty);
|
||||
Game.modData = new ModData(currentMod);
|
||||
GlobalFileSystem.LoadFromManifest(Game.modData.Manifest);
|
||||
Program.Rules = Game.modData.RulesetCache.LoadDefaultRules();
|
||||
@@ -471,9 +472,8 @@ namespace OpenRA.Editor
|
||||
FileName = Path.ChangeExtension(loadedMapName, ".png"),
|
||||
RestoreDirectory = true
|
||||
})
|
||||
|
||||
if (DialogResult.OK == sfd.ShowDialog())
|
||||
miniMapBox.Image.Save(sfd.FileName);
|
||||
if (DialogResult.OK == sfd.ShowDialog())
|
||||
miniMapBox.Image.Save(sfd.FileName);
|
||||
}
|
||||
|
||||
void ShowActorNamesClicked(object sender, EventArgs e)
|
||||
|
||||
@@ -175,13 +175,18 @@ namespace OpenRA
|
||||
public static Modifiers GetModifierKeys() { return modifiers; }
|
||||
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)
|
||||
{
|
||||
Console.WriteLine("Platform is {0}", Platform.CurrentPlatform);
|
||||
|
||||
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
|
||||
|
||||
Settings = new Settings(Platform.ResolvePath("^", "settings.yaml"), args);
|
||||
InitializeSettings(args);
|
||||
|
||||
Log.AddChannel("perf", "perf.log");
|
||||
Log.AddChannel("debug", "debug.log");
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Graphics
|
||||
}
|
||||
|
||||
public SheetBuilder(SheetType t)
|
||||
: this(t, Game.Renderer.SheetSize) { }
|
||||
: this(t, Game.Settings.Graphics.SheetSize) { }
|
||||
|
||||
public SheetBuilder(SheetType t, int 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));
|
||||
|
||||
AppDomain.CurrentDomain.AssemblyResolve += GlobalFileSystem.ResolveAssembly;
|
||||
Game.Renderer = new Graphics.Renderer(
|
||||
new GraphicSettings() { Renderer = "Null", NumTempBuffers = 0, SheetSize = 0 },
|
||||
new ServerSettings());
|
||||
Game.InitializeSettings(Arguments.Empty);
|
||||
Game.modData = new ModData(mod);
|
||||
|
||||
IEnumerable<Map> maps;
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace OpenRA.Utility
|
||||
return;
|
||||
}
|
||||
|
||||
Game.InitializeSettings(Arguments.Empty);
|
||||
var modData = new ModData(modName);
|
||||
args = args.Skip(1).ToArray();
|
||||
var actions = new Dictionary<string, Action<ModData, string[]>>();
|
||||
|
||||
Reference in New Issue
Block a user