refactor: ObjDecayManager как composition в WorldObjects#3103
Merged
Conversation
ObjDecayManager is now owned by WorldObjects instead of being a standalone global. Access via world_objects.decay_manager(). WorldObjects::remove() automatically calls decay_manager().remove(), guaranteeing cleanup and preventing dangling pointers in the decay queue when objects are removed from the world. The explicit obj_decay_manager.remove() call in ExtractObjFromWorld is removed as it's now redundant. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ObjDecayManagerперенесён из глобальной переменной в memberWorldObjects. Доступ черезworld_objects.decay_manager().Мотивация
Раньше
WorldObjectsиObjDecayManagerбыли независимыми реестрами. Удаление объекта требовало аккуратного вызоваremove()на обоих — забытый вызов → dangling pointer в decay queue.Что изменилось
WorldObjectsвладеетObjDecayManagerчерез compositionWorldObjects::remove()автоматически вызываетm_decay_manager.remove(obj)— гарантия cleanupextern ObjDecayManager obj_decay_managerobj_decay_manager.remove()изExtractObjFromWorld(теперь redundant)obj_decay_manager.xxx()→world_objects.decay_manager().xxx()Файлы (10)
world_objects.h/cpp— новый member + автоматический cleanup в remove()handler.cpp,obj_save.cpp,do_get.cpp,obj_data.cpp,game_limits.cpp— замена вызововobj_decay_manager.h/cpp— убран externtests/obj_decay_manager.cpp— обновлены вызовыTest plan
grep -r "obj_decay_manager\." src/— только include файла, нет прямых вызовов🤖 Generated with Claude Code