Original Post
This may be a trivial thing but i''m not sure how this would work.
I have two classes. Worldmap and EntManage. Both classes need to be able to access public functions/members in the other class. How do I go about making it such that they can talk?
I''m not sure if this is possible as I was thinking about it. If you define WorldMap, then EntManage hasn''t been defined yet, so you can''t define WorldMap. The same goes with the include files. CEntManage.h can''t be included cause it wants to include CWorldMap.h, However CWorldMap.h wanted to include CEntMagage.h in the first lace.
The two solutions I''ve thought of are to either make all communication one way, say EntMagage asks WorldMap for various things. Or I merge EntManage int WorldMap. I suppose another option is to move the section of code int WorldMap that needs to talk to EntManage to another class, or a single func, then make that class/func a friend class of WorldMap so it can still access private members to accomplish its task.
The idea is that WorldMap handles the map itself. It loads it, provides collision/entvis/etc. routines, and renders the map based off a position and view vector. EntManage handles Entities. It caches Ents, manages the game Ent list, and loops through Ents allowing them to process and render. (The Ents themselves do there own rendering) The Ents will also be passed to the VM class so that they can think.
This brings up another case. The VM needs access EntManage so that it can test an Ent against the other Ents for collision. But EntManage needs access to the VM so it can incurr an Ent to think.
Maybe I just really need to rethink my class structure..
Any Suggestions?
-Zims