Fixed linked subs not spawning

Turns out the game actually sets Screen.Selected to null when the game starts, so the server would break on EditMapScreen checks.
This commit is contained in:
juanjp600
2017-06-21 14:51:36 -03:00
parent 0740579f62
commit 7ab01b8237
5 changed files with 29 additions and 7 deletions
+1
View File
@@ -89,6 +89,7 @@
<Compile Include="Source\PlayerInput.cs" />
<Compile Include="Source\Program.cs" />
<Compile Include="Source\Screens\NetLobbyScreen.cs" />
<Compile Include="Source\Screens\UnimplementedScreen.cs" />
<Compile Include="Source\Sprite\Sprite.cs" />
<Compile Include="Source\Utils\XnaToConsoleColor.cs" />
</ItemGroup>
+5 -5
View File
@@ -39,13 +39,13 @@ namespace Barotrauma
//null screens because they are not implemented by the server,
//but they're checked for all over the place
//TODO: maybe clean up instead of having these constants
public const Screen MainMenuScreen = null;
public const Screen LobbyScreen = null;
public static readonly Screen MainMenuScreen = UnimplementedScreen.Instance;
public static readonly Screen LobbyScreen = UnimplementedScreen.Instance;
public const Screen ServerListScreen = null;
public static readonly Screen ServerListScreen = UnimplementedScreen.Instance;
public const Screen EditMapScreen = null;
public const Screen EditCharacterScreen = null;
public static readonly Screen EditMapScreen = UnimplementedScreen.Instance;
public static readonly Screen EditCharacterScreen = UnimplementedScreen.Instance;
//
@@ -50,7 +50,7 @@ namespace Barotrauma
public override void Select()
{
}
private List<Submarine> subs;
@@ -0,0 +1,21 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Barotrauma.Networking;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.ComponentModel;
namespace Barotrauma
{
class UnimplementedScreen : Screen
{
public static readonly UnimplementedScreen Instance = new UnimplementedScreen();
public override void Select()
{
throw new Exception("Tried to select unimplemented screen");
}
}
}
+1 -1
View File
@@ -175,7 +175,7 @@ namespace Barotrauma
public bool AtEndPosition
{
get
{
{
if (Level.Loaded == null) return false;
return (Vector2.Distance(Position + HiddenSubPosition, Level.Loaded.EndPosition) < Level.ExitDistance);
}