Release 1.10.7.2 - Autumn Update 2025 Hotfix 4

This commit is contained in:
Regalis11
2025-10-22 14:54:03 +03:00
parent 37ffc94551
commit 7e25111487
17 changed files with 315 additions and 83 deletions
@@ -26,11 +26,72 @@ namespace Barotrauma.Networking
public Option<DataSource> MetadataSource = Option.None;
// Cached normalized versions of server strings for efficient homoglyph comparison
private string? cachedNormalizedName;
private string? cachedNormalizedMessage;
private string? cachedNormalizedGameMode;
private string serverName = "";
private string serverMessage = "";
private Identifier gameMode = Identifier.Empty;
[Serialize("", IsPropertySaveable.Yes)]
public string ServerName { get; set; } = "";
public string ServerName
{
get { return serverName; }
set
{
serverName = value;
cachedNormalizedName = null; // Invalidate cache
}
}
[Serialize("", IsPropertySaveable.Yes)]
public string ServerMessage { get; set; } = "";
public string ServerMessage
{
get { return serverMessage; }
set
{
serverMessage = value;
cachedNormalizedMessage = null; // Invalidate cache
}
}
public string NormalizedServerName
{
get
{
if (cachedNormalizedName == null)
{
cachedNormalizedName = Homoglyphs.Normalize(ServerName);
}
return cachedNormalizedName;
}
}
public string NormalizedServerMessage
{
get
{
if (cachedNormalizedMessage == null)
{
cachedNormalizedMessage = Homoglyphs.Normalize(ServerMessage);
}
return cachedNormalizedMessage;
}
}
public string NormalizedGameMode
{
get
{
if (cachedNormalizedGameMode == null)
{
cachedNormalizedGameMode = Homoglyphs.Normalize(GameMode.Value);
}
return cachedNormalizedGameMode;
}
}
public int PlayerCount { get; set; }
@@ -43,8 +104,16 @@ namespace Barotrauma.Networking
public bool HasPassword { get; set; }
[Serialize("", IsPropertySaveable.Yes)]
public Identifier GameMode { get; set; }
public Identifier GameMode
{
get { return gameMode; }
set
{
gameMode = value;
cachedNormalizedGameMode = null; // Invalidate cache
}
}
[Serialize(SelectionMode.Manual, IsPropertySaveable.Yes)]
public SelectionMode ModeSelectionMode { get; set; }
@@ -541,14 +610,27 @@ namespace Barotrauma.Networking
return Array.Empty<ServerListContentPackageInfo>();
}
return contentPackageNames
.Zip(contentPackageHashes, (name, hash) => (name, hash))
.Zip(contentPackageIds, (t1, id) =>
new ServerListContentPackageInfo(
t1.name,
t1.hash,
ContentPackageId.Parse(id)))
.ToArray();
List<ServerListContentPackageInfo> contentPackageInfos = new List<ServerListContentPackageInfo>();
for (int i = 0; i < contentPackageNames.Count; i++)
{
string name = contentPackageNames[i];
string hash = contentPackageHashes[i];
string ugcId = contentPackageIds[i];
//according to Steam documentation, this is the maximum length of a workshop item title
//see k_cchPublishedDocumentTitleMax
if (name.Length > 128 + 1)
{
name = name.Substring(0, 128 + 1);
}
if (hash.Length > Md5Hash.MaxHashLength)
{
hash = hash.Substring(0, Md5Hash.MaxHashLength);
}
//note that we don't validate the UGC ID here, that should be handled in ContentPackageId.Parse
contentPackageInfos.Add(new ServerListContentPackageInfo(name, hash, ContentPackageId.Parse(ugcId)));
}
return contentPackageInfos.ToArray();
}
public static Option<ServerInfo> FromXElement(XElement element)