freeserf.net icon indicating copy to clipboard operation
freeserf.net copied to clipboard

Flag inventory does not match screen

Open athach opened this issue 2 years ago • 3 comments

Please see the attached screenshots and save file.

a b quicksave-08-02-22-21-34-08.zip

athach avatar Feb 08 '22 20:02 athach

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()

athach avatar Dec 13 '22 10:12 athach

Fixed it

Pyrdacor avatar Dec 13 '22 14:12 Pyrdacor