settings stuff
This commit is contained in:
@@ -26,7 +26,7 @@ namespace OpenRa.Game.GameRules
|
||||
public readonly string Replay = "";
|
||||
|
||||
// Gameplay options
|
||||
public readonly bool RepairRequiresConyard = false;
|
||||
public readonly bool RepairRequiresConyard = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using OpenRa.FileFormats;
|
||||
using OpenRa.Game.GameRules;
|
||||
using OpenRa.Game.Graphics;
|
||||
using OpenRa.Game.Orders;
|
||||
using OpenRa.Game.GameRules;
|
||||
|
||||
|
||||
namespace OpenRa.Game
|
||||
@@ -31,51 +31,33 @@ namespace OpenRa.Game
|
||||
[DllImport("user32")]
|
||||
static extern int ShowCursor([MarshalAs(UnmanagedType.Bool)] bool visible);
|
||||
|
||||
|
||||
|
||||
public MainWindow(Settings settings)
|
||||
{
|
||||
|
||||
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
BackColor = Color.Black;
|
||||
StartPosition = FormStartPosition.Manual;
|
||||
Location = Point.Empty;
|
||||
Visible = true;
|
||||
|
||||
// Load user settings
|
||||
Game.Settings = new UserSettings();
|
||||
|
||||
while (!File.Exists("redalert.mix"))
|
||||
{
|
||||
var current = Directory.GetCurrentDirectory();
|
||||
if (Directory.GetDirectoryRoot(current) == current)
|
||||
throw new InvalidOperationException("Unable to load MIX files.");
|
||||
Directory.SetCurrentDirectory("..");
|
||||
|
||||
try
|
||||
{
|
||||
// settings.ini should be located with the mix files
|
||||
FileSystem.MountTemporary(new Folder("./"));
|
||||
IniFile SettingsRules = new IniFile(FileSystem.Open("settings.ini"));
|
||||
FieldLoader.Load(Game.Settings, SettingsRules.GetSection("Settings"));
|
||||
FileSystem.UnmountTemporaryPackages();
|
||||
}
|
||||
catch (FileNotFoundException) { }
|
||||
}
|
||||
|
||||
LoadUserSettings(settings);
|
||||
|
||||
UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug;
|
||||
UiOverlay.ShowBuildDebug = Game.Settings.BuildingDebug;
|
||||
WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug;
|
||||
Renderer.SheetSize = Game.Settings.SheetSize;
|
||||
|
||||
|
||||
FileSystem.MountDefaultPackages();
|
||||
|
||||
if (Game.Settings.UseAftermath)
|
||||
{
|
||||
FileSystem.MountAftermathPackages();
|
||||
}
|
||||
|
||||
bool windowed = !Game.Settings.Fullscreen;
|
||||
renderer = new Renderer(this, GetResolution(settings), windowed);
|
||||
@@ -89,6 +71,19 @@ namespace OpenRa.Game
|
||||
Game.ResetTimer();
|
||||
}
|
||||
|
||||
static void LoadUserSettings(Settings settings)
|
||||
{
|
||||
Game.Settings = new UserSettings();
|
||||
var settingsFile = settings.GetValue("settings", "settings.ini");
|
||||
// if (FileSystem.Exists(settingsFile))
|
||||
{
|
||||
FileSystem.MountTemporary(new Folder("./"));
|
||||
FieldLoader.Load(Game.Settings,
|
||||
new IniFile(FileSystem.Open(settingsFile)).GetSection("Settings"));
|
||||
FileSystem.UnmountTemporaryPackages();
|
||||
}
|
||||
}
|
||||
|
||||
internal void Run()
|
||||
{
|
||||
while (Created && Visible)
|
||||
|
||||
3
settings-netplay-local.ini
Normal file
3
settings-netplay-local.ini
Normal file
@@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
NetworkHost=localhost
|
||||
NetworkPort=1234
|
||||
Reference in New Issue
Block a user