DarkRadiant: master f6f47981

Author Committer Branch Timestamp Parent
orbweaver orbweaver master 25.11.2021 14:31 master 74feb75c
Changeset Streamline KeyObserver attachment to EntityNode

- EntityNode has a new observeKey() method which adds a simple callback
  function to observe a particular key, rather than requiring a full
  KeyObserver object owned and managed by the calling code.
- KeyObserverMap now stores the KeyObservers as shared_ptrs rather than raw
  pointers. If the legacy addKeyObserver() method is called, the observer is
  wrapped in a shared_ptr with a null deleter. If the new observeKey() method
  is called, a new KeyObserver is constructed to wrap the callback function.
- EntityKeyValue::detach() has a new parameter to disable sending the final
  empty value when the observer is detached. This avoids feedback loops and
  crashes when EntityNode (and its contained KeyObserverMap) is destroyed.
- All KeyObserverDelegates are now removed from Doom3GroupNode, in favour of
  the simpler observeKey() interface.
mod - include/ientity.h Diff File
mod - radiantcore/entity/KeyObserverDelegate.h Diff File
mod - radiantcore/entity/KeyObserverMap.h Diff File
mod - radiantcore/entity/KeyValue.cpp Diff File
mod - radiantcore/entity/KeyValue.h Diff File
mod - radiantcore/entity/doom3group/Doom3GroupNode.cpp Diff File
mod - radiantcore/entity/doom3group/Doom3GroupNode.h Diff File