Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when conquering enemy castle #145

Open
athach opened this issue Mar 4, 2022 · 5 comments
Open

Crash when conquering enemy castle #145

athach opened this issue Mar 4, 2022 · 5 comments

Comments

@athach
Copy link

athach commented Mar 4, 2022

A savegame is attached. It is the yellow castle.

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

@athach
Copy link
Author

athach commented Dec 30, 2022

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

@tlongstretch
Copy link

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

@athach
Copy link
Author

athach commented Dec 31, 2022

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

@athach
Copy link
Author

athach commented Dec 31, 2022

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
Copy link
Author

athach commented Jan 1, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants