mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
# Tidied up some code.
- Made some classes not be singletons, since there's no reason why they should be. - Made them non-global too (because globals have unclear lifetimes, and make it harder to test things, etc). They're now owned by CGameView and CWorld, and mostly accessed via g_Game or arguments (vaguely trying to avoid the graphics code calling into the game code). - Moved CGameView implementation into pimpl, so the header file isn't so heavy. - Changed a few pointers into references, to indicate that they're never NULL. This was SVN commit r4756.
This commit is contained in:
+4
-2
@@ -34,12 +34,13 @@ CLightEnv g_LightEnv;
|
||||
CWorld::CWorld(CGame *pGame):
|
||||
m_pGame(pGame),
|
||||
m_Terrain(new CTerrain()),
|
||||
m_UnitManager(&g_UnitMan),
|
||||
m_UnitManager(new CUnitManager()),
|
||||
m_EntityManager(new CEntityManager()),
|
||||
m_ProjectileManager(new CProjectileManager()),
|
||||
m_LOSManager(new CLOSManager()),
|
||||
m_TerritoryManager(new CTerritoryManager())
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void CWorld::Initialize(CGameAttributes *pAttribs)
|
||||
{
|
||||
@@ -79,6 +80,7 @@ CWorld::~CWorld()
|
||||
{
|
||||
delete m_Terrain;
|
||||
delete m_EntityManager;
|
||||
delete m_UnitManager; // must come after deleting EntityManager
|
||||
delete m_ProjectileManager;
|
||||
delete m_LOSManager;
|
||||
delete m_TerritoryManager;
|
||||
|
||||
Reference in New Issue
Block a user