From 4464d7318d119df5c2c83abb85c470c5ebcdbf0f Mon Sep 17 00:00:00 2001 From: expwnent Date: Fri, 14 Nov 2014 22:07:48 -0500 Subject: [PATCH] EventManager: make REPORT events only trigger for new reports, not ones that already exist in the save. --- NEWS | 1 + library/modules/EventManager.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 6be9d6cf7..60fb4892a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ DFHack Future Internals: EventManager should handle INTERACTION triggers a little better. It still can get confused about who did what but only rarely. + EventManager should no longer trigger REPORT events for old reports after loading a save. lua/persist-table.lua: a convenient way of using persistent tables of arbitrary structure and dimension in Lua Fixes: full-heal: Updated with proper argument handling. diff --git a/library/modules/EventManager.cpp b/library/modules/EventManager.cpp index d42599209..a14e757dd 100644 --- a/library/modules/EventManager.cpp +++ b/library/modules/EventManager.cpp @@ -286,6 +286,9 @@ void DFHack::EventManager::onStateChange(color_ostream& out, state_change_event } } lastReport = -1; + if ( df::global::world->status.reports.size() > 0 ) { + lastReport = df::global::world->status.reports[df::global::world->status.reports.size()-1]->id; + } lastReportUnitAttack = -1; lastReportInteraction = -1; reportToRelevantUnitsTime = -1;