Skip to content

Commit

Permalink
error if version is too new
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroJr committed Dec 23, 2024
1 parent 164cb1a commit 3a6da59
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Robust.Shared/EntitySerialization/EntityDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ namespace Robust.Shared.EntitySerialization;
public sealed class EntityDeserializer : ISerializationContext, IEntityLoadContext,
ITypeSerializer<EntityUid, ValueDataNode>
{
private const int BackwardsVersion = 3;
public const int OldestSupportedVersion = 3;
public const int NewestSupportedVersion = EntitySerializer.MapFormatVersion;

public SerializationManager.SerializerProvider SerializerProvider { get; } = new();

Expand Down Expand Up @@ -135,10 +136,18 @@ public EntityDeserializer(
public bool TryProcessData()
{
ReadMetadata();
if (Result.Version < BackwardsVersion)

if (Result.Version < OldestSupportedVersion)
{
_log.Error(
$"Cannot handle this map file version, found v{Result.Version} and require at least v{OldestSupportedVersion}");
return false;
}

if (Result.Version > NewestSupportedVersion)
{
_log.Error(
$"Cannot handle this map file version, found v{Result.Version} and require at least v{BackwardsVersion}");
$"Cannot handle this map file version, found v{Result.Version} but require at most v{NewestSupportedVersion}");
return false;
}

Expand Down

0 comments on commit 3a6da59

Please sign in to comment.