Revision: 2791
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2791&view=rev
Author: rorthomas
Date: 2012-06-07 10:02:14 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
renamed IManager to IBehaviorManager
added real IManager that can be used in all the existing managers without
having to have behaviors
Modified Paths:
--------------
trunk/source/main/gfx/SkyManager.cpp
trunk/source/main/gfx/SkyManager.h
trunk/source/main/gfx/camera/CameraManager.h
trunk/source/main/terrain/TerrainGeometryManager.cpp
trunk/source/main/terrain/TerrainGeometryManager.h
trunk/source/main/terrain/TerrainManager.cpp
trunk/source/main/terrain/TerrainManager.h
trunk/source/main/terrain/TerrainObjectManager.cpp
trunk/source/main/terrain/TerrainObjectManager.h
trunk/source/main/utils/IManager.h
Added Paths:
-----------
trunk/source/main/utils/IBehaviorManager.h
Modified: trunk/source/main/gfx/SkyManager.cpp
===================================================================
--- trunk/source/main/gfx/SkyManager.cpp 2012-06-06 22:39:49 UTC (rev
2790)
+++ trunk/source/main/gfx/SkyManager.cpp 2012-06-07 10:02:14 UTC (rev
2791)
@@ -155,4 +155,20 @@
+ ":" + StringConverter::toString( (int)second, 2, '0' );
}
+bool SkyManager::update( float dt )
+{
+ // TODO
+ return true;
+}
+
+size_t SkyManager::getMemoryUsage()
+{
+ return 0;
+}
+
+void SkyManager::freeResources()
+{
+ // TODO
+}
+
#endif //USE_CAELUM
Modified: trunk/source/main/gfx/SkyManager.h
===================================================================
--- trunk/source/main/gfx/SkyManager.h 2012-06-06 22:39:49 UTC (rev 2790)
+++ trunk/source/main/gfx/SkyManager.h 2012-06-07 10:02:14 UTC (rev 2791)
@@ -25,8 +25,9 @@
#include "RoRPrerequisites.h"
#include "CaelumPrerequisites.h"
+#include "IManager.h"
-class SkyManager : public ZeroedMemoryAllocator
+class SkyManager : public IManager
{
public:
@@ -44,6 +45,10 @@
/// prints the current time of the simulation in the format of HH:MM:SS
Ogre::String getPrettyTime();
+ bool update( float dt );
+ size_t getMemoryUsage();
+ void freeResources();
+
void forceUpdate(float dt);
void notifyCameraChanged(Ogre::Camera *cam);
Modified: trunk/source/main/gfx/camera/CameraManager.h
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.h 2012-06-06 22:39:49 UTC
(rev 2790)
+++ trunk/source/main/gfx/camera/CameraManager.h 2012-06-07 10:02:14 UTC
(rev 2791)
@@ -23,11 +23,11 @@
#include "RoRPrerequisites.h"
#include "IBehavior.h"
-#include "IManager.h"
+#include "IBehaviorManager.h"
#include <OIS.h>
-class CameraManager : public IManager
+class CameraManager : public IBehaviorManager
{
friend class SceneMouse;
Modified: trunk/source/main/terrain/TerrainGeometryManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainGeometryManager.cpp 2012-06-06
22:39:49 UTC (rev 2790)
+++ trunk/source/main/terrain/TerrainGeometryManager.cpp 2012-06-07
10:02:14 UTC (rev 2791)
@@ -136,7 +136,7 @@
}
}
-void TerrainGeometryManager::update(float dt)
+bool TerrainGeometryManager::update(float dt)
{
Light *light = gEnv->terrainManager->getMainLight();
TerrainGlobalOptions *terrainOptions =
TerrainGlobalOptions::getSingletonPtr();
@@ -148,6 +148,7 @@
terrainOptions->setCompositeMapAmbient(gEnv->sceneManager->getAmbientLight());
mTerrainGroup->update();
+ return true;
}
void TerrainGeometryManager::configureTerrainDefaults()
@@ -354,3 +355,14 @@
return terrainPos;
}
+size_t TerrainGeometryManager::getMemoryUsage()
+{
+ // TODO
+ return 0;
+}
+
+void TerrainGeometryManager::freeResources()
+{
+ // TODO
+}
+
Modified: trunk/source/main/terrain/TerrainGeometryManager.h
===================================================================
--- trunk/source/main/terrain/TerrainGeometryManager.h 2012-06-06 22:39:49 UTC
(rev 2790)
+++ trunk/source/main/terrain/TerrainGeometryManager.h 2012-06-07 10:02:14 UTC
(rev 2791)
@@ -31,9 +31,10 @@
#include <OgreTerrainGroup.h>
#include <OgreConfigFile.h>
+#include "IManager.h"
// this class handles all interactions with the Ogre Terrain system
-class TerrainGeometryManager : public IHeightFinder, public
ZeroedMemoryAllocator
+class TerrainGeometryManager : public IHeightFinder, public IManager
{
friend class TerrainObjectManager;
public:
@@ -62,8 +63,13 @@
Ogre::Vector3 getMaxTerrainSize();
Ogre::Vector3 getTerrainPosition();
- void update(float dt);
+ bool update(float dt);
void updateLightMap();
+
+
+ size_t getMemoryUsage();
+ void freeResources();
+
protected:
Ogre::ConfigFile terrainConfig;
Modified: trunk/source/main/terrain/TerrainManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainManager.cpp 2012-06-06 22:39:49 UTC
(rev 2790)
+++ trunk/source/main/terrain/TerrainManager.cpp 2012-06-07 10:02:14 UTC
(rev 2791)
@@ -522,13 +522,15 @@
}
}
-void TerrainManager::update(float dt)
+bool TerrainManager::update(float dt)
{
if(object_manager)
object_manager->update(dt);
if(geometry_manager)
geometry_manager->update(dt);
+
+ return true;
}
@@ -601,3 +603,14 @@
{
return geometry_manager;
}
+
+size_t TerrainManager::getMemoryUsage()
+{
+ // TODO: FIX
+ return 0;
+}
+
+void TerrainManager::freeResources()
+{
+ // TODO
+}
Modified: trunk/source/main/terrain/TerrainManager.h
===================================================================
--- trunk/source/main/terrain/TerrainManager.h 2012-06-06 22:39:49 UTC (rev
2790)
+++ trunk/source/main/terrain/TerrainManager.h 2012-06-07 10:02:14 UTC (rev
2791)
@@ -25,8 +25,9 @@
#include "CacheSystem.h"
#include <OgreConfigFile.h>
+#include "IManager.h"
-class TerrainManager : public ZeroedMemoryAllocator
+class TerrainManager : public IManager
{
friend class CacheSystem;
friend class TerrainObjectManager;
@@ -40,7 +41,7 @@
void loadTerrainConfigBasics(Ogre::DataStreamPtr &ds);
- void update(float dt);
+ bool update(float dt);
void setGravity(float value);
float getGravity() { return gravity; };
@@ -58,6 +59,9 @@
Water *getWater() { return water; };
bool getTrucksLoaded() { return trucksLoaded; };
+ size_t getMemoryUsage();
+ void freeResources();
+
protected:
// members
Ogre::ConfigFile mTerrainConfig;
Modified: trunk/source/main/terrain/TerrainObjectManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainObjectManager.cpp 2012-06-06 22:39:49 UTC
(rev 2790)
+++ trunk/source/main/terrain/TerrainObjectManager.cpp 2012-06-07 10:02:14 UTC
(rev 2791)
@@ -1242,3 +1242,14 @@
return true;
}
+
+size_t TerrainObjectManager::getMemoryUsage()
+{
+ // very rough estamation
+ return (sizeof(loadedObject_t) * loadedObjects.size());
+}
+
+void TerrainObjectManager::freeResources()
+{
+ // TODO
+}
Modified: trunk/source/main/terrain/TerrainObjectManager.h
===================================================================
--- trunk/source/main/terrain/TerrainObjectManager.h 2012-06-06 22:39:49 UTC
(rev 2790)
+++ trunk/source/main/terrain/TerrainObjectManager.h 2012-06-07 10:02:14 UTC
(rev 2791)
@@ -31,9 +31,10 @@
#include "TreeLoader2D.h"
#include "TreeLoader3D.h"
#endif //USE_PAGED
+#include "IManager.h"
-class TerrainObjectManager : public ZeroedMemoryAllocator
+class TerrainObjectManager : public IManager
{
friend class TerrainManager;
public:
@@ -123,6 +124,11 @@
void loadPreloadedTrucks();
bool updateAnimatedObjects(float dt);
void postLoad();
+
+ virtual size_t getMemoryUsage();
+
+ virtual void freeResources();
+
};
#endif // __TerrainObjectManager_H_
Added: trunk/source/main/utils/IBehaviorManager.h
===================================================================
--- trunk/source/main/utils/IBehaviorManager.h (rev 0)
+++ trunk/source/main/utils/IBehaviorManager.h 2012-06-07 10:02:14 UTC (rev
2791)
@@ -0,0 +1,44 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2012 Pierre-Michel Ricordel
+Copyright 2007-2012 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef __IBehaviorManager_H__
+#define __IBehaviorManager_H__
+
+#include "RoRPrerequisites.h"
+
+class IBehaviorManager : public ZeroedMemoryAllocator
+{
+public:
+
+ virtual ~IBehaviorManager() {}
+
+ virtual void update(float dt) = 0;
+
+ virtual void switchBehavior(int newBehavior, bool reset = true) = 0;
+ virtual void switchToNextBehavior(bool force = true) = 0;
+ virtual void toggleBehavior(int behavior) = 0;
+
+ virtual bool hasActiveBehavior() = 0;
+ virtual bool hasActiveCharacterBehavior() = 0;
+ virtual bool hasActiveVehicleBehavior() = 0;
+
+ virtual int getCurrentBehavior() = 0;
+};
+
+#endif // __IBehaviorManager_H__
Modified: trunk/source/main/utils/IManager.h
===================================================================
--- trunk/source/main/utils/IManager.h 2012-06-06 22:39:49 UTC (rev 2790)
+++ trunk/source/main/utils/IManager.h 2012-06-07 10:02:14 UTC (rev 2791)
@@ -17,28 +17,19 @@
You should have received a copy of the GNU General Public License
along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __I_Manager_H_
-#define __I_Manager_H_
+#ifndef IMANAGER_H__
+#define IMANAGER_H__
#include "RoRPrerequisites.h"
class IManager : public ZeroedMemoryAllocator
{
public:
-
virtual ~IManager() {}
- virtual void update(float dt) = 0;
-
- virtual void switchBehavior(int newBehavior, bool reset = true) = 0;
- virtual void switchToNextBehavior(bool force = true) = 0;
- virtual void toggleBehavior(int behavior) = 0;
-
- virtual bool hasActiveBehavior() = 0;
- virtual bool hasActiveCharacterBehavior() = 0;
- virtual bool hasActiveVehicleBehavior() = 0;
-
- virtual int getCurrentBehavior() = 0;
+ virtual bool update(float dt) = 0;
+ virtual size_t getMemoryUsage() = 0;
+ virtual void freeResources() = 0;
};
-#endif // __I_Manager_H_
+#endif // IMANAGER_H__
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel