8000 Fix a crash for governors without specialists by lmoureaux · Pull Request #2355 · longturn/freeciv21 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix a crash for governors without specialists #2355

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions common/city.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2244,14 +2244,19 @@ void add_specialist_output(
{
int count = pcity->specialists[sp];

output_type_iterate(stat_index)
{
int amount = pcsoutputs ? pcsoutputs->at(sp)[stat_index]
: get_specialist_output(pcity, sp, stat_index);
// This is more than just an optimization. For governors that forbid
// specialists, the cache may not be filled.
if (count > 0) {
output_type_iterate(stat_index)
{
int amount = pcsoutputs
? pcsoutputs->at(sp)[stat_index]
: get_specialist_output(pcity, sp, stat_index);

output[stat_index] += count * amount;
output[stat_index] += count * amount;
}
output_type_iterate_end;
}
output_type_iterate_end;
}
specialist_type_iterate_end;
}
Expand Down
Loading
0