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

stack overflow, largestbuilding #670

Open
ennorehling opened this issue Mar 10, 2017 · 1 comment
Open

stack overflow, largestbuilding #670

ennorehling opened this issue Mar 10, 2017 · 1 comment
Assignees
Labels

Comments

@ennorehling
Copy link
Member

I have just created a test by accident that dies with an endless stack of just this:

test_eressea.exe!largestbuilding(const region * r, int(*)(const building *, const building *) cmp_gt, bool imaginary) Line 706	C
test_eressea.exe!building_owner_ex(const building * bld, const faction * last_owner) Line 583	C
test_eressea.exe!building_owner(const building * bld) Line 603	C
test_eressea.exe!cmp_taxes(const building * b, const building * a) Line 847	C
test_eressea.exe!largestbuilding(const region * r, int(*)(const building *, const building *) cmp_gt, bool imaginary) Line 706	C
test_eressea.exe!building_owner_ex(const building * bld, const faction * last_owner) Line 583	C

The largest building is the one that pays the most taxes, for which it needs to have an owner, or if it has none, but region owners pay for the building, then the owner of the largest building is the region owner, and so on, we go in circles.

@ennorehling ennorehling self-assigned this Mar 10, 2017
@ennorehling
Copy link
Member Author

This happens when my modified test_pay_cmd_other_building calls update_owners. I just made the test use a castle instead of a lighthouse for rules.region_owner_pay_building, and that breaks the stack.

This will not happen in "real life" situations, because buildings that create taxes do not have upkeep, but it's an idiotic limitation.

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

No branches or pull requests

1 participant