freeserf.net
freeserf.net copied to clipboard
Flag inventory does not match screen
The second sample is very clear. When game is loaded there is a sword at the flag. A serf carries a shield which he puts at the flag when he arrives, he picks up the sword. But the sword is still displayed in the game window. The transport info box is correct, the game window is incorrect.
Fix: Replace if (resources[i] == null) { var spriteOffset = textureAtlas.GetOffset(2000u + (uint)resource); resources[i] = spriteFactory.Create(info.Size.Width, info.Size.Height, spriteOffset.X, spriteOffset.Y, false, false); }
with
var spriteOffset = textureAtlas.GetOffset(2000u + (uint)resource); resources[i]?.Delete(); resources[i] = spriteFactory.Create(info.Size.Width, info.Size.Height, spriteOffset.X, spriteOffset.Y, false, false);
in RenderFlag.Update()
Fixed it