I'll try to give a quick summary of how the server works currently then get to problems I have with it. It's a multithreaded asynchronous server, using IOCP to handle network operations. I do have bunch of managers like "Party manager, skill manager, item manager, trade manager, etc.". These managers have a one-way relationship. For example, trade manager knows about item manager but item manager doesn't work about trade manager. Until recently it's been working quite well. But lately I've been running into issues where 2 managers need to know about eachother. For instance:
- Combat manager needs to know about event manager so that it can add movement, skill cast events if the target is out of range.
- Event manager needs to know about combat manager so that it can call the function which handles skill cast when the target is within range.
One solution I could find was to move the function which handles skill cast into another class like "CombatUtility" and pass that to both event and combat managers. But it doesn't feel right and I couldn't think of a better solution. So my question is, how can I fix such problems, how can I avoid having such problems in the first place?