Merge pull request #11005 from pchote/server
Extract dedicated server interface to OpenRA.Server.exe
This commit is contained in:
42
Makefile
42
Makefile
@@ -87,7 +87,7 @@ INSTALL_PROGRAM = $(INSTALL) -m755
|
|||||||
INSTALL_DATA = $(INSTALL) -m644
|
INSTALL_DATA = $(INSTALL) -m644
|
||||||
|
|
||||||
# program targets
|
# program targets
|
||||||
CORE = pdefault pnull game utility
|
CORE = pdefault game utility server
|
||||||
TOOLS = gamemonitor
|
TOOLS = gamemonitor
|
||||||
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
|
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
|
||||||
|
|
||||||
@@ -119,14 +119,8 @@ pdefault_TARGET = OpenRA.Platforms.Default.dll
|
|||||||
pdefault_KIND = library
|
pdefault_KIND = library
|
||||||
pdefault_DEPS = $(game_TARGET)
|
pdefault_DEPS = $(game_TARGET)
|
||||||
pdefault_LIBS = $(COMMON_LIBS) thirdparty/download/SDL2-CS.dll thirdparty/download/OpenAL-CS.dll $(pdefault_DEPS)
|
pdefault_LIBS = $(COMMON_LIBS) thirdparty/download/SDL2-CS.dll thirdparty/download/OpenAL-CS.dll $(pdefault_DEPS)
|
||||||
|
PROGRAMS += pdefault
|
||||||
pnull_SRCS := $(shell find OpenRA.Platforms.Null/ -iname '*.cs')
|
platforms: $(pdefault_TARGET)
|
||||||
pnull_TARGET = OpenRA.Platforms.Null.dll
|
|
||||||
pnull_KIND = library
|
|
||||||
pnull_DEPS = $(game_TARGET)
|
|
||||||
pnull_LIBS = $(COMMON_LIBS) $(pnull_DEPS)
|
|
||||||
PROGRAMS += pdefault pnull
|
|
||||||
platforms: $(pdefault_TARGET) $(pnull_TARGET)
|
|
||||||
|
|
||||||
# Mods Common
|
# Mods Common
|
||||||
mod_common_SRCS := $(shell find OpenRA.Mods.Common/ -iname '*.cs')
|
mod_common_SRCS := $(shell find OpenRA.Mods.Common/ -iname '*.cs')
|
||||||
@@ -202,9 +196,6 @@ check: utility mods
|
|||||||
@echo "Checking for code style violations in OpenRA.Platforms.Default..."
|
@echo "Checking for code style violations in OpenRA.Platforms.Default..."
|
||||||
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default
|
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Default
|
||||||
@echo
|
@echo
|
||||||
@echo "Checking for code style violations in OpenRA.Platforms.Null..."
|
|
||||||
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Platforms.Null
|
|
||||||
@echo
|
|
||||||
@echo "Checking for code style violations in OpenRA.GameMonitor..."
|
@echo "Checking for code style violations in OpenRA.GameMonitor..."
|
||||||
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.GameMonitor
|
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.GameMonitor
|
||||||
@echo
|
@echo
|
||||||
@@ -231,6 +222,9 @@ check: utility mods
|
|||||||
@echo
|
@echo
|
||||||
@echo "Checking for explicit interface violations..."
|
@echo "Checking for explicit interface violations..."
|
||||||
@mono --debug OpenRA.Utility.exe all --check-explicit-interfaces
|
@mono --debug OpenRA.Utility.exe all --check-explicit-interfaces
|
||||||
|
@echo
|
||||||
|
@echo "Checking for code style violations in OpenRA.Server..."
|
||||||
|
@mono --debug OpenRA.Utility.exe ra --check-code-style OpenRA.Server
|
||||||
|
|
||||||
NUNIT_CONSOLE := $(shell test -f thirdparty/download/nunit3-console.exe && echo mono thirdparty/download/nunit3-console.exe || \
|
NUNIT_CONSOLE := $(shell test -f thirdparty/download/nunit3-console.exe && echo mono thirdparty/download/nunit3-console.exe || \
|
||||||
which nunit3-console 2>/dev/null || which nunit2-console 2>/dev/null || which nunit-console 2>/dev/null)
|
which nunit3-console 2>/dev/null || which nunit2-console 2>/dev/null || which nunit-console 2>/dev/null)
|
||||||
@@ -286,6 +280,15 @@ utility_LIBS = $(COMMON_LIBS) $(utility_DEPS) thirdparty/download/ICSharpCode.Sh
|
|||||||
PROGRAMS += utility
|
PROGRAMS += utility
|
||||||
utility: $(utility_TARGET)
|
utility: $(utility_TARGET)
|
||||||
|
|
||||||
|
# Dedicated server
|
||||||
|
server_SRCS := $(shell find OpenRA.Server/ -iname '*.cs')
|
||||||
|
server_TARGET = OpenRA.Server.exe
|
||||||
|
server_KIND = exe
|
||||||
|
server_DEPS = $(game_TARGET)
|
||||||
|
server_LIBS = $(COMMON_LIBS) $(server_DEPS)
|
||||||
|
PROGRAMS += server
|
||||||
|
server: $(server_TARGET)
|
||||||
|
|
||||||
# Patches binary headers to work around a mono bug
|
# Patches binary headers to work around a mono bug
|
||||||
fixheader.exe: packaging/fixheader.cs
|
fixheader.exe: packaging/fixheader.cs
|
||||||
@echo CSC fixheader.exe
|
@echo CSC fixheader.exe
|
||||||
@@ -315,7 +318,7 @@ $(foreach prog,$(PROGRAMS),$(eval $(call BUILD_ASSEMBLY,$(prog))))
|
|||||||
#
|
#
|
||||||
default: core
|
default: core
|
||||||
|
|
||||||
core: game platforms mods utility
|
core: game platforms mods utility server
|
||||||
|
|
||||||
tools: gamemonitor
|
tools: gamemonitor
|
||||||
|
|
||||||
@@ -465,9 +468,22 @@ endif
|
|||||||
@$(INSTALL_PROGRAM) -m +rx openra "$(BIN_INSTALL_DIR)"
|
@$(INSTALL_PROGRAM) -m +rx openra "$(BIN_INSTALL_DIR)"
|
||||||
@-$(RM) openra
|
@-$(RM) openra
|
||||||
|
|
||||||
|
@echo "#!/bin/sh" > openra-server
|
||||||
|
@echo 'cd "$(gameinstalldir)"' >> openra-server
|
||||||
|
ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
|
||||||
|
@echo 'mono OpenRA.Server.exe "$$@"' >> openra-server
|
||||||
|
else
|
||||||
|
@echo 'mono --debug OpenRA.Server.exe "$$@"' >> openra-server
|
||||||
|
endif
|
||||||
|
|
||||||
|
@$(INSTALL_DIR) "$(BIN_INSTALL_DIR)"
|
||||||
|
@$(INSTALL_PROGRAM) -m +rx openra-server "$(BIN_INSTALL_DIR)"
|
||||||
|
@-$(RM) openra-server
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@-$(RM_R) "$(DATA_INSTALL_DIR)"
|
@-$(RM_R) "$(DATA_INSTALL_DIR)"
|
||||||
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra"
|
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra"
|
||||||
|
@-$(RM_F) "$(BIN_INSTALL_DIR)/openra-server"
|
||||||
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra.desktop"
|
@-$(RM_F) "$(DESTDIR)$(datadir)/applications/openra.desktop"
|
||||||
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/openra.png"
|
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/16x16/apps/openra.png"
|
||||||
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/openra.png"
|
@-$(RM_F) "$(DESTDIR)$(datadir)/icons/hicolor/32x32/apps/openra.png"
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sound = new Sound(Settings.Server.Dedicated ? "Null" : Settings.Sound.Engine);
|
Sound = new Sound(Settings.Sound.Engine);
|
||||||
|
|
||||||
GlobalChat = new GlobalChat();
|
GlobalChat = new GlobalChat();
|
||||||
|
|
||||||
@@ -341,17 +341,11 @@ namespace OpenRA
|
|||||||
|
|
||||||
Sound.StopVideo();
|
Sound.StopVideo();
|
||||||
|
|
||||||
ModData = new ModData(mod, !Settings.Server.Dedicated);
|
ModData = new ModData(mod, true);
|
||||||
|
|
||||||
using (new PerfTimer("LoadMaps"))
|
using (new PerfTimer("LoadMaps"))
|
||||||
ModData.MapCache.LoadMaps();
|
ModData.MapCache.LoadMaps();
|
||||||
|
|
||||||
if (Settings.Server.Dedicated)
|
|
||||||
{
|
|
||||||
RunDedicatedServer();
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var installData = ModData.Manifest.Get<ContentInstaller>();
|
var installData = ModData.Manifest.Get<ContentInstaller>();
|
||||||
var isModContentInstalled = installData.TestFiles.All(f => File.Exists(Platform.ResolvePath(f)));
|
var isModContentInstalled = installData.TestFiles.All(f => File.Exists(Platform.ResolvePath(f)));
|
||||||
|
|
||||||
@@ -398,37 +392,6 @@ namespace OpenRA
|
|||||||
ModData.LoadScreen.StartGame(args);
|
ModData.LoadScreen.StartGame(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RunDedicatedServer()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
Settings.Server.Map = WidgetUtils.ChooseInitialMap(Settings.Server.Map);
|
|
||||||
Settings.Save();
|
|
||||||
CreateServer(Settings.Server.Clone());
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
Thread.Sleep(100);
|
|
||||||
|
|
||||||
if (server.State == Server.ServerState.GameStarted && server.Conns.Count < 1)
|
|
||||||
{
|
|
||||||
Console.WriteLine("No one is playing, shutting down...");
|
|
||||||
server.Shutdown();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings.Server.DedicatedLoop)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Starting a new server instance...");
|
|
||||||
ModData.MapCache.LoadMaps();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void LoadEditor(string mapUid)
|
public static void LoadEditor(string mapUid)
|
||||||
{
|
{
|
||||||
StartGame(mapUid, WorldType.Editor);
|
StartGame(mapUid, WorldType.Editor);
|
||||||
@@ -811,7 +774,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static void CreateServer(ServerSettings settings)
|
public static void CreateServer(ServerSettings settings)
|
||||||
{
|
{
|
||||||
server = new Server.Server(new IPEndPoint(IPAddress.Any, settings.ListenPort), settings, ModData);
|
server = new Server.Server(new IPEndPoint(IPAddress.Any, settings.ListenPort), settings, ModData, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int CreateLocalServer(string map)
|
public static int CreateLocalServer(string map)
|
||||||
@@ -824,7 +787,7 @@ namespace OpenRA
|
|||||||
AllowPortForward = false
|
AllowPortForward = false
|
||||||
};
|
};
|
||||||
|
|
||||||
server = new Server.Server(new IPEndPoint(IPAddress.Loopback, 0), settings, ModData);
|
server = new Server.Server(new IPEndPoint(IPAddress.Loopback, 0), settings, ModData, false);
|
||||||
|
|
||||||
return server.Port;
|
return server.Port;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using System.Threading;
|
|||||||
using OpenRA.FileSystem;
|
using OpenRA.FileSystem;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
|
using OpenRA.Support;
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
@@ -81,7 +82,7 @@ namespace OpenRA
|
|||||||
if (!modData.Manifest.Contains<MapGrid>())
|
if (!modData.Manifest.Contains<MapGrid>())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var mapGrid = Game.ModData.Manifest.Get<MapGrid>();
|
var mapGrid = modData.Manifest.Get<MapGrid>();
|
||||||
foreach (var kv in MapLocations)
|
foreach (var kv in MapLocations)
|
||||||
{
|
{
|
||||||
foreach (var map in kv.Key.Contents)
|
foreach (var map in kv.Key.Contents)
|
||||||
@@ -237,6 +238,18 @@ namespace OpenRA
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string ChooseInitialMap(string initialUid, MersenneTwister random)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(initialUid) || previews[initialUid].Status != MapStatus.Available)
|
||||||
|
{
|
||||||
|
var selected = previews.Values.Where(x => x.SuitableForInitialMap).RandomOrDefault(random) ??
|
||||||
|
previews.Values.First(m => m.Status == MapStatus.Available && m.Visibility.HasFlag(MapVisibility.Lobby));
|
||||||
|
return selected.Uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return initialUid;
|
||||||
|
}
|
||||||
|
|
||||||
public MapPreview this[string key]
|
public MapPreview this[string key]
|
||||||
{
|
{
|
||||||
get { return previews[key]; }
|
get { return previews[key]; }
|
||||||
|
|||||||
@@ -50,16 +50,12 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var resolution = GetResolution(graphicSettings);
|
var resolution = GetResolution(graphicSettings);
|
||||||
|
|
||||||
var rendererName = serverSettings.Dedicated ? "Null" : graphicSettings.Renderer;
|
var rendererName = graphicSettings.Renderer;
|
||||||
var rendererPath = Platform.ResolvePath(Path.Combine(".", "OpenRA.Platforms." + rendererName + ".dll"));
|
var rendererPath = Platform.ResolvePath(Path.Combine(".", "OpenRA.Platforms." + rendererName + ".dll"));
|
||||||
|
|
||||||
Device = CreateDevice(Assembly.LoadFile(rendererPath), resolution.Width, resolution.Height, graphicSettings.Mode);
|
Device = CreateDevice(Assembly.LoadFile(rendererPath), resolution.Width, resolution.Height, graphicSettings.Mode);
|
||||||
|
TempBufferSize = graphicSettings.BatchSize;
|
||||||
if (!serverSettings.Dedicated)
|
SheetSize = graphicSettings.SheetSize;
|
||||||
{
|
|
||||||
TempBufferSize = graphicSettings.BatchSize;
|
|
||||||
SheetSize = graphicSettings.SheetSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp"));
|
WorldSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("shp"));
|
||||||
WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
|
WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace OpenRA.Server
|
|||||||
public readonly IPAddress Ip;
|
public readonly IPAddress Ip;
|
||||||
public readonly int Port;
|
public readonly int Port;
|
||||||
public readonly MersenneTwister Random = new MersenneTwister();
|
public readonly MersenneTwister Random = new MersenneTwister();
|
||||||
|
public readonly bool Dedicated;
|
||||||
|
|
||||||
// Valid player connections
|
// Valid player connections
|
||||||
public List<Connection> Conns = new List<Connection>();
|
public List<Connection> Conns = new List<Connection>();
|
||||||
@@ -117,7 +118,7 @@ namespace OpenRA.Server
|
|||||||
t.GameEnded(this);
|
t.GameEnded(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Server(IPEndPoint endpoint, ServerSettings settings, ModData modData)
|
public Server(IPEndPoint endpoint, ServerSettings settings, ModData modData, bool dedicated)
|
||||||
{
|
{
|
||||||
Log.AddChannel("server", "server.log");
|
Log.AddChannel("server", "server.log");
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ namespace OpenRA.Server
|
|||||||
var localEndpoint = (IPEndPoint)listener.LocalEndpoint;
|
var localEndpoint = (IPEndPoint)listener.LocalEndpoint;
|
||||||
Ip = localEndpoint.Address;
|
Ip = localEndpoint.Address;
|
||||||
Port = localEndpoint.Port;
|
Port = localEndpoint.Port;
|
||||||
|
Dedicated = dedicated;
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
|
|
||||||
Settings.Name = OpenRA.Settings.SanitizedServerName(Settings.Name);
|
Settings.Name = OpenRA.Settings.SanitizedServerName(Settings.Name);
|
||||||
@@ -148,7 +149,7 @@ namespace OpenRA.Server
|
|||||||
RandomSeed = randomSeed,
|
RandomSeed = randomSeed,
|
||||||
Map = settings.Map,
|
Map = settings.Map,
|
||||||
ServerName = settings.Name,
|
ServerName = settings.Name,
|
||||||
Dedicated = settings.Dedicated,
|
Dedicated = dedicated,
|
||||||
DisableSingleplayer = settings.DisableSinglePlayer,
|
DisableSingleplayer = settings.DisableSinglePlayer,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -380,7 +381,7 @@ namespace OpenRA.Server
|
|||||||
// Send initial ping
|
// Send initial ping
|
||||||
SendOrderTo(newConn, "Ping", Game.RunTime.ToString(CultureInfo.InvariantCulture));
|
SendOrderTo(newConn, "Ping", Game.RunTime.ToString(CultureInfo.InvariantCulture));
|
||||||
|
|
||||||
if (Settings.Dedicated)
|
if (Dedicated)
|
||||||
{
|
{
|
||||||
var motdFile = Platform.ResolvePath("^", "motd.txt");
|
var motdFile = Platform.ResolvePath("^", "motd.txt");
|
||||||
if (!File.Exists(motdFile))
|
if (!File.Exists(motdFile))
|
||||||
@@ -418,7 +419,7 @@ namespace OpenRA.Server
|
|||||||
int latency = 1;
|
int latency = 1;
|
||||||
if (!LobbyInfo.IsSinglePlayer)
|
if (!LobbyInfo.IsSinglePlayer)
|
||||||
{
|
{
|
||||||
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>();
|
var gameSpeeds = ModData.Manifest.Get<GameSpeeds>();
|
||||||
GameSpeed speed;
|
GameSpeed speed;
|
||||||
if (gameSpeeds.Speeds.TryGetValue(LobbyInfo.GlobalSettings.GameSpeedType, out speed))
|
if (gameSpeeds.Speeds.TryGetValue(LobbyInfo.GlobalSettings.GameSpeedType, out speed))
|
||||||
latency = speed.OrderLatency;
|
latency = speed.OrderLatency;
|
||||||
@@ -490,7 +491,7 @@ namespace OpenRA.Server
|
|||||||
{
|
{
|
||||||
DispatchOrdersToClients(null, 0, new ServerOrder("Message", text).Serialize());
|
DispatchOrdersToClients(null, 0, new ServerOrder("Message", text).Serialize());
|
||||||
|
|
||||||
if (Settings.Dedicated)
|
if (Dedicated)
|
||||||
Console.WriteLine("[{0}] {1}".F(DateTime.Now.ToString(Settings.TimestampFormat), text));
|
Console.WriteLine("[{0}] {1}".F(DateTime.Now.ToString(Settings.TimestampFormat), text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +588,7 @@ namespace OpenRA.Server
|
|||||||
|
|
||||||
// Client was the server admin
|
// Client was the server admin
|
||||||
// TODO: Reassign admin for game in progress via an order
|
// TODO: Reassign admin for game in progress via an order
|
||||||
if (LobbyInfo.GlobalSettings.Dedicated && dropClient.IsAdmin && State == ServerState.WaitingPlayers)
|
if (Dedicated && dropClient.IsAdmin && State == ServerState.WaitingPlayers)
|
||||||
{
|
{
|
||||||
// Remove any bots controlled by the admin
|
// Remove any bots controlled by the admin
|
||||||
LobbyInfo.Clients.RemoveAll(c => c.Bot != null && c.BotControllerClientIndex == toDrop.PlayerIndex);
|
LobbyInfo.Clients.RemoveAll(c => c.Bot != null && c.BotControllerClientIndex == toDrop.PlayerIndex);
|
||||||
@@ -607,10 +608,10 @@ namespace OpenRA.Server
|
|||||||
if (!Conns.Any())
|
if (!Conns.Any())
|
||||||
TempBans.Clear();
|
TempBans.Clear();
|
||||||
|
|
||||||
if (Conns.Any() || LobbyInfo.GlobalSettings.Dedicated)
|
if (Conns.Any() || Dedicated)
|
||||||
SyncLobbyClients();
|
SyncLobbyClients();
|
||||||
|
|
||||||
if (!LobbyInfo.GlobalSettings.Dedicated && dropClient.IsAdmin)
|
if (!Dedicated && dropClient.IsAdmin)
|
||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,12 +76,6 @@ namespace OpenRA
|
|||||||
[Desc("Value in milliseconds when to terminate the game. Needs to be at least 10000 (10 s) to enable the timer.")]
|
[Desc("Value in milliseconds when to terminate the game. Needs to be at least 10000 (10 s) to enable the timer.")]
|
||||||
public int TimeOut = 0;
|
public int TimeOut = 0;
|
||||||
|
|
||||||
[Desc("Run in headless mode with an empty renderer and without sound output.")]
|
|
||||||
public bool Dedicated = false;
|
|
||||||
|
|
||||||
[Desc("Automatically restart when a game ends. Disable this when something else already takes care about it.")]
|
|
||||||
public bool DedicatedLoop = true;
|
|
||||||
|
|
||||||
[Desc("Disallow games where only one player plays with bots.")]
|
[Desc("Disallow games where only one player plays with bots.")]
|
||||||
public bool DisableSinglePlayer = false;
|
public bool DisableSinglePlayer = false;
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
var defaultDevices = new[]
|
var defaultDevices = new[]
|
||||||
{
|
{
|
||||||
new SoundDevice("Default", null, "Default Output"),
|
|
||||||
new SoundDevice("Null", null, "Output Disabled")
|
new SoundDevice("Null", null, "Output Disabled")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -248,18 +248,6 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
return trimmed;
|
return trimmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ChooseInitialMap(string initialUid)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(initialUid) || Game.ModData.MapCache[initialUid].Status != MapStatus.Available)
|
|
||||||
{
|
|
||||||
var selected = Game.ModData.MapCache.Where(x => x.SuitableForInitialMap).RandomOrDefault(Game.CosmeticRandom) ??
|
|
||||||
Game.ModData.MapCache.First(m => m.Status == MapStatus.Available && m.Visibility.HasFlag(MapVisibility.Lobby));
|
|
||||||
return selected.Uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
return initialUid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CachedTransform<T, U>
|
public class CachedTransform<T, U>
|
||||||
|
|||||||
@@ -719,7 +719,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>();
|
var gameSpeeds = server.ModData.Manifest.Get<GameSpeeds>();
|
||||||
|
|
||||||
GameSpeed speed;
|
GameSpeed speed;
|
||||||
if (!gameSpeeds.Speeds.TryGetValue(s, out speed))
|
if (!gameSpeeds.Speeds.TryGetValue(s, out speed))
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
lastPing = Game.RunTime;
|
lastPing = Game.RunTime;
|
||||||
|
|
||||||
// Ignore client timeout in singleplayer games to make debugging easier
|
// Ignore client timeout in singleplayer games to make debugging easier
|
||||||
if (server.LobbyInfo.IsSinglePlayer && !server.Settings.Dedicated)
|
if (server.LobbyInfo.IsSinglePlayer && !server.Dedicated)
|
||||||
foreach (var c in server.Conns.ToList())
|
foreach (var c in server.Conns.ToList())
|
||||||
server.SendOrderTo(c, "Ping", Game.RunTime.ToString());
|
server.SendOrderTo(c, "Ping", Game.RunTime.ToString());
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void StartSkirmishGame()
|
void StartSkirmishGame()
|
||||||
{
|
{
|
||||||
var map = WidgetUtils.ChooseInitialMap(Game.Settings.Server.Map);
|
var map = Game.ModData.MapCache.ChooseInitialMap(Game.Settings.Server.Map, Game.CosmeticRandom);
|
||||||
Game.Settings.Server.Map = map;
|
Game.Settings.Server.Map = map;
|
||||||
Game.Settings.Save();
|
Game.Settings.Save();
|
||||||
|
|
||||||
|
|||||||
@@ -126,12 +126,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (initialMap == null && tabMaps.Keys.Contains(initialTab) && tabMaps[initialTab].Any())
|
if (initialMap == null && tabMaps.Keys.Contains(initialTab) && tabMaps[initialTab].Any())
|
||||||
{
|
{
|
||||||
selectedUid = WidgetUtils.ChooseInitialMap(tabMaps[initialTab].Select(mp => mp.Uid).First());
|
selectedUid = Game.ModData.MapCache.ChooseInitialMap(tabMaps[initialTab].Select(mp => mp.Uid).First(),
|
||||||
|
Game.CosmeticRandom);
|
||||||
currentTab = initialTab;
|
currentTab = initialTab;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
selectedUid = WidgetUtils.ChooseInitialMap(initialMap);
|
selectedUid = Game.ModData.MapCache.ChooseInitialMap(initialMap, Game.CosmeticRandom);
|
||||||
currentTab = tabMaps.Keys.FirstOrDefault(k => tabMaps[k].Select(mp => mp.Uid).Contains(selectedUid));
|
currentTab = tabMaps.Keys.FirstOrDefault(k => tabMaps[k].Select(mp => mp.Uid).Contains(selectedUid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +314,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
modData.MapCache[map].Delete();
|
modData.MapCache[map].Delete();
|
||||||
if (selectedUid == map)
|
if (selectedUid == map)
|
||||||
selectedUid = WidgetUtils.ChooseInitialMap(tabMaps[currentTab].Select(mp => mp.Uid).FirstOrDefault());
|
selectedUid = Game.ModData.MapCache.ChooseInitialMap(tabMaps[currentTab].Select(mp => mp.Uid).FirstOrDefault(),
|
||||||
|
Game.CosmeticRandom);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -348,7 +350,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
maps.Do(m => DeleteMap(m));
|
maps.Do(m => DeleteMap(m));
|
||||||
if (after != null)
|
if (after != null)
|
||||||
after(WidgetUtils.ChooseInitialMap(null));
|
after(Game.ModData.MapCache.ChooseInitialMap(null, Game.CosmeticRandom));
|
||||||
},
|
},
|
||||||
confirmText: "Delete",
|
confirmText: "Delete",
|
||||||
onCancel: () => { });
|
onCancel: () => { });
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
this.onExit = onExit;
|
this.onExit = onExit;
|
||||||
|
|
||||||
var settings = Game.Settings;
|
var settings = Game.Settings;
|
||||||
preview = modData.MapCache[WidgetUtils.ChooseInitialMap(Game.Settings.Server.Map)];
|
preview = modData.MapCache[modData.MapCache.ChooseInitialMap(Game.Settings.Server.Map, Game.CosmeticRandom)];
|
||||||
|
|
||||||
panel.Get<ButtonWidget>("CREATE_BUTTON").OnClick = CreateAndJoin;
|
panel.Get<ButtonWidget>("CREATE_BUTTON").OnClick = CreateAndJoin;
|
||||||
|
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA.Platforms.Null
|
|
||||||
{
|
|
||||||
public sealed class NullGraphicsDevice : IGraphicsDevice
|
|
||||||
{
|
|
||||||
public Size WindowSize { get; private set; }
|
|
||||||
|
|
||||||
public NullGraphicsDevice(Size size, WindowMode window)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Using Null renderer");
|
|
||||||
WindowSize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose() { }
|
|
||||||
|
|
||||||
public void EnableScissor(int left, int top, int width, int height) { }
|
|
||||||
public void DisableScissor() { }
|
|
||||||
|
|
||||||
public void EnableDepthBuffer() { }
|
|
||||||
public void DisableDepthBuffer() { }
|
|
||||||
|
|
||||||
public void SetBlendMode(BlendMode mode) { }
|
|
||||||
|
|
||||||
public void GrabWindowMouseFocus() { }
|
|
||||||
public void ReleaseWindowMouseFocus() { }
|
|
||||||
|
|
||||||
public void Clear() { }
|
|
||||||
public void Present() { }
|
|
||||||
public Bitmap TakeScreenshot() { return new Bitmap(1, 1); }
|
|
||||||
|
|
||||||
public string GetClipboardText() { return ""; }
|
|
||||||
public bool SetClipboardText(string text) { return false; }
|
|
||||||
public void PumpInput(IInputHandler ih)
|
|
||||||
{
|
|
||||||
Game.HasInputFocus = false;
|
|
||||||
ih.ModifierKeys(Modifiers.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DrawPrimitives(PrimitiveType pt, int firstVertex, int numVertices) { }
|
|
||||||
|
|
||||||
public IVertexBuffer<Vertex> CreateVertexBuffer(int size) { return new NullVertexBuffer<Vertex>(); }
|
|
||||||
public ITexture CreateTexture() { return new NullTexture(); }
|
|
||||||
public ITexture CreateTexture(Bitmap bitmap) { return new NullTexture(); }
|
|
||||||
public IFrameBuffer CreateFrameBuffer(Size s) { return new NullFrameBuffer(); }
|
|
||||||
public IShader CreateShader(string name) { return new NullShader(); }
|
|
||||||
|
|
||||||
public IHardwareCursor CreateHardwareCursor(string name, Size size, byte[] data, int2 hotspot) { return null; }
|
|
||||||
public void SetHardwareCursor(IHardwareCursor cursor) { }
|
|
||||||
|
|
||||||
public string GLVersion { get { return "(null)"; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class NullShader : IShader
|
|
||||||
{
|
|
||||||
public void SetBool(string name, bool value) { }
|
|
||||||
public void SetVec(string name, float x) { }
|
|
||||||
public void SetVec(string name, float x, float y) { }
|
|
||||||
public void SetVec(string name, float[] vec, int length) { }
|
|
||||||
public void SetTexture(string param, ITexture texture) { }
|
|
||||||
public void SetMatrix(string param, float[] mtx) { }
|
|
||||||
public void Render(Action a) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class NullTexture : ITexture
|
|
||||||
{
|
|
||||||
public TextureScaleFilter ScaleFilter { get { return TextureScaleFilter.Nearest; } set { } }
|
|
||||||
public void SetData(Bitmap bitmap) { }
|
|
||||||
public void SetData(uint[,] colors) { }
|
|
||||||
public void SetData(byte[] colors, int width, int height) { }
|
|
||||||
public byte[] GetData() { return new byte[0]; }
|
|
||||||
public Size Size { get { return new Size(0, 0); } }
|
|
||||||
public void Dispose() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class NullFrameBuffer : IFrameBuffer
|
|
||||||
{
|
|
||||||
public void Bind() { }
|
|
||||||
public void Unbind() { }
|
|
||||||
public ITexture Texture { get { return new NullTexture(); } }
|
|
||||||
public void Dispose() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class NullVertexBuffer<T> : IVertexBuffer<T>
|
|
||||||
{
|
|
||||||
public void Bind() { }
|
|
||||||
public void SetData(T[] vertices, int length) { }
|
|
||||||
public void SetData(T[] vertices, int start, int length) { }
|
|
||||||
public void SetData(IntPtr data, int start, int length) { }
|
|
||||||
public void Dispose() { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Drawing;
|
|
||||||
using OpenRA;
|
|
||||||
|
|
||||||
[assembly: Platform(typeof(OpenRA.Platforms.Null.DeviceFactory))]
|
|
||||||
|
|
||||||
namespace OpenRA.Platforms.Null
|
|
||||||
{
|
|
||||||
public class DeviceFactory : IDeviceFactory
|
|
||||||
{
|
|
||||||
public IGraphicsDevice CreateGraphics(Size size, WindowMode windowMode)
|
|
||||||
{
|
|
||||||
return new NullGraphicsDevice(size, windowMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ISoundEngine CreateSound()
|
|
||||||
{
|
|
||||||
return new NullSoundEngine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version. For more
|
|
||||||
* information, see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace OpenRA.Platforms.Null
|
|
||||||
{
|
|
||||||
sealed class NullSoundEngine : ISoundEngine
|
|
||||||
{
|
|
||||||
public SoundDevice[] AvailableDevices()
|
|
||||||
{
|
|
||||||
return new[] { new SoundDevice("Null", null, "Output Disabled") };
|
|
||||||
}
|
|
||||||
|
|
||||||
public NullSoundEngine()
|
|
||||||
{
|
|
||||||
Console.WriteLine("Using Null sound engine which disables SFX completely");
|
|
||||||
}
|
|
||||||
|
|
||||||
public ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate)
|
|
||||||
{
|
|
||||||
return new NullSoundSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ISound Play2D(ISoundSource sound, bool loop, bool relative, WPos pos, float volume, bool attenuateVolume)
|
|
||||||
{
|
|
||||||
return new NullSound();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PauseSound(ISound sound, bool paused) { }
|
|
||||||
public void StopSound(ISound sound) { }
|
|
||||||
public void SetAllSoundsPaused(bool paused) { }
|
|
||||||
public void StopAllSounds() { }
|
|
||||||
public void SetListenerPosition(WPos position) { }
|
|
||||||
public void SetSoundVolume(float volume, ISound music, ISound video) { }
|
|
||||||
|
|
||||||
public float Volume { get; set; }
|
|
||||||
|
|
||||||
public void Dispose() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
class NullSoundSource : ISoundSource { }
|
|
||||||
|
|
||||||
class NullSound : ISound
|
|
||||||
{
|
|
||||||
public float Volume { get; set; }
|
|
||||||
public float SeekPosition { get { return 0; } }
|
|
||||||
public bool Playing { get { return false; } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,13 +5,14 @@
|
|||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}</ProjectGuid>
|
<ProjectGuid>{76F621A1-3D8E-4A99-9F7E-B071EB657817}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>OpenRA.Platforms.Null</RootNamespace>
|
<RootNamespace>OpenRA.Server</RootNamespace>
|
||||||
<AssemblyName>OpenRA.Platforms.Null</AssemblyName>
|
<AssemblyName>OpenRA.Server</AssemblyName>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<FileUpgradeFlags></FileUpgradeFlags>
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
<OldToolsVersion>3.5</OldToolsVersion>
|
<OldToolsVersion>3.5</OldToolsVersion>
|
||||||
<UpgradeBackupLocation />
|
<UpgradeBackupLocation />
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
@@ -35,9 +36,10 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<OutputPath>..\</OutputPath>
|
<OutputPath>..\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||||
@@ -47,21 +49,20 @@
|
|||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Core">
|
||||||
<Reference Include="Eluant">
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
<HintPath>..\thirdparty\download\Eluant.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="NullGraphicsDevice.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="NullSound.cs" />
|
|
||||||
<Compile Include="NullPlatform.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
||||||
58
OpenRA.Server/Program.cs
Normal file
58
OpenRA.Server/Program.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
|
using OpenRA.Support;
|
||||||
|
|
||||||
|
namespace OpenRA.Server
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Log.AddChannel("debug", "dedicated-debug.log");
|
||||||
|
Log.AddChannel("perf", "dedicated-perf.log");
|
||||||
|
Log.AddChannel("server", "dedicated-server.log");
|
||||||
|
|
||||||
|
// HACK: The engine code assumes that Game.Settings is set.
|
||||||
|
// This isn't nearly as bad as ModData, but is still not very nice.
|
||||||
|
Game.InitializeSettings(new Arguments(args));
|
||||||
|
var settings = Game.Settings.Server;
|
||||||
|
|
||||||
|
// HACK: The engine code *still* assumes that Game.ModData is set
|
||||||
|
var mod = Game.Settings.Game.Mod;
|
||||||
|
var modData = Game.ModData = new ModData(mod, false);
|
||||||
|
modData.MapCache.LoadMaps();
|
||||||
|
|
||||||
|
settings.Map = modData.MapCache.ChooseInitialMap(settings.Map, new MersenneTwister());
|
||||||
|
|
||||||
|
Console.WriteLine("Starting dedicated server for mod: " + mod);
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
var server = new Server(new IPEndPoint(IPAddress.Any, settings.ListenPort), settings, modData, true);
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
if (server.State == ServerState.GameStarted && server.Conns.Count < 1)
|
||||||
|
{
|
||||||
|
Console.WriteLine("No one is playing, shutting down...");
|
||||||
|
server.Shutdown();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Starting a new server instance...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
OpenRA.sln
10
OpenRA.sln
@@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Cnc", "OpenRA.M
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Utility", "OpenRA.Utility\OpenRA.Utility.csproj", "{F33337BE-CB69-4B24-850F-07D23E408DDF}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Utility", "OpenRA.Utility\OpenRA.Utility.csproj", "{F33337BE-CB69-4B24-850F-07D23E408DDF}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Platforms.Null", "OpenRA.Platforms.Null\OpenRA.Platforms.Null.csproj", "{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Server", "OpenRA.Server\OpenRA.Server.csproj", "{76F621A1-3D8E-4A99-9F7E-B071EB657817}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.D2k", "OpenRA.Mods.D2k\OpenRA.Mods.D2k.csproj", "{C0B0465C-6BE2-409C-8770-3A9BF64C4344}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.D2k", "OpenRA.Mods.D2k\OpenRA.Mods.D2k.csproj", "{C0B0465C-6BE2-409C-8770-3A9BF64C4344}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -127,10 +127,10 @@ Global
|
|||||||
{F33337BE-CB69-4B24-850F-07D23E408DDF}.Debug|x86.Build.0 = Debug|x86
|
{F33337BE-CB69-4B24-850F-07D23E408DDF}.Debug|x86.Build.0 = Debug|x86
|
||||||
{F33337BE-CB69-4B24-850F-07D23E408DDF}.Release|x86.ActiveCfg = Release|x86
|
{F33337BE-CB69-4B24-850F-07D23E408DDF}.Release|x86.ActiveCfg = Release|x86
|
||||||
{F33337BE-CB69-4B24-850F-07D23E408DDF}.Release|x86.Build.0 = Release|x86
|
{F33337BE-CB69-4B24-850F-07D23E408DDF}.Release|x86.Build.0 = Release|x86
|
||||||
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|x86.ActiveCfg = Debug|x86
|
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Debug|x86.Build.0 = Debug|x86
|
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Debug|x86.Build.0 = Debug|x86
|
||||||
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Release|x86.ActiveCfg = Release|x86
|
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Release|x86.ActiveCfg = Release|x86
|
||||||
{0C4AEC1A-E7D5-4114-8CCD-3EEC82872981}.Release|x86.Build.0 = Release|x86
|
{76F621A1-3D8E-4A99-9F7E-B071EB657817}.Release|x86.Build.0 = Release|x86
|
||||||
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.ActiveCfg = Debug|x86
|
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.Build.0 = Debug|x86
|
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Debug|x86.Build.0 = Debug|x86
|
||||||
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Release|x86.ActiveCfg = Release|x86
|
{C0B0465C-6BE2-409C-8770-3A9BF64C4344}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
|||||||
@@ -8,15 +8,13 @@
|
|||||||
|
|
||||||
Name="${Name:-"Dedicated Server"}"
|
Name="${Name:-"Dedicated Server"}"
|
||||||
Mod="${Mod:-"ra"}"
|
Mod="${Mod:-"ra"}"
|
||||||
Dedicated="True"
|
|
||||||
DedicatedLoop="True"
|
|
||||||
ListenPort="${ListenPort:-"1234"}"
|
ListenPort="${ListenPort:-"1234"}"
|
||||||
ExternalPort="${ExternalPort:-"1234"}"
|
ExternalPort="${ExternalPort:-"1234"}"
|
||||||
AdvertiseOnline="${AdvertiseOnline:-"True"}"
|
AdvertiseOnline="${AdvertiseOnline:-"True"}"
|
||||||
AllowPortForward="${AllowPortForward:-"False"}"
|
AllowPortForward="${AllowPortForward:-"False"}"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
mono --debug OpenRA.Game.exe Game.Mod=$Mod Server.Dedicated=$Dedicated Server.DedicatedLoop=$DedicatedLoop \
|
mono --debug OpenRA.Server.exe Game.Mod=$Mod \
|
||||||
Server.Name="$Name" Server.ListenPort=$ListenPort Server.ExternalPort=$ExternalPort \
|
Server.Name="$Name" Server.ListenPort=$ListenPort Server.ExternalPort=$ExternalPort \
|
||||||
Server.AdvertiseOnline=$AdvertiseOnline Server.AllowPortForward=$AllowPortForward
|
Server.AdvertiseOnline=$AdvertiseOnline Server.AllowPortForward=$AllowPortForward
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# launch script (executed by Desura)
|
# launch script (executed by Desura)
|
||||||
mono OpenRA.Game.exe Server.Dedicated=False Server.DedicatedLoop=False "$@"
|
mono OpenRA.Game.exe "$@"
|
||||||
if [ $? != 0 -a $? != 1 ]
|
if [ $? != 0 -a $? != 1 ]
|
||||||
then
|
then
|
||||||
ZENITY=`which zenity` || echo "OpenRA needs zenity installed to display a graphical error dialog. See ~/.openra. for log files."
|
ZENITY=`which zenity` || echo "OpenRA needs zenity installed to display a graphical error dialog. See ~/.openra. for log files."
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ markdown DOCUMENTATION.md > DOCUMENTATION.html
|
|||||||
markdown Lua-API.md > Lua-API.html
|
markdown Lua-API.md > Lua-API.html
|
||||||
|
|
||||||
# List of files that are packaged on all platforms
|
# List of files that are packaged on all platforms
|
||||||
FILES=('OpenRA.Game.exe' 'OpenRA.Game.exe.config' 'OpenRA.Utility.exe' \
|
FILES=('OpenRA.Game.exe' 'OpenRA.Game.exe.config' 'OpenRA.Utility.exe' 'OpenRA.Server.exe'
|
||||||
'OpenRA.Platforms.Default.dll' 'OpenRA.Platforms.Null.dll' \
|
'OpenRA.Platforms.Default.dll' \
|
||||||
'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modchooser' \
|
'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modchooser' \
|
||||||
'AUTHORS' 'COPYING' 'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' 'CHANGELOG.html' \
|
'AUTHORS' 'COPYING' 'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' 'CHANGELOG.html' \
|
||||||
'global mix database.dat' 'GeoLite2-Country.mmdb.gz')
|
'global mix database.dat' 'GeoLite2-Country.mmdb.gz')
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ Section "Game" GAME
|
|||||||
File "${SRCDIR}\OpenRA.Game.exe"
|
File "${SRCDIR}\OpenRA.Game.exe"
|
||||||
File "${SRCDIR}\OpenRA.Game.exe.config"
|
File "${SRCDIR}\OpenRA.Game.exe.config"
|
||||||
File "${SRCDIR}\OpenRA.Utility.exe"
|
File "${SRCDIR}\OpenRA.Utility.exe"
|
||||||
File "${SRCDIR}\OpenRA.Platforms.Null.dll"
|
File "${SRCDIR}\OpenRA.Server.exe"
|
||||||
File "${SRCDIR}\OpenRA.Platforms.Default.dll"
|
File "${SRCDIR}\OpenRA.Platforms.Default.dll"
|
||||||
File "${SRCDIR}\ICSharpCode.SharpZipLib.dll"
|
File "${SRCDIR}\ICSharpCode.SharpZipLib.dll"
|
||||||
File "${SRCDIR}\FuzzyLogicLibrary.dll"
|
File "${SRCDIR}\FuzzyLogicLibrary.dll"
|
||||||
@@ -190,7 +190,7 @@ Function ${UN}Clean
|
|||||||
Delete $INSTDIR\OpenRA.Game.exe
|
Delete $INSTDIR\OpenRA.Game.exe
|
||||||
Delete $INSTDIR\OpenRA.Game.exe.config
|
Delete $INSTDIR\OpenRA.Game.exe.config
|
||||||
Delete $INSTDIR\OpenRA.Utility.exe
|
Delete $INSTDIR\OpenRA.Utility.exe
|
||||||
Delete $INSTDIR\OpenRA.Platforms.Null.dll
|
Delete $INSTDIR\OpenRA.Server.exe
|
||||||
Delete $INSTDIR\OpenRA.Platforms.Default.dll
|
Delete $INSTDIR\OpenRA.Platforms.Default.dll
|
||||||
Delete $INSTDIR\ICSharpCode.SharpZipLib.dll
|
Delete $INSTDIR\ICSharpCode.SharpZipLib.dll
|
||||||
Delete $INSTDIR\FuzzyLogicLibrary.dll
|
Delete $INSTDIR\FuzzyLogicLibrary.dll
|
||||||
|
|||||||
Reference in New Issue
Block a user