Revision: 2689
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2689&view=rev
Author:   rorthomas
Date:     2012-05-26 03:57:19 +0000 (Sat, 26 May 2012)
Log Message:
-----------
autopilot compiling ^^

Modified Paths:
--------------
    trunk/source/main/gameplay/Character.cpp
    trunk/source/main/gameplay/GEnv.h
    trunk/source/main/gameplay/autopilot.cpp
    trunk/source/main/gameplay/autopilot.h
    trunk/source/main/terrain/TerrainGeometryManager.cpp
    trunk/source/main/terrain/TerrainGeometryManager.h

Modified: trunk/source/main/gameplay/Character.cpp
===================================================================
--- trunk/source/main/gameplay/Character.cpp    2012-05-26 03:52:34 UTC (rev 
2688)
+++ trunk/source/main/gameplay/Character.cpp    2012-05-26 03:57:19 UTC (rev 
2689)
@@ -37,7 +37,7 @@
 
 unsigned int Character::characterCounter = 0;
 
-Character::Character(Camera *cam, Collisions *c, Network *net, HeightFinder 
*h, Water *w, MapControl *m, SceneManager *scm, int source, unsigned int 
streamid, int colourNumber, bool remote) :
+Character::Character(Camera *cam, Collisions *c, Network *net, MapControl *m, 
SceneManager *scm, int source, unsigned int streamid, int colourNumber, bool 
remote) :
          beamCoupling(0)
        , canJump(false)
        , characterRotation(0.0f)
@@ -45,7 +45,6 @@
        , characterVSpeed(0.0f)
        , collisions(c)
        , colourNumber(colourNumber)
-       , hFinder(h)
        , last_net_time(0)
        , mAnimState(0)
        , mCamera(cam)
@@ -252,11 +251,6 @@
        this->collisions = collisions;
 }
 
-void Character::setHFinder(HeightFinder *hFinder)
-{
-       this->hFinder = hFinder;
-}
-
 void Character::setWater(Water *water)
 {
        this->water = water;
@@ -344,7 +338,7 @@
                mLastPosition = position;
 
                // ground contact
-               float pheight = hFinder->getHeightAt(position.x,position.z);
+               float pheight = 
gEnv->heightFinder->getHeightAt(position.x,position.z);
 
                if (position.y < pheight)
                {

Modified: trunk/source/main/gameplay/GEnv.h
===================================================================
--- trunk/source/main/gameplay/GEnv.h   2012-05-26 03:52:34 UTC (rev 2688)
+++ trunk/source/main/gameplay/GEnv.h   2012-05-26 03:57:19 UTC (rev 2689)
@@ -23,20 +23,36 @@
 class RoRFrameListener;
 class TerrainManager;
 class Collisions;
+class IHeightFinder;
+class Water;
 
 class GlobalEnvironment
 {
 public:
+       GlobalEnvironment() :
+             ogreRoot(0)
+               , ogreViewPort(0)
+               , ogreRenderWindow(0)
+               , ogreCamera(0)
+               , ogreSceneManager(0)
+               , frameListener(0)
+               , terrainManager(0)
+               , collisions(0)
+               , heightFinder(0)
+               , water(0)
+       {
+       }
        Ogre::Root *ogreRoot;
        Ogre::Viewport *ogreViewPort;
        Ogre::RenderWindow *ogreRenderWindow;
        Ogre::Camera *ogreCamera;
        Ogre::SceneManager *ogreSceneManager;
 
-       RoRFrameListener *framelistener;
+       RoRFrameListener *frameListener;
        TerrainManager *terrainManager;
        Collisions *collisions;
-
+       IHeightFinder *heightFinder;
+       Water *water;
 };
 
 #endif // GEnv_H__

Modified: trunk/source/main/gameplay/autopilot.cpp
===================================================================
--- trunk/source/main/gameplay/autopilot.cpp    2012-05-26 03:52:34 UTC (rev 
2688)
+++ trunk/source/main/gameplay/autopilot.cpp    2012-05-26 03:57:19 UTC (rev 
2689)
@@ -23,14 +23,13 @@
 #include "heightfinder.h"
 #include "IWater.h"
 #include "SoundScriptManager.h"
+#include "IHeightFinder.h"
 
 using namespace Ogre;
 
-Autopilot::Autopilot(HeightFinder *hfd, Water *w, int trucknum)
+Autopilot::Autopilot(int trucknum)
 {
        this->trucknum=trucknum;
-       water=w;
-       hf=hfd;
        ref_l=NULL;
        ref_r=NULL;
        ref_b=NULL;
@@ -271,10 +270,10 @@
 {
 #ifdef USE_OPENAL
        if (SoundScriptManager::getSingleton().isDisabled()) return;
-       if (mode_gpws && hf && ref_b)
+       if (mode_gpws && gEnv->heightFinder && ref_b)
        {
-               float groundalt=hf->getHeightAt(ref_c->AbsPosition.x, 
ref_c->AbsPosition.z);
-               if (water && groundalt<water->getHeight()) 
groundalt=water->getHeight();
+               float 
groundalt=gEnv->heightFinder->getHeightAt(ref_c->AbsPosition.x, 
ref_c->AbsPosition.z);
+               if (gEnv->water && groundalt<gEnv->water->getHeight()) 
groundalt=gEnv->water->getHeight();
                float 
height=(ref_c->AbsPosition.y-groundalt-spawnheight)*3.28083f; //in feet!
                //skip height warning sounds when the plane is slower then ~10 
knots
                if (( ref_c->Velocity.length() * 1.9685f) > 10.0f)

Modified: trunk/source/main/gameplay/autopilot.h
===================================================================
--- trunk/source/main/gameplay/autopilot.h      2012-05-26 03:52:34 UTC (rev 
2688)
+++ trunk/source/main/gameplay/autopilot.h      2012-05-26 03:57:19 UTC (rev 
2689)
@@ -40,10 +40,8 @@
        float last_elevator;
        float last_aileron;
        float last_rudder;
-       HeightFinder *hf;
        float last_gpws_height;
        float last_pullup_height;
-       Water *water;
        float lastradiov;
        float lastradioh;
        float lastradiorwh;
@@ -60,7 +58,7 @@
        int heading;
        bool wantsdisconnect;
 
-       Autopilot(HeightFinder *hfd, Water *w, int trucknum);
+       Autopilot(int trucknum);
        void reset();
        void disconnect();
        void setInertialReferences(node_t *refl, node_t *refr, node_t *refb, 
node_t *refc);

Modified: trunk/source/main/terrain/TerrainGeometryManager.cpp
===================================================================
--- trunk/source/main/terrain/TerrainGeometryManager.cpp        2012-05-26 
03:52:34 UTC (rev 2688)
+++ trunk/source/main/terrain/TerrainGeometryManager.cpp        2012-05-26 
03:57:19 UTC (rev 2689)
@@ -27,10 +27,13 @@
 using namespace Ogre;
 
 TerrainGeometryManager::TerrainGeometryManager(TerrainManager *terrainManager) 
:
-         terrainManager(terrainManager)
+         mSceneMgr(0)
+       , terrainManager(terrainManager)
        , disableCaching(false)
        , mTerrainsImported(false)
 {
+       mSceneMgr = gEnv->ogreSceneManager;
+       gEnv->heightFinder = this;
 }
 
 TerrainGeometryManager::~TerrainGeometryManager()

Modified: trunk/source/main/terrain/TerrainGeometryManager.h
===================================================================
--- trunk/source/main/terrain/TerrainGeometryManager.h  2012-05-26 03:52:34 UTC 
(rev 2688)
+++ trunk/source/main/terrain/TerrainGeometryManager.h  2012-05-26 03:57:19 UTC 
(rev 2689)
@@ -17,8 +17,8 @@
 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 __TerrainGeometryManager_H_
-#define __TerrainGeometryManager_H_
+#ifndef TerrainGeometryManager_H__
+#define TerrainGeometryManager_H__
 
 #include "RoRPrerequisites.h"
 
@@ -30,11 +30,12 @@
 
 #include <OgreConfigFile.h>
 
+#include "IHeightFinder.h"
+
 // this class handles all interactions with the Ogre Terrain system
-class TerrainGeometryManager
+class TerrainGeometryManager : public IHeightFinder
 {
 public:
-
        TerrainGeometryManager(TerrainManager *terrainManager);
        ~TerrainGeometryManager();
 
@@ -58,16 +59,16 @@
        }
 
 protected:
-
-       Ogre::ConfigFile terrainConfig;
-       Ogre::String baseName;
-       TerrainManager *terrainManager;
-       TerrainObjectManager *objectManager;
        bool disableCaching;
        bool mTerrainsImported;
+       Ogre::SceneManager *mSceneMgr;
+       TerrainManager *terrainManager;
        int mapsizex, mapsizey, mapsizez, pageSize, terrainSize, worldSize;
+       Ogre::String baseName;
+       Ogre::ConfigFile terrainConfig;
        int pageMinX, pageMaxX, pageMinY, pageMaxY;
        int terrainLayers;
+       TerrainObjectManager *objectManager;
 
        // terrain engine specific
        Ogre::TerrainGroup *mTerrainGroup;
@@ -89,5 +90,6 @@
        void initBlendMaps( Ogre::Terrain* t );
        void getTerrainImage(int x, int y, Ogre::Image& img);
 };
+#endif // TerrainGeometryManager_H__
 
-#endif // __TerrainGeometryManager_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

Reply via email to