From 77ffc6a0d162c240372f42825fdc3c0b7a06dfcf Mon Sep 17 00:00:00 2001 From: Zuev Vladimir Date: Fri, 5 Apr 2024 16:44:24 +0200 Subject: [PATCH] #340 Fix fetchRef failure. (#358) The issue was caused by 0 amount and underlying assert in the constructor of FetchOrder. --- src/MultiplayerMod/Multiplayer/Commands/ArgumentUtils.cs | 2 +- src/MultiplayerMod/Multiplayer/Objects/MultiplayerObjects.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/MultiplayerMod/Multiplayer/Commands/ArgumentUtils.cs b/src/MultiplayerMod/Multiplayer/Commands/ArgumentUtils.cs index 359a338e..073fe2c5 100644 --- a/src/MultiplayerMod/Multiplayer/Commands/ArgumentUtils.cs +++ b/src/MultiplayerMod/Multiplayer/Commands/ArgumentUtils.cs @@ -69,7 +69,7 @@ public object ResolveRaw() { var fetchOrders = list?.FetchOrders ?? creatureDeliveryPoint?.fetches; if (fetchOrders == null) { - return new FetchOrder2(null, null, FetchChore.MatchCriteria.MatchTags, null, null, null, 0); + return new FetchOrder2(null, Tags, FetchChore.MatchCriteria.MatchTags, null, null, null, 1); } return fetchOrders.Single(order => order.Tags.SequenceEqual(Tags)); } diff --git a/src/MultiplayerMod/Multiplayer/Objects/MultiplayerObjects.cs b/src/MultiplayerMod/Multiplayer/Objects/MultiplayerObjects.cs index 390d8238..fac46c89 100644 --- a/src/MultiplayerMod/Multiplayer/Objects/MultiplayerObjects.cs +++ b/src/MultiplayerMod/Multiplayer/Objects/MultiplayerObjects.cs @@ -23,8 +23,7 @@ public MultiplayerId Register(object instance, MultiplayerId? multiplayerId) { public void Remove(MultiplayerId id) => extensions.Remove(id); public T Get(MultiplayerId id) { - extensions.TryGetKey(id, out var result); - return (T) result!; + return (T)extensions[id]; } public object? this[MultiplayerId id] {