Release 1.10.6.0 - Autumn Update 2025 Hotfix 1

This commit is contained in:
Regalis11
2025-09-25 11:11:35 +03:00
parent bad999d5fc
commit b2d91cde7c
25 changed files with 435 additions and 226 deletions
@@ -1,5 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -13,6 +12,11 @@ using Microsoft.Xna.Framework;
namespace Barotrauma
{
public class NetStructReadException : Exception
{
public NetStructReadException(string message, Exception? innerException = null) : base(message, innerException) { }
}
/// <summary>
/// Marks fields and properties as to be serialized and deserialized by <see cref="INetSerializableStruct"/>.
/// Also contains settings for some types like maximum and minimum values for numbers to reduce bits used.
@@ -730,8 +734,15 @@ namespace Barotrauma
/// <returns>A new struct of type T with fields and properties deserialized</returns>
public static T Read<T>(IReadMessage inc) where T : INetSerializableStruct
{
ReadOnlyBitField bitField = new ReadOnlyBitField(inc);
return ReadInternal<T>(inc, bitField);
try
{
ReadOnlyBitField bitField = new ReadOnlyBitField(inc);
return ReadInternal<T>(inc, bitField);
}
catch (Exception e)
{
throw new NetStructReadException($"Failed to read {nameof(INetSerializableStruct)}", e);
}
}
public static T ReadInternal<T>(IReadMessage inc, ReadOnlyBitField bitField) where T : INetSerializableStruct
@@ -749,7 +760,7 @@ namespace Barotrauma
}
catch (Exception exception)
{
throw new Exception($"Failed to assign" +
throw new NetStructReadException($"Failed to assign" +
$" {value ?? "[NULL]"} ({value?.GetType().Name ?? "[NULL]"})" +
$" to {typeof(T).Name}.{property.Name} ({property.Type.Name})", exception);
}