Merge pull request #2372 from cppcooper/patch-1

Fixes segfault in EventManager
develop
Myk 2022-11-07 17:40:34 -08:00 committed by GitHub
commit ec69bc20a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

@ -41,6 +41,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `mousequery`: fix the cursor jumping up z levels sometimes when using TWBT
- `tiletypes`: no longer resets dig priority to the default when updating other properties of a tile
- `automaterial`: fix rendering errors with box boundary markers
- Core: fix the segmentation fault with the REPORT event in EventManager
## Misc Improvements
- `blueprint`: new ``--smooth`` option for recording all smoothed floors and walls instead of just the ones that require smoothing for later carving

@ -904,7 +904,10 @@ static void manageReportEvent(color_ostream& out) {
std::vector<df::report*>& reports = df::global::world->status.reports;
size_t idx = df::report::binsearch_index(reports, lastReport, false);
// returns the index to the key equal to or greater than the key provided
idx = reports[idx]->id == lastReport ? idx + 1 : idx; // we need the index after (where the new stuff is)
while (idx < reports.size() && reports[idx]->id <= lastReport) {
idx++;
}
// returns the index to the key equal to or greater than the key provided
for ( ; idx < reports.size(); idx++ ) {
df::report* report = reports[idx];