Build 0.18.4.0
This commit is contained in:
@@ -15,6 +15,21 @@ namespace Barotrauma
|
||||
public bool IsNone() => this is None<T>;
|
||||
public bool IsSome() => this is Some<T>;
|
||||
|
||||
public bool TryUnwrap(out T outValue)
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case Some<T> { Value: var value }:
|
||||
outValue = value;
|
||||
return true;
|
||||
case None<T> _:
|
||||
outValue = default;
|
||||
return false;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public Option<TType> Select<TType>(Func<T, TType> selector) =>
|
||||
this switch
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace Barotrauma
|
||||
public static Success<T, TError> Success(T value)
|
||||
=> new Success<T, TError>(value);
|
||||
|
||||
public static Failure<T, TError> Failure(TError error, string? stackTrace)
|
||||
=> new Failure<T, TError>(error, stackTrace);
|
||||
public static Failure<T, TError> Failure(TError error)
|
||||
=> new Failure<T, TError>(error);
|
||||
}
|
||||
|
||||
public sealed class Success<T, TError> : Result<T, TError>
|
||||
@@ -34,14 +34,11 @@ namespace Barotrauma
|
||||
{
|
||||
public readonly TError Error;
|
||||
|
||||
public readonly string? StackTrace;
|
||||
|
||||
public override bool IsSuccess => false;
|
||||
|
||||
public Failure(TError error, string? stackTrace)
|
||||
public Failure(TError error)
|
||||
{
|
||||
Error = error;
|
||||
StackTrace = stackTrace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,23 @@ namespace Barotrauma.IO
|
||||
".bat", ".sh", //shell scripts
|
||||
}.ToIdentifiers().ToImmutableArray();
|
||||
|
||||
public ref struct Skipper
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
SkipValidationInDebugBuilds = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Skips validation for as long as the returned object remains in scope (remember to use using)
|
||||
/// </summary>
|
||||
public static Skipper SkipInDebugBuilds()
|
||||
{
|
||||
SkipValidationInDebugBuilds = true;
|
||||
return new Skipper();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When set to true, the game is allowed to modify the vanilla content in debug builds. Has no effect in non-debug builds.
|
||||
/// </summary>
|
||||
|
||||
@@ -126,6 +126,10 @@ namespace Barotrauma
|
||||
|
||||
public static void LoadGame(string filePath)
|
||||
{
|
||||
//ensure there's no gamesession/sub loaded because it'd lead to issues when starting a new one (e.g. trying to determine which level to load based on the placement of the sub)
|
||||
//can happen if a gamesession is interrupted ungracefully (exception during loading)
|
||||
Submarine.Unload();
|
||||
GameMain.GameSession = null;
|
||||
DebugConsole.Log("Loading save file: " + filePath);
|
||||
DecompressToDirectory(filePath, TempPath, null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user