Commit Graph

92 Commits (528d7b1be146f04d6f2c414e6b932967e3a73e76)

Author SHA1 Message Date
Myk Taylor 940f7de0d2
implement autogrow and update docs
also fix bad state tracking in EventManager for the JobStarted event
2023-11-02 12:44:37 -07:00
Najeeb Al-Shabibi 70ff728fba manageJobStartedEvent handle moved to inner loop and iterates from previous in linked list in case it is removed. fix a bug with item change events and using invalidated stack pointer as item data. swapped order of destroyed and created building event calls, and a couple other improvements 2023-09-28 16:19:32 +01:00
Najeeb Al-Shabibi 78bea2a550 fixed a typo brain fart moment 2023-09-27 23:34:19 +01:00
Najeeb Al-Shabibi f5aab7ee45 pulled event handler calls out of the loops over global vectors to avoid potential iterator invalidation by an event callback, and did some tidying 2023-09-27 20:55:22 +01:00
Myk Taylor 5e5775f5e3
rename globals according to structures update 2023-01-05 17:11:01 -08:00
Myk Taylor 7f91cf6e2a
more instrumentation for eventmanager 2022-12-20 09:49:35 -08:00
Myk Taylor 999d602e79
instrument eventmanager a bit 2022-12-19 13:43:57 -08:00
Josh Cooper f3ae193914
Update EventManager.cpp 2022-11-09 16:49:35 -08:00
Josh Cooper 92645ccb5b Fixes JOB_STARTED event 2022-11-08 12:43:23 -08:00
Josh Cooper 2197aded30
Fixes segfault 2022-11-06 17:30:28 -08:00
Josh Cooper d38ab1d152
Fix UNIT_NEW_ACTIVE events (#2197)
* Updates eventful.lua to use UNIT_NEW_ACTIVE

* Fixes bug #2189

* Revises activeUnits declaration/initialization

* Fixes build error

* Update changelog.txt

* reword changelog entry

* add changelog entry for event name change

Co-authored-by: Myk <myk002@yahoo.com>
2022-06-17 09:34:41 -07:00
Josh Cooper ff2bd8d953 Retypes the EventManager's constructions container 2022-04-18 23:53:23 -07:00
Josh Cooper d6b2629cfc Adds hash functions and operator overloads for event data structures 2022-04-18 23:53:23 -07:00
Josh Cooper 64b7de0339 Revises getVerb signature 2022-04-18 22:46:38 -07:00
Josh Cooper 018d189494 Simplifies report index safety 2022-04-18 22:46:38 -07:00
Josh Cooper 1f972d6c1c Implements clang-tidy suggestions 2022-04-18 22:46:38 -07:00
Josh Cooper 9bf9a79a11
EventManager/Eventful - Generate event arrays (#2097)
* Replaces EventManager.cpp's event array with an auto-gen one

* Replaces eventful.cpp's event array with auto-gen one
2022-04-14 21:47:25 -07:00
lethosor d1f0edd33b
Apply initial pre-commit config 2022-04-12 14:48:19 -04:00
Josh Cooper b18eff9ce2
Revert EventManager to previous behavior, but keep new events
Fixes #2031
2022-03-29 09:42:24 -07:00
Josh Cooper 3f05859780 Revises manageJobStartedEvent, and adds comments 2022-03-12 11:33:27 -08:00
Josh Cooper c8e7869375 Fixes some build errors 2022-03-12 11:33:27 -08:00
Josh Cooper 524f1670ed Fixes missing namespace 2022-03-12 11:33:27 -08:00
Josh Cooper ba5710f263 Adds new event type NEW_UNIT_ACTIVE 2022-03-12 11:33:27 -08:00
Josh Cooper 6ace4b2cf8 Fixes mistake in EventManager::manageTickEvent 2022-03-12 11:33:27 -08:00
Josh Cooper b8ad0131ea Modifies EventManager::registerTick to retain old behaviour of re-registering tick events 2022-03-12 11:33:27 -08:00
Josh Cooper 1107c03b86 Modifies EventManager unit loops 2022-03-12 11:33:27 -08:00
Josh Cooper c550a6caf0 Updates EventManager job loops 2022-03-12 11:33:27 -08:00
Josh Cooper 07ffa0b8da Fixes bug in manageJobStartedEvent 2022-03-12 11:33:27 -08:00
Josh Cooper 24255d3195 Adds event type JOB_STARTED 2022-03-12 11:33:27 -08:00
Josh Cooper 48444afbd5 Fixes issue in manageJobCompletedEvent 2022-03-12 11:33:27 -08:00
Josh Cooper 3e72d549d1 Switches iterators to pre-increment instead of post for EventManager
My understanding is that iterators (.begin()/end()) are slightly faster with
pre-increment instead of post. Something about avoiding a copy if I recall correctly.
I replaced all `([:alpha:]+)\+\+` with `++$1` so non-iterators were switched as well - luckily there is no impact to pre/post aside from with iterators.
2022-03-12 11:33:27 -08:00
Josh Cooper f5ced46608 Refactors EventManager
- handler freq now works on an individual handler basis (set to 0 to fire as frequently as possible)
- tick events no longer need to be re-registered after every eventful tick
2022-03-12 11:33:27 -08:00
lethosor 08aeb6faeb Fix EventManager building ID type
The pointer to the building ID was sometimes not dereferenced properly.
Addressed by switching to an ID cast to a pointer type for consistency with
other types of events.

Fixes #1434
Ref #1003 (19695b4ee7)
Broken in #1253 (a7dfacd1c5)
2019-10-05 20:26:31 -04:00
lethosor 7a5e7c7c86 Rename unit_flags1.dead to killed, update submodules/changelog
Follow-up for dfhack/df-structures#247
2018-06-21 11:17:09 -04:00
lethosor aac892c560 Adapted to changed Units functions
Squashed version of #1307

Closes #1307
2018-06-14 10:30:35 -04:00
Ben Lubar 0a2ec30199
Remove or comment out unused code. 2018-04-05 16:48:11 -05:00
lethosor 2c95ac411e Update xml and all uses of job_handler 2017-11-25 00:59:59 -05:00
lethosor 19695b4ee7 EventManager/eventful: Pass building ID pointers to event handlers
Previously, there was some disagreement over whether event handlers such as
Buildings::updateBuildings() took building pointers or building IDs shoved
into pointers. It turned out to be the latter, which, unfortunately, did not
compile on x64. Passing building IDs isn't possible in all cases, because
building event handlers can be called for recently-deleted buildings too.
Pointers to building IDs do work reliably, though.

Fixes #1003
2017-02-17 22:53:48 -05:00
lethosor 41a81f9021 Fix some more warnings (GCC 4.8) 2016-07-28 11:00:52 -04:00
expwnent f8ff447cb5 Add a check to the histfig fix and tweak NEWS. 2016-03-10 08:50:03 -05:00
expwnent fd132d3fe7 Fix persistent histfig crashbug. 2016-03-10 08:38:55 -05:00
lethosor 10cfef0553 Fix whitespace issues 2015-02-14 22:53:06 -05:00
expwnent 8f4b766107 EventManager: Fix a crash bug with EQUIPMENT_CHANGE event. 2015-01-15 18:13:19 -05:00
expwnent 83d3785735 Update xml. 2014-11-30 14:03:00 -05:00
expwnent 5e3bf9a494 Make it compile for OSX. 2014-11-14 22:21:03 -05:00
expwnent 4464d7318d EventManager: make REPORT events only trigger for new reports, not ones that already exist in the save. 2014-11-14 22:07:48 -05:00
expwnent 428fe6a400 interaction-trigger tweaks 2014-11-14 18:50:19 -05:00
expwnent 779ac3fd50 Updated interaction-trigger to work better. 2014-11-09 18:36:21 -05:00
expwnent fa401f8637 EventManager tweak. 2014-11-07 14:16:10 -05:00
expwnent dcdb6aae1b EventManager: properly deal with frame_counter getting reset. 2014-11-06 23:44:13 -05:00