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

Crash when conquering enemy castle

Open athach opened this issue 2 years ago • 5 comments

A savegame is attached. It is the yellow castle.

Untitled3 quicksave-04-03-22-19-09-32.zip

athach avatar Mar 04 '22 18:03 athach

I got the same exception on the same line in a different game when conquering the enemy castle.

athach avatar Dec 30 '22 13:12 athach

Freeserf had same issue. I believe it was due to the now-deleted Inventory object nullptr checked? I forget exactly, the fix is somewhere in Forkserf changelog

tlongstretch avatar Dec 30 '22 15:12 tlongstretch

Thank you for the info. Imagine if there were no forks and everyone was working on the same code :)

athach avatar Dec 31 '22 10:12 athach

I didnt debug it yet but I think this problem is that the castle flag was not connected because all roads and building connected to the castle was already conquered. The code expects a flag to have at least one connected.

athach avatar Dec 31 '22 10:12 athach

Fix in Flag.cs.MergePaths(). This fixes the crash but I dont know how it is good enough as the final solution.

From var path1Data = new SerfPathInfo(); var path2Data = new SerfPathInfo();

To // This could happen when a castle is conquered and it has no path anywhere if ( path1Direction == path2Direction ) { return; }

        var path1Data = new SerfPathInfo();
        var path2Data = new SerfPathInfo();

athach avatar Jan 01 '23 10:01 athach