Revision: 1709
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1709&view=rev
Author: rorthomas
Date: 2011-02-28 12:19:59 +0000 (Mon, 28 Feb 2011)
Log Message:
-----------
"fixed" game exit
Modified Paths:
--------------
trunk/source/main/framework/AppStateManager.cpp
trunk/source/main/framework/ContentManager.cpp
trunk/source/main/framework/ContentManager.h
trunk/source/main/framework/GameState.cpp
trunk/source/main/gameplay/RoRFrameListener.cpp
trunk/source/main/gameplay/RoRFrameListener.h
Modified: trunk/source/main/framework/AppStateManager.cpp
===================================================================
--- trunk/source/main/framework/AppStateManager.cpp 2011-02-28 01:18:28 UTC
(rev 1708)
+++ trunk/source/main/framework/AppStateManager.cpp 2011-02-28 12:19:59 UTC
(rev 1709)
@@ -78,7 +78,8 @@
while(!m_bShutdown)
{
-
if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isClosed())m_bShutdown =
true;
+ if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isClosed())
+ m_bShutdown = true;
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM ==
OGRE_PLATFORM_LINUX
Ogre::WindowEventUtilities::messagePump();
@@ -103,7 +104,6 @@
#endif
}
}
-
LogManager::getSingleton().logMessage("Main loop quit");
}
Modified: trunk/source/main/framework/ContentManager.cpp
===================================================================
--- trunk/source/main/framework/ContentManager.cpp 2011-02-28 01:18:28 UTC
(rev 1708)
+++ trunk/source/main/framework/ContentManager.cpp 2011-02-28 12:19:59 UTC
(rev 1709)
@@ -234,6 +234,20 @@
bool ContentManager::resourceCollision(Ogre::Resource *resource,
Ogre::ResourceManager *resourceManager)
{
+ /*
+ // TODO: do something useful here
+ if(resourceManager->getResourceType() == "Material")
+ {
+ if(instanceCountMap.find(resource->getName()) ==
instanceCountMap.end())
+ {
+ instanceCountMap[resource->getName()] = 1;
+ }
+ int count = instanceCountMap[resource->getName()]++;
+ MaterialPtr mat =
(MaterialPtr)resourceManager->create(resource->getName() +
StringConverter::toString(count), resource->getGroup());
+ resource = (Ogre::Resource *)mat.getPointer();
+ return true;
+ }
+ */
return false;
}
Modified: trunk/source/main/framework/ContentManager.h
===================================================================
--- trunk/source/main/framework/ContentManager.h 2011-02-28 01:18:28 UTC
(rev 1708)
+++ trunk/source/main/framework/ContentManager.h 2011-02-28 12:19:59 UTC
(rev 1709)
@@ -47,6 +47,7 @@
void resourceStreamOpened(const Ogre::String &name, const Ogre::String
&group, Ogre::Resource *resource, Ogre::DataStreamPtr& dataStream);
bool resourceCollision(Ogre::Resource *resource, Ogre::ResourceManager
*resourceManager);
+ //std::map<Ogre::String,int> instanceCountMap;
};
#endif // CONTENTMANAGER_H__
Modified: trunk/source/main/framework/GameState.cpp
===================================================================
--- trunk/source/main/framework/GameState.cpp 2011-02-28 01:18:28 UTC (rev
1708)
+++ trunk/source/main/framework/GameState.cpp 2011-02-28 12:19:59 UTC (rev
1709)
@@ -4,6 +4,8 @@
using namespace Ogre;
+RoRFrameListener *mFrameListener = 0;
+
GameState::GameState()
{
}
@@ -32,7 +34,7 @@
LogManager::getSingleton().logMessage("Adding Frame Listener");
bool isEmbedded = OgreFramework::getSingleton().isEmbedded();
- RoRFrameListener *mFrameListener = new RoRFrameListener(
+ mFrameListener = new RoRFrameListener(this,
OgreFramework::getSingleton().m_pRenderWnd,
m_pCamera,
m_pSceneMgr,
@@ -64,9 +66,19 @@
{
LogManager::getSingleton().logMessage("Leaving GameState...");
+ if(mFrameListener)
+ {
+
OgreFramework::getSingleton().m_pRoot->removeFrameListener(mFrameListener);
+ delete mFrameListener;
+ }
+
m_pSceneMgr->destroyCamera(m_pCamera);
if(m_pSceneMgr)
OgreFramework::getSingletonPtr()->m_pRoot->destroySceneManager(m_pSceneMgr);
+
+ // hack: leave game here
+
+ std::exit(0);
}
void GameState::createScene()
Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp 2011-02-28 01:18:28 UTC
(rev 1708)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp 2011-02-28 12:19:59 UTC
(rev 1709)
@@ -753,7 +753,8 @@
}
// Constructor takes a RenderWindow because it uses that to determine input
context
-RoRFrameListener::RoRFrameListener(RenderWindow* win, Camera* cam,
SceneManager* scm, Root* root, bool isEmbedded, unsigned int inputhwnd) :
+RoRFrameListener::RoRFrameListener(AppState *parentState, RenderWindow* win,
Camera* cam, SceneManager* scm, Root* root, bool isEmbedded, unsigned int
inputhwnd) :
+ parentState(parentState),
initialized(false),
mCollisionTools(0),
isEmbedded(isEmbedded),
@@ -1326,6 +1327,7 @@
RoRFrameListener::~RoRFrameListener()
{
+ mWindow->removeListener(&disableListener);
#ifdef USE_MYGUI
LoadingWindow::FreeInstance();
SelectorWindow::FreeInstance();
@@ -4367,6 +4369,8 @@
//mInputManager->destroyInputObject(mKeyboard); mKeyboard = 0;
//OIS::InputManager::destroyInputSystem(mInputManager); mInputManager =
0;
+
+
shutdownall=true;
//terrainmaterial->getBestTechnique()->getPass(0)->getTextureUnitState(0)->setTextureName(terrainoriginalmaterial);
}
@@ -5471,13 +5475,13 @@
Vector3 pos = Vector3(px,py,pz);
Ogre::ColourValue BackgroundColour =
Ogre::ColourValue::White;//Ogre::ColourValue(0.1337f, 0.1337f, 0.1337f, 1.0f);
- Ogre::ColourValue GridColour =
Ogre::ColourValue(0.2000f, 0.2000f, 0.2000f, 1.0f);
+ Ogre::ColourValue GridColour = Ogre::ColourValue(0.9f,
0.9f, 0.9f, 1.0f);
Ogre::ManualObject *mReferenceObject = new
Ogre::ManualObject("ReferenceGrid");
mReferenceObject->begin("BaseWhiteNoLighting",
Ogre::RenderOperation::OT_LINE_LIST);
- Ogre::Real step = 1.0f;
+ Ogre::Real step = 10.0f;
unsigned int count = 200;
unsigned int halfCount = count / 2;
Ogre::Real full = (step * count);
@@ -5519,7 +5523,7 @@
mReferenceObject->end();
mReferenceObject->setCastShadows(false);
SceneNode *n =
mSceneMgr->getRootSceneNode()->createChildSceneNode();
- n->setPosition(pos - Vector3(count / 2, 0, count / 2));
+ n->setPosition(pos);
n->attachObject(mReferenceObject);
n->setVisible(true);
}
@@ -7066,7 +7070,10 @@
return false;
if(shutdownall) // shortcut: press ESC in credits
+ {
+ parentState->exit();
return false;
+ }
// the truck we use got deleted D:
if(current_truck != -1 && trucks[current_truck] == 0)
Modified: trunk/source/main/gameplay/RoRFrameListener.h
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.h 2011-02-28 01:18:28 UTC
(rev 1708)
+++ trunk/source/main/gameplay/RoRFrameListener.h 2011-02-28 12:19:59 UTC
(rev 1709)
@@ -53,6 +53,7 @@
#include "ChatSystem.h"
#include "envmap.h"
#include "ForceFeedback.h"
+#include "AppState.h"
#ifdef USE_PAGED
# include "PagedGeometry.h"
@@ -282,9 +283,10 @@
void initDust();
unsigned int inputhwnd;
bool ingame_console;
+ AppState *parentState;
public:
// Constructor takes a RenderWindow because it uses that to determine
input context
- RoRFrameListener(RenderWindow* win, Camera* cam, SceneManager* scm,
Root* root, bool isEmbedded=false, unsigned int inputhwnd=0);
+ RoRFrameListener(AppState *parent, RenderWindow* win, Camera* cam,
SceneManager* scm, Root* root, bool isEmbedded=false, unsigned int inputhwnd=0);
virtual ~RoRFrameListener();
void removeBeam(Beam *);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel