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();
|
||||
@@ -203,10 +204,10 @@ namespace OpenRA.Editor
|
||||
Height = bitmap.Height / 2,
|
||||
SizeMode = PictureBoxSizeMode.StretchImage
|
||||
};
|
||||
|
||||
|
||||
var brushTemplate = new BrushTemplate { Bitmap = bitmap, N = t.Key };
|
||||
ibox.Click += (_, e) => surface1.SetTool(new BrushTool(brushTemplate));
|
||||
|
||||
|
||||
var template = t.Value;
|
||||
tilePalette.Controls.Add(ibox);
|
||||
tt.SetToolTip(ibox, "{1}:{0} ({2}x{3})".F(template.Image, template.Id, template.Size.X, template.Size.Y));
|
||||
@@ -463,7 +464,7 @@ namespace OpenRA.Editor
|
||||
void ExportMinimap(object sender, EventArgs e)
|
||||
{
|
||||
using (var sfd = new SaveFileDialog()
|
||||
{
|
||||
{
|
||||
InitialDirectory = Path.Combine(Environment.CurrentDirectory, "maps"),
|
||||
DefaultExt = "*.png",
|
||||
Filter = "PNG Image (*.png)|*.png",
|
||||
@@ -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)
|
||||
@@ -637,7 +637,7 @@ namespace OpenRA.Editor
|
||||
{
|
||||
ShowGridClicked(sender, e);
|
||||
}
|
||||
|
||||
|
||||
public int CalculateTotalResource()
|
||||
{
|
||||
var totalResource = 0;
|
||||
@@ -651,7 +651,7 @@ namespace OpenRA.Editor
|
||||
|
||||
return totalResource;
|
||||
}
|
||||
|
||||
|
||||
int GetAdjecentCellsWith(int resourceType, int x, int y)
|
||||
{
|
||||
var sum = 0;
|
||||
|
||||
@@ -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