From 595a8630fec0a88285c6900432ee7d6ba3c5a5f7 Mon Sep 17 00:00:00 2001 From: Mikael Gustavsson Date: Tue, 15 Feb 2022 13:49:17 +0100 Subject: [PATCH] Bugfix: corruption of castle/warehouse inventory marker --- Freeserf.Core/Building.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Freeserf.Core/Building.cs b/Freeserf.Core/Building.cs index a8e2d50..1ac84b7 100644 --- a/Freeserf.Core/Building.cs +++ b/Freeserf.Core/Building.cs @@ -651,14 +651,18 @@ public void ClearSerfRequestFailure() public void KnightRequestGranted() { - ++state.Stock[0].Requested; - state.SerfRequested = false; + if ( !HasInventory() ) + { + ++state.Stock[0].Requested; + state.SerfRequested = false; + } } // Building has inventory and the inventory pointer is valid. public bool HasInventory() { - return state.Stock[0].Requested == 0xff; + return BuildingType == Type.Castle //workaorund for save games where castle inventory marker is corrupt because of bug + || state.Stock[0].Requested == 0xff; } public Inventory Inventory