From: <spo...@us...> - 2009-02-14 19:11:11
|
Revision: 1031 http://opengate.svn.sourceforge.net/opengate/?rev=1031&view=rev Author: spom_spom Date: 2009-02-14 19:11:02 +0000 (Sat, 14 Feb 2009) Log Message: ----------- fixed a couple of mem-leaks, deactivate soundmanager, add planet and ecliptic plane Modified Paths: -------------- trunk/data/materials/gradientshader.cg trunk/src/AiManager.cpp trunk/src/Entity.cpp trunk/src/Entity.h trunk/src/GameStateManager.cpp trunk/src/KeyMap.cpp trunk/src/KeyMap.h trunk/src/Makefile.am trunk/src/OpcodeWrapper.cpp trunk/src/OpenALSoundManager.cpp trunk/src/OpenALSoundManager.h trunk/src/Opengate.h trunk/src/Sector.cpp trunk/src/Sector.h trunk/src/SectorBaseObject.h trunk/src/UnDockedState.cpp trunk/src/UnDockedState.h trunk/src/Vessel.cpp trunk/src/Vessel.h trunk/src/opengateclient.cpp Removed Paths: ------------- trunk/src/Planet.cpp trunk/src/Planet.h Modified: trunk/data/materials/gradientshader.cg =================================================================== --- trunk/data/materials/gradientshader.cg 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/data/materials/gradientshader.cg 2009-02-14 19:11:02 UTC (rev 1031) @@ -12,6 +12,7 @@ ) { // Get the custom parameters + //float objectradius = sqrt(customParamRadius.x*customParamRadius.x*+ customParamRadius.y*customParamRadius.y+customParamRadius.z*customParamRadius.z); float objectradius = customParamRadius.x; // calculate output position Modified: trunk/src/AiManager.cpp =================================================================== --- trunk/src/AiManager.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/AiManager.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -113,6 +113,7 @@ AiObject * ai = createAiObject( name ); + //** please ensure delete of the vessel after cleaning this code SectorVesselObject * obj = dynamic_cast < UnDockedState *>(resources_->gameStateRoot->activeState() )->sector()->createVesselObject( new Vessel( *resources_->entityManager->vessel( "apteryx" ) ) ); Modified: trunk/src/Entity.cpp =================================================================== --- trunk/src/Entity.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Entity.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -54,6 +54,10 @@ setFactionName_( ResourceManager::getSingleton().factionName( factionID_ ) ); } +Entity::~Entity(){ + +} + void Entity::readPropertiesFromXML( TiXmlHandle & hRoot ){ readXMLNode< std::string >( hRoot, "name_"+ ResourceManager::getSingleton().languageSuffix() + " name_en name", this, &OpenGate::Entity::setName, true ); @@ -142,7 +146,9 @@ baseScale_ = 0.0; } -MeshEntity::~MeshEntity(){} +MeshEntity::~MeshEntity(){ + if ( !pMesh_.isNull() ) Ogre::MeshManager::getSingleton().unload( pMesh_->getName() ); +} void MeshEntity::readPropertiesFromXML( TiXmlHandle & hRoot ){ Entity::readPropertiesFromXML( hRoot ); Modified: trunk/src/Entity.h =================================================================== --- trunk/src/Entity.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Entity.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -72,7 +72,7 @@ public: Entity(); - virtual ~Entity(){ } + virtual ~Entity(); virtual EntityType entityType() const { return rtti_; } Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/GameStateManager.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -63,9 +63,6 @@ } GameStateManager::~GameStateManager( ){ -// delete resources_->guiSystem; -// delete resources_->guiRenderer; - while ( !stateStack_.empty() ){ cleanup_( stateStack_.back() ); stateStack_.back()->exit(); @@ -75,51 +72,60 @@ states_.back().state->destroy(); states_.pop_back(); } - - if ( resources_.aiManager ) { - log_->info( "Shutdown ai manager." ); - delete resources_.aiManager; - resources_.aiManager = NULL; - } - if ( resources_.console ){ - log_->info( "Shutdown console." ); - delete resources_.console; - resources_.console = NULL; - } - if ( resources_.entityManager ){ - log_->info( "Shutdown entitymanager." ); - delete resources_.entityManager; - resources_.entityManager = NULL; - } - if ( resources_.soundManager ) { - log_->info( "Shutdown soundmanager." ); -// delete resources_.soundManager; -// resources_.soundManager = NULL; - } - if ( resources_.inputManager ) { - log_->info( "Shutdown inputmanager." ); - delete resources_.inputManager; - resources_.inputManager = NULL; - } - - log_->info( "Shutdown renderWindow." ); - if ( resources_.renderWindow ) delete resources_.renderWindow; - log_->info( "Shutdown ogreRoot." ); - //** segfault caused by destroying ShipConfigDialog::ceguiTex_ - // if ( resources_.ogreRoot ) delete resources_.ogreRoot; + if ( resources_.avatar ) delete resources_.avatar; + + if ( resources_.collisionManager ) delete resources_.collisionManager; + + if ( configDialog_ ) delete configDialog_; + + if ( resources_.aiManager ) { + log_->info( "Shutdown ai manager." ); + delete resources_.aiManager; + resources_.aiManager = NULL; + } + if ( resources_.console ){ + log_->info( "Shutdown console." ); + delete resources_.console; + resources_.console = NULL; + } + if ( resources_.entityManager ){ + log_->info( "Shutdown entitymanager." ); + delete resources_.entityManager; + resources_.entityManager = NULL; + } + if ( resources_.soundManager ) { + log_->info( "Shutdown soundmanager." ); + delete resources_.soundManager; + resources_.soundManager = NULL; + } + if ( resources_.guiRenderer ) { + log_->info( "Shutdown CEGUI manager." ); + delete resources_.guiSystem; + //delete resources_.guiRenderer; + } + if ( resources_.inputManager ) { + log_->info( "Shutdown inputmanager." ); + delete resources_.inputManager; + resources_.inputManager = NULL; + } + if ( resources_.ogreRoot() ) { + log_->info( "Shutdown ogreRoot." ); + Ogre::Root * root = resources_.ogreRoot(); + delete root; + } } bool GameStateManager::initialiseBootstrap( bool dialog ){ - resources_.setOgreRoot( *new Ogre::Root ); - resources_.gameStateRoot = this; + resources_.setOgreRoot( *new Ogre::Root ); + resources_.gameStateRoot = this; - if ( !initialiseOgreEngine_( dialog ) ) { - log_->fatal( "Cannot initialize ogre engine." ); - return false; - } - initialiseBootstrapResources(); - initLoadingVector(); - return true; + if ( !initialiseOgreEngine_( dialog ) ) { + log_->fatal( "Cannot initialize ogre engine." ); + return false; + } + initialiseBootstrapResources(); + initLoadingVector(); + return true; } bool GameStateManager::initialiseOgreEngine_( bool dialog ){ @@ -262,7 +268,7 @@ } bool GameStateManager::initialiseSoundManager(){ - resources_.soundManager = new OpenALSoundManager( ); + resources_.soundManager = new OpenALSoundManager( true ); resources_.soundManager->loadRessourceNames( resources_.findFullFileName( "sounds.xml" ) ); return true; } Modified: trunk/src/KeyMap.cpp =================================================================== --- trunk/src/KeyMap.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/KeyMap.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -28,6 +28,9 @@ KeyMap::KeyMap() : modifier_( KEY_NONE ){ } +KeyMap::~KeyMap(){ +} + void KeyMap::setDefaults(){ /*! Actions for undocked state */ unDockedActionMap_[ keycode( 70 ) ] = &UnDockedState::keyActionSwitchMinMaxConsole; @@ -89,6 +92,7 @@ unDockedActionMap_[ keycode( OIS::KC_F8 ) ] = &UnDockedState::keyActionAvatarSelfDestruct_DEV; unDockedActionMap_[ keycode( OIS::KC_F7 ) ] = &UnDockedState::keyActionSpawnAi_DEV; unDockedActionMap_[ keycode( OIS::KC_I, KEY_CONTROL ) ] = &UnDockedState::keyActionShowInfos_DEV; + unDockedActionMap_[ keycode( OIS::KC_E, KEY_SHIFT ) ] = &UnDockedState::keyActionShowEcliptic_DEV; } bool(UnDockedState::*KeyMap::unDockedKeyAction( const OIS::KeyEvent & e ))(bool) { Modified: trunk/src/KeyMap.h =================================================================== --- trunk/src/KeyMap.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/KeyMap.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -21,8 +21,8 @@ #ifndef _OPENGATE_KEYMAP__H #define _OPENGATE_KEYMAP__H -#include "Opengate.h" - +#include "Opengate.h" + #include <map> #include <sys/types.h> //#include "InputManager.h" @@ -37,9 +37,10 @@ class KeyMap{ public: + KeyMap(); + + ~KeyMap(); - KeyMap(); - void setDefaults(); bool (UnDockedState::*unDockedKeyAction( const OIS::KeyEvent & e ))( bool ); Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Makefile.am 2009-02-14 19:11:02 UTC (rev 1031) @@ -70,8 +70,6 @@ Opengate.h \ OpenALSoundManager.h \ OpenALSoundManager.cpp \ - Planet.h \ - Planet.cpp \ Projectile.h \ Projectile.cpp \ RadarObject.h \ @@ -92,6 +90,8 @@ SectorChildObject.cpp \ SectorCollisionObject.h \ SectorCollisionObject.cpp \ + SectorEnvironmentObject.h \ + SectorEnvironmentObject.cpp \ SectorExplosionObject.h \ SectorExplosionObject.cpp \ SectorMeshObject.h \ Modified: trunk/src/OpcodeWrapper.cpp =================================================================== --- trunk/src/OpcodeWrapper.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/OpcodeWrapper.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -137,7 +137,6 @@ if ( obj && active_ ){ OgreOpcode::ICollisionShape * shape = obj->getShape(); collideInSectorContext_->destroyObject( obj ); - collisionManager_->detachShape( shape ); collisionManager_->destroyShape( shape ); } } Modified: trunk/src/OpenALSoundManager.cpp =================================================================== --- trunk/src/OpenALSoundManager.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/OpenALSoundManager.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -44,6 +44,7 @@ #define STREAM_BUFFER_SIZE (4096 * 100) namespace OpenGate{ + void OpenALSoundSourceDummy::showInfos(){ LogManager::getSingleton().info( "Audio info: dummy " + name_ + " installed " ); } @@ -452,47 +453,47 @@ template<> OpenALSoundManager * Ogre::Singleton< OpenALSoundManager >::ms_Singleton = 0; -OpenALSoundManager::OpenALSoundManager( ){ - maxSources_ = 128; - listener_ = NULL; - oggVorbisExtension_ = false; - mp3Extension_ = false; +OpenALSoundManager::OpenALSoundManager( bool dummy ){ + maxSources_ = 128; + listener_ = NULL; + oggVorbisExtension_ = false; + mp3Extension_ = false; - log_ = LogManager::getSingletonPtr(); - haveSoundDevice_ = true; + log_ = LogManager::getSingletonPtr(); + haveSoundDevice_ = true; - init(); - Ogre::Root::getSingleton().addFrameListener( this ); + init( dummy ); + Ogre::Root::getSingleton().addFrameListener( this ); } OpenALSoundManager::~OpenALSoundManager(){ - Ogre::Root::getSingleton().removeFrameListener( this ); + Ogre::Root::getSingleton().removeFrameListener( this ); - for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); it != mapSoundSources_.end(); ){ - destroySoundSource( it++->second ); - } + for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); it != mapSoundSources_.end(); ){ + destroySoundSource( it++->second ); + } - if ( listener_ ) delete listener_; + if ( listener_ ) delete listener_; - if ( haveSoundDevice_ ){ - ALCcontext *context = alcGetCurrentContext(); - ALCdevice *device = alcGetContextsDevice( context ); - alcMakeContextCurrent( NULL ); - alcDestroyContext( context ); - alcCloseDevice( device ); - } + if ( haveSoundDevice_ ){ + ALCcontext *context = alcGetCurrentContext(); + ALCdevice *device = alcGetContextsDevice( context ); + alcMakeContextCurrent( NULL ); + alcDestroyContext( context ); + alcCloseDevice( device ); + } } bool OpenALSoundManager::frameStarted( const Ogre::FrameEvent & evt ){ - for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); - it != mapSoundSources_.end(); it++){ - it->second->update(); - } - return true; + for ( std::map< std::string, OpenALSoundSource * >::iterator it = mapSoundSources_.begin(); + it != mapSoundSources_.end(); it++){ + it->second->update(); + } + return true; } -bool OpenALSoundManager::init(){ - log_->info( "Initialize Soundmanager ..." ); +bool OpenALSoundManager::init( bool dummy ){ + log_->info( "Initialize Soundmanager ..." ); // if ( alIsExtensionPresent( "AL_EXT_vorbis" ) == AL_TRUE ){ // oggVorbisExtension_ = true; @@ -544,36 +545,36 @@ // } // deviceSpecifiers += strlen( deviceSpecifiers ) + 1; // } -bool disable_ = false; -ALCdevice * device = NULL; - if ( !disable_ ){ - device = alcOpenDevice( NULL ); - // Device = alcOpenDevice((ALubyte*)"DirectSound3D"); - } + + ALCdevice * device = NULL; + if ( !dummy ){ + device = alcOpenDevice( NULL ); + // Device = alcOpenDevice((ALubyte*)"DirectSound3D"); + } - if ( !device ){ - log_->warn( "No sound device detected." ); - haveSoundDevice_ = false; - } + if ( !device ){ + log_->warn( "No sound device detected." ); + haveSoundDevice_ = false; + } - if ( haveSoundDevice_ ){ - log_->info( "Choosing: " + Ogre::String( alcGetString( device, ALC_DEVICE_SPECIFIER) ) ); - ALCcontext * context = alcCreateContext( device, NULL ); + if ( haveSoundDevice_ ){ + log_->info( "Choosing: " + Ogre::String( alcGetString( device, ALC_DEVICE_SPECIFIER) ) ); + ALCcontext * context = alcCreateContext( device, NULL ); - if ( !context ){ - log_->warn( "Can not create sound context." ); - return false; - } + if ( !context ){ + log_->warn( "Can not create sound context." ); + return false; + } - alcMakeContextCurrent( context ); - if ( checkOpenALError( "OpenALSoundManager::init::alcMakeContextCurrent" ) ) return false; + alcMakeContextCurrent( context ); + if ( checkOpenALError( "OpenALSoundManager::init::alcMakeContextCurrent" ) ) return false; - maxSources_ = getMaxSources_(); - } + maxSources_ = getMaxSources_(); + } - listener_ = new OpenALListener( this, !haveSoundDevice_ ); + listener_ = new OpenALListener( this, !haveSoundDevice_ ); - return true; + return true; } void OpenALSoundManager::loadRessourceNames( const std::string & fileName ){ @@ -616,28 +617,28 @@ OpenALSoundSource * OpenALSoundManager::createSoundSource( const std::string & fileName, const std::string & name, bool loop, bool stream ){ - OpenALSoundSource * sound = NULL; + OpenALSoundSource * sound = NULL; - if ( mapSoundSources_.count( name ) ){ - log_->warn( "Sound with name: " + name + " allready registered." ); - mapSoundSources_[ name ]; - } + if ( mapSoundSources_.count( name ) ){ + log_->warn( "Sound with name: " + name + " allready registered." ); + mapSoundSources_[ name ]; + } - if ( haveSoundDevice_ ){ - if ( stream ){ - log_->info( "create sound stream: " + name ); - sound = new OpenALOggStreamSource( this, name ); + if ( haveSoundDevice_ ){ + if ( stream ){ + log_->info( "create sound stream: " + name ); + sound = new OpenALOggStreamSource( this, name ); + } else { + sound = new OpenALSoundSource( this, name ); + } } else { - sound = new OpenALSoundSource( this, name ); + sound = new OpenALSoundSourceDummy( this, name ); } - } else { - sound = new OpenALSoundSourceDummy( this, name ); - } - sound->open( fileName ); - sound->showInfos( ); - mapSoundSources_[ name ] = sound; - return sound; + sound->open( fileName ); + sound->showInfos( ); + mapSoundSources_[ name ] = sound; + return sound; } OpenALSoundSource * OpenALSoundManager::createSoundSourceFromRessource( const std::string & ressourceName, @@ -647,20 +648,20 @@ } void OpenALSoundManager::destroySoundSource( OpenALSoundSource * sound ){ - if ( sound ){ - if ( sound->release() ){ - mapSoundSources_.erase( sound->name() ); - delete sound; + if ( sound ){ + if ( sound->release() ){ + mapSoundSources_.erase( sound->name() ); + delete sound; + } } - } } void OpenALSoundManager::destroySoundSource( const std::string & name ){ - if ( mapSoundSources_.count( name ) ) { - destroySoundSource( mapSoundSources_[ name ] ); - } else { - log_->warn( "OpenALSoundManager::destroySoundSource: ressource with name " + name + " does not exist." ); - } + if ( mapSoundSources_.count( name ) ) { + destroySoundSource( mapSoundSources_[ name ] ); + } else { + log_->warn( "OpenALSoundManager::destroySoundSource: ressource with name " + name + " does not exist." ); + } } bool OpenALSoundManager::checkOpenAlutError( const std::string & str ){ Modified: trunk/src/OpenALSoundManager.h =================================================================== --- trunk/src/OpenALSoundManager.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/OpenALSoundManager.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -24,9 +24,9 @@ #include <string> #include <iostream> #include <map> - -#include "Opengate.h" +#include "Opengate.h" + #include <OgreVector3.h> #include <OgreSingleton.h> #include <OgreFrameListener.h> @@ -174,28 +174,28 @@ /*! OpenALListener, there is just one. YOU! respectivly your avatar. */ class OpenALListener{ public: - OpenALListener( OpenALSoundManager * soundMgr, bool dummy = false); - ~OpenALListener(); + OpenALListener( OpenALSoundManager * soundMgr, bool dummy = false); + ~OpenALListener(); - bool setPosition( float x, float y, float z ); - bool setPosition( const Ogre::Vector3 & pos); + bool setPosition( float x, float y, float z ); + bool setPosition( const Ogre::Vector3 & pos); - bool setVelocity( float x, float y, float z ); - bool setVelocity( const Ogre::Vector3 & vel); + bool setVelocity( float x, float y, float z ); + bool setVelocity( const Ogre::Vector3 & vel); - bool setOrientation( float xf, float yf, float zf, float xu, float yu, float zu ); - bool setOrientation( const Ogre::Vector3 & front, const Ogre::Vector3 & up); + bool setOrientation( float xf, float yf, float zf, float xu, float yu, float zu ); + bool setOrientation( const Ogre::Vector3 & front, const Ogre::Vector3 & up); - void reset( ); + void reset( ); protected: - OpenALSoundManager * soundMgr_; - Ogre::Vector3 position_; - Ogre::Vector3 velocity_; - Ogre::Vector3 directionFront_; - Ogre::Vector3 directionUp_; - float orientation_[ 6 ]; - bool dummy_; + OpenALSoundManager * soundMgr_; + Ogre::Vector3 position_; + Ogre::Vector3 velocity_; + Ogre::Vector3 directionFront_; + Ogre::Vector3 directionUp_; + float orientation_[ 6 ]; + bool dummy_; }; @@ -209,13 +209,13 @@ class OpenALSoundManager : public Ogre::FrameListener, public Ogre::Singleton< OpenALSoundManager >{ public: - OpenALSoundManager( ); + OpenALSoundManager( bool dummy = false ); virtual ~OpenALSoundManager(); virtual bool frameStarted( const Ogre::FrameEvent & evt ); - bool init(); + bool init( bool dummy ); void loadRessourceNames( const std::string & fileName ); Modified: trunk/src/Opengate.h =================================================================== --- trunk/src/Opengate.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Opengate.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -41,15 +41,16 @@ #define SECTOR_BEACON_PAD_OBJECT_RTTI 4 #define SECTOR_CHILD_OBJECT_RTTI 5 #define SECTOR_COLLISION_OBJECT_RTTI 6 -#define SECTOR_EXPLOSION_OBJECT_RTTI 7 -#define SECTOR_MESH_OBJECT_RTTI 8 -#define SECTOR_MISSILE_OBJECT_RTTI 9 -#define SECTOR_MOVABLE_OBJECT_RTTI 10 -#define SECTOR_PAD_OBJECT_RTTI 11 -#define SECTOR_PROJECTILE_OBJECT_RTTI 12 -#define SECTOR_STATION_OBJECT_RTTI 13 -#define SECTOR_STATION_PAD_OBJECT_RTTI 14 -#define SECTOR_VESSEL_OBJECT_RTTI 15 +#define SECTOR_ENVIRONMENT_OBJECT_RTTI 7 +#define SECTOR_EXPLOSION_OBJECT_RTTI 8 +#define SECTOR_MESH_OBJECT_RTTI 9 +#define SECTOR_MISSILE_OBJECT_RTTI 10 +#define SECTOR_MOVABLE_OBJECT_RTTI 11 +#define SECTOR_PAD_OBJECT_RTTI 12 +#define SECTOR_PROJECTILE_OBJECT_RTTI 13 +#define SECTOR_STATION_OBJECT_RTTI 14 +#define SECTOR_STATION_PAD_OBJECT_RTTI 15 +#define SECTOR_VESSEL_OBJECT_RTTI 16 #define SECTOROBJECTENVIRONMENT_RTTI 1000010 #define PROJECTILE_RTTI 100001 @@ -68,9 +69,9 @@ class AiManager; class Avatar; -class BaseObject; +class BaseObject; class Console; -class DockedState; +class DockedState; class UnDockedState; class Gun; @@ -96,11 +97,14 @@ class SectorBeaconPadObject; class SectorChildObject; class SectorCollisionObject; +class SectorEclipticObject; +class SectorEnvironmentObject; class SectorExplosionObject; class SectorMeshObject; class SectorMissileObject; class SectorMovableObject; class SectorPadObject; +class SectorPlanetObject; class SectorProjectileObject; class SectorStationObject; class SectorStationPadObject; @@ -128,31 +132,31 @@ class NetworkClient; class Vessel; - -template < class Class, typename ReturnType, typename Parameter > class SingularCallBack{ -public: - typedef ReturnType ( Class::*Method )( Parameter ); - SingularCallBack( Class * class_instance, Method method ) : class_instance_( class_instance ), method_( method ) { } - - ReturnType operator()( Parameter parameter ) { return ( class_instance_->*method_ )( parameter ); } - ReturnType execute( Parameter parameter ){ return operator()( parameter ); } -private: - Class * class_instance_; - Method method_; -}; - -template < class Object, typename returnT, typename Args > class memberBind { -public: - typedef returnT( Object::*F )( Args ); - memberBind( F function, Object * object) : function_( function ), object_( object ) {} - - returnT operator()( Args args ) const { return ( object_->*function_ )( args ); } -protected: - F function_; - Object object_; -}; - +template < class Class, typename ReturnType, typename Parameter > class SingularCallBack{ +public: + typedef ReturnType ( Class::*Method )( Parameter ); + SingularCallBack( Class * class_instance, Method method ) : class_instance_( class_instance ), method_( method ) { } + + ReturnType operator()( Parameter parameter ) { return ( class_instance_->*method_ )( parameter ); } + ReturnType execute( Parameter parameter ){ return operator()( parameter ); } +private: + Class * class_instance_; + Method method_; +}; + +template < class Object, typename returnT, typename Args > class memberBind { +public: + typedef returnT( Object::*F )( Args ); + memberBind( F function, Object * object) : function_( function ), object_( object ) {} + + returnT operator()( Args args ) const { return ( object_->*function_ )( args ); } +protected: + F function_; + Object object_; +}; + + } // namespace OpenGate #endif // _OPENGATE_OPENGATE__H Deleted: trunk/src/Planet.cpp =================================================================== --- trunk/src/Planet.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Planet.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -1,238 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "Planet.h" - -#include <OgreSceneManager.h> -#include <OgreEntity.h> -#include <OgreSceneNode.h> -#include <OgreMeshManager.h> -#include <OgreSubMesh.h> -#include <OgreVector3.h> -#include <OgreLight.h> - -namespace OpenGate{ - -Planet::Planet( const std::string & name, Ogre::SceneManager * SceneMgr, const Ogre::Vector3 & relPos, - Ogre::Real radius, int segments ) - : name_( name ), sceneMgr_( SceneMgr ){ - - planetNode_ = NULL; - planetCloudNode_ = NULL; - planetCloudEntity_ = NULL; - planetEntity_ = NULL; - light_ = NULL; - - createSphere_( name + "/Mesh", radius, segments, segments ); - planetNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode(name); - - planetEntity_ = sceneMgr_->createEntity( name, name + "/Mesh" ); - planetEntity_->setMaterialName( "Planet" ); - - planetNode_->attachObject( planetEntity_ ); - planetNode_->setPosition( relPos ); - //planetNode_->pitch( Ogre::Degree(30) ); - - planetCloudNode_ = planetNode_->createChildSceneNode( planetNode_->getName() + "/cloud" ); - - planetCloudEntity_ = planetEntity_->clone( planetCloudNode_->getName() ); - planetCloudEntity_->setMaterialName( "Planet/Cloud" ); - - planetCloudNode_->attachObject( planetCloudEntity_ ); - planetCloudNode_->scale(1.015, 1.015, 1.015); - - light_ = sceneMgr_->createLight( name + "-light"); - light_->setDiffuseColour( 0.1, 0.1, 0.1 ); - light_->setSpecularColour( 0.4, 0.4, 0.4 ); - planetNode_->attachObject( light_ ); - - this->lighting( false ); -} - -Planet::~Planet( ){ - if ( planetNode_ ) { - if ( light_ ){ - planetNode_->detachObject( light_ ); - sceneMgr_->destroyLight( light_->getName() ); - } - if ( planetCloudNode_ ){ - if ( planetCloudEntity_ ){ - planetCloudNode_->detachObject( planetCloudEntity_ ); - sceneMgr_->destroyEntity( planetCloudEntity_ ); - } - planetNode_->removeAndDestroyChild( planetCloudNode_->getName() ); - } - if ( planetEntity_ ){ - Ogre::MeshManager::getSingleton().remove( name_ + "/Mesh" ); - planetNode_->detachObject( planetEntity_ ); - sceneMgr_->destroyEntity( planetEntity_ ); - } - sceneMgr_->getRootSceneNode()->removeAndDestroyChild( planetNode_->getName() ); - } -} - -void Planet::update( float elapsedTime ){ - planetNode_->yaw( Ogre::Degree( 0.2 * elapsedTime ) ); - planetCloudNode_->yaw( Ogre::Degree( 0.1 * elapsedTime ) ); -} - -void Planet::lighting( bool on ){ - light_->setVisible( on ); -} - -void Planet::createSphere_( const std::string & strName, const float r, const int nRings, const int nSegments ){ - Ogre::MeshPtr pSphere = Ogre::MeshManager::getSingleton().createManual(strName, - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - Ogre::SubMesh *pSphereVertex = pSphere->createSubMesh(); - - pSphere->sharedVertexData = new Ogre::VertexData(); - Ogre::VertexData* vertexData = pSphere->sharedVertexData; - - // define the vertex format - Ogre::VertexDeclaration* vertexDecl = vertexData->vertexDeclaration; - size_t currOffset = 0; - // positions - vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT3, Ogre::VES_POSITION); - currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3); - // normals - vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT3, Ogre::VES_NORMAL); - currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3); - // two dimensional texture coordinates - vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0); - currOffset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2); - - // allocate the vertex buffer - vertexData->vertexCount = (nRings + 1) * (nSegments+1); - Ogre::HardwareVertexBufferSharedPtr vBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer( vertexDecl->getVertexSize(0), vertexData->vertexCount, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); - Ogre::VertexBufferBinding* binding = vertexData->vertexBufferBinding; - binding->setBinding(0, vBuf); - float* pVertex = static_cast<float*>(vBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); - - // allocate index buffer - pSphereVertex->indexData->indexCount = 6 * nRings * (nSegments + 1); - pSphereVertex->indexData->indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer( - Ogre::HardwareIndexBuffer::IT_16BIT, pSphereVertex->indexData->indexCount, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); - Ogre::HardwareIndexBufferSharedPtr iBuf = pSphereVertex->indexData->indexBuffer; - unsigned short* pIndices = static_cast<unsigned short*>(iBuf->lock(Ogre::HardwareBuffer::HBL_DISCARD)); - - float fDeltaRingAngle = (Ogre::Math::PI / nRings); - float fDeltaSegAngle = (2.0 * Ogre::Math::PI / nSegments); - unsigned short wVerticeIndex = 0 ; - - // Generate the group of rings for the sphere - for ( int ring = 0; ring <= nRings; ring++ ) { - float r0 = r * sinf (ring * fDeltaRingAngle); - float y0 = r * cosf (ring * fDeltaRingAngle); - - // Generate the group of segments for the current ring - for (int seg = 0; seg <= nSegments; seg++) { - float x0 = r0 * sinf(seg * fDeltaSegAngle); - float z0 = r0 * cosf(seg * fDeltaSegAngle); - - // Add one vertex to the strip which makes up the sphere - *pVertex++ = x0; - *pVertex++ = y0; - *pVertex++ = z0; - - Ogre::Vector3 vNormal = Ogre::Vector3(x0, y0, z0).normalisedCopy(); - *pVertex++ = vNormal.x; - *pVertex++ = vNormal.y; - *pVertex++ = vNormal.z; - - *pVertex++ = (float) seg / (float) nSegments; - *pVertex++ = (float) ring / (float) nRings; - - if (ring != nRings) { - // each vertex (except the last) has six indices pointing to it - *pIndices++ = wVerticeIndex + nSegments + 1; - *pIndices++ = wVerticeIndex; - *pIndices++ = wVerticeIndex + nSegments; - *pIndices++ = wVerticeIndex + nSegments + 1; - *pIndices++ = wVerticeIndex + 1; - *pIndices++ = wVerticeIndex; - wVerticeIndex ++; - } - }; // end for seg - } // end for ring - - // Unlock - vBuf->unlock(); - iBuf->unlock(); - // Generate face list - pSphereVertex->useSharedVertices = true; - - // the original code was missing this line: - pSphere->_setBounds( Ogre::AxisAlignedBox( Ogre::Vector3(-r, -r, -r), Ogre::Vector3(r, r, r) ), false ); - pSphere->_setBoundingSphereRadius( r ); - // this line makes clear the mesh is loaded (avoids memory leaks) - pSphere->load(); - - Ogre::MeshPtr pMesh = Ogre::MeshManager::getSingleton().load( strName, - Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, - Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, true, true); - unsigned short src, dest; - - if ( !pMesh->suggestTangentVectorBuildParams( Ogre::VES_TANGENT, src, dest) ) { - pMesh->buildTangentVectors( Ogre::VES_TANGENT, src, dest ); - } -} - -} // namespace OpenGate - -// if ( !1 ) { -// planetNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "PlanetNode" ); -// -// Ogre::ManualObject * planet = sceneMgr_->createManualObject( "Planet" ); -// // planet->setUseIdentityProjection( true ); -// // planet->setUseIdentityView( true ); -// -// planet->begin( "OpenGate/RedPlanet", Ogre::RenderOperation::OT_TRIANGLE_LIST); -// planet->position( Ogre::Vector3( -1.0, -1.0, 200.0 ) ); -// planet->textureCoord( 0, 0 ); -// planet->position( Ogre::Vector3( 1.0, -1.0, 200.0 ) ); -// planet->textureCoord( 1, 0 ); -// planet->position( Ogre::Vector3( 1.0, 1.0, 200.0 ) ); -// planet->textureCoord( 1, 1 ); -// planet->position( Ogre::Vector3( -1.0, 1.0, 200.0 ) ); -// planet->textureCoord( 0, 1 ); -// planet->quad( 0, 1, 2, 3 ); -// planet->end(); -// Ogre::AxisAlignedBox aabInf; aabInf.setInfinite(); -// planet->setBoundingBox( aabInf ); -// planetNode_->attachObject( planet ); -// planetNode_->scale( 20000, 20000, 1 ); -// planetNode_->setPosition( Ogre::Vector3( 20000.0, 10000.0, 50000 ) ); -// } -// if ( planetNode_ ){ // updateLoop -// Ogre::Vector3 src = planetNode_->getWorldOrientation() * Ogre::Vector3::UNIT_Z; -// src.normalise(); -// -// Ogre::Vector3 target( avatar_->mainNode()->getPosition() - planetNode_->getWorldPosition() ); -// target.normalise(); -// -// Ogre::Quaternion rot = src.getRotationTo( target ); -// rot.normalise(); -// -// planetNode_->setPosition( Ogre::Vector3( 20000.0, 10000.0, 50000 ) + avatar_->mainNode()->getPosition() ); -// planetNode_->rotate( rot, Ogre::Node::TS_PARENT ); -// } Deleted: trunk/src/Planet.h =================================================================== --- trunk/src/Planet.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Planet.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by OpenGate development team * - * spo...@us... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _OPENGATE_PLANET__H -#define _OPENGATE_PLANET__H - -#include "Opengate.h" - -namespace OpenGate{ - -class Planet { -public: - - Planet( const std::string & name, Ogre::SceneManager * SceneMgr, const Ogre::Vector3 & relPos, Ogre::Real radius, int segments ); - ~Planet( ); - void lighting( bool on ); - void update( float elapsedTime ); - -protected: - - //** taken from ogre wiki: http://www.ogre3d.org/wiki/index.php/ManualSphereMeshes - void createSphere_( const std::string & strName, const float r, const int nRings, const int nSegments ); - - std::string name_; - Ogre::SceneManager * sceneMgr_; - - Ogre::SceneNode * planetNode_; - Ogre::SceneNode * planetCloudNode_; - Ogre::Entity * planetCloudEntity_; - Ogre::Entity * planetEntity_; - Ogre::Light * light_; -}; - -} // namespace OpenGate - - -#endif // _OPENGATE_SECTOR__H Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Sector.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -36,6 +36,7 @@ #include "SectorBeaconObject.h" #include "SectorCollisionObject.h" #include "SectorExplosionObject.h" +#include "SectorEnvironmentObject.h" #include "SectorMeshObject.h" #include "SectorMissileObject.h" #include "SectorProjectileObject.h" @@ -60,11 +61,14 @@ avatar_ = NULL; childIDCounter_ = 0; + ecliptic_ = new SectorEclipticObject( this ); + sectorEnvironment_.insert( ecliptic_ ); + showEcliptic( false ); createKoordAxis( ); - } Sector::~Sector( ){ + for_each( sectorEnvironment_.begin(), sectorEnvironment_.end(), deletePtr() ); for_each( sectorCollObjects_.begin(), sectorCollObjects_.end(), deletePtr() ); for_each( sectorMeshObjects_.begin(), sectorMeshObjects_.end(), deletePtr() ); @@ -85,6 +89,9 @@ ResourceManager::getSingleton().collisionManager->update( elapsedTime ); } + for ( std::set< SectorEnvironmentObject * >::iterator it = sectorEnvironment_.begin(); it != sectorEnvironment_.end(); it++ ){ + (*it)->update( elapsedTime ); + } for ( std::set< SectorCollisionObject * >::iterator it = sectorCollObjects_.begin(); it != sectorCollObjects_.end(); ){ if ( !(*it)->update( elapsedTime ) ) { destructCollObject_( (*it++) ); @@ -122,6 +129,9 @@ delete( obj ); obj = NULL; break; + case SECTOR_VESSEL_OBJECT_RTTI: + objectHeap_[ dynamic_cast< SectorVesselObject * >( obj )->vessel()->name() ].push_back( obj ); + break; case SECTOR_MISSILE_OBJECT_RTTI: objectHeap_[ dynamic_cast< SectorMissileObject * >( obj )->missile()->name() ].push_back( obj ); break; @@ -361,8 +371,14 @@ } else{ std::cerr << "no entity found for sectorobject: " << name << std::endl; } - } + } //! for all sectorobject + //! create Planet + SectorPlanetObject *planet = new SectorPlanetObject( "planet", this ); + //, Ogre::Vector3( 0000.0, 0000.0, 50000 ), 15000.0f, 64 ); + //planet_->lighting( true ); + sectorEnvironment_.insert( planet ); + return; } @@ -370,6 +386,14 @@ sceneMgr_->setSkyBox( true, name, 10000 ); } +void Sector::showEcliptic( bool show ){ + if ( ecliptic_ ) ecliptic_->mainNode()->setVisible( show ); +} + +void Sector::flipShowEcliptic( ) { + if ( ecliptic_ ) ecliptic_->mainNode()->flipVisibility( ); +} + void Sector::createKoordAxis( ){ koordAxisNode_ = sceneMgr_->getRootSceneNode()->createChildSceneNode( "axisnode" ); koordAxisMO_ = sceneMgr_->createManualObject( koordAxisNode_->getName()+ "/manualObject" ); Modified: trunk/src/Sector.h =================================================================== --- trunk/src/Sector.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Sector.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -95,6 +95,10 @@ void setSkyBox( const std::string & name ); void createKoordAxis( ); + + void showEcliptic( bool show ); + + void flipShowEcliptic( ); protected: /*! do not destruct objects manualy, let them send false during update loop */ @@ -128,7 +132,7 @@ std::set< SectorCollisionObject * > sectorCollObjects_; /*! Hold all stuff that makes the sector looking nice */ - //std::set< SectorEnvironmentObject * > sectorEnvironment_; + std::set< SectorEnvironmentObject * > sectorEnvironment_; /*! Hold all stuff that makes the sector looking nice */ std::set< SectorStationObject * > sectorStations_; @@ -139,6 +143,8 @@ Ogre::SceneNode * koordAxisNode_; Ogre::ManualObject * koordAxisMO_; + + SectorEclipticObject * ecliptic_; }; #else Modified: trunk/src/SectorBaseObject.h =================================================================== --- trunk/src/SectorBaseObject.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/SectorBaseObject.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -68,22 +68,7 @@ bool destroyRequest_; }; - /*! Sectorobject that represent space environment without collision*/ - class SectorEnvironmentObject : public SectorBaseObject { - SectorEnvironmentObject( const Ogre::String & name, Sector * sector ); - }; - - - /*class SectorPlanetObject : public SectorEnvironmentObject{ - }; - class SectorStarfieldObject : public SectorEnvironmentObject{ - }; - class SectorSpaceDustObject : public SectorEnvironmentObject{ - }; - class SectorSpaceDecorationObject : public SectorEnvironmentObject{ - };*/ - } //namespace OpenGate #endif //_OPENGATE_SECTORBASEOBJECT__H Modified: trunk/src/UnDockedState.cpp =================================================================== --- trunk/src/UnDockedState.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/UnDockedState.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -890,12 +890,12 @@ } bool UnDockedState::keyActionSelectTextTarget( bool pressed ){ - // if ( pressed ) setTarget( sector_->nextTarget() ); - return true; + if ( pressed ) radar_->findNextTarget(); + return true; } bool UnDockedState::keyActionSelectPreviousTarget( bool pressed ){ - // if ( pressed ) setTarget( sector_->prevTarget() ); + if ( pressed ) radar_->findPrevTarget(); return true; } @@ -1085,6 +1085,13 @@ return true; } +bool UnDockedState::keyActionShowEcliptic_DEV( bool pressed ){ + if ( pressed ) { + sector_->flipShowEcliptic( ); + } + return true; +} + bool UnDockedState::maximiseConsole( ){ if ( overlayRootWindow_ ){ CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"UnDocked/MainWindow/ConsoleFrame")-> Modified: trunk/src/UnDockedState.h =================================================================== --- trunk/src/UnDockedState.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/UnDockedState.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -132,6 +132,7 @@ bool keyActionAvatarSelfDestruct_DEV( bool pressed = true ); bool keyActionSpawnAi_DEV( bool pressed = true ); bool keyActionShowInfos_DEV( bool pressed = true ); + bool keyActionShowEcliptic_DEV( bool pressed = true ); protected: UnDockedState( ); Modified: trunk/src/Vessel.cpp =================================================================== --- trunk/src/Vessel.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Vessel.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -50,6 +50,10 @@ capacitor_ = NULL; } +Vessel::~Vessel(){ + +} + std::vector < Ogre::Vector3 > findMountPoints( TiXmlHandle * hRoot, const std::string & key ){ std::vector < Ogre::Vector3 > mountPoints; TiXmlElement * pElem; @@ -75,14 +79,14 @@ readXMLNode< int >( hRoot, "ecmsize maximum_ECM_size", this, &OpenGate::Vessel::setEcmSize, false ); for ( int i = 1; i < 7; i ++ ){ - std::vector < Ogre::Vector3 > guns = findMountPoints( &hRoot, "gun_slot_size_" + toStr( i ) ); + std::vector < Ogre::Vector3 > guns = findMountPoints( &hRoot, "gun_slot_size_" + toStr( i ) ); if ( guns.size() > 0 ){ this->setGunMountPoints( i, guns ); } } for ( int i = 1; i < 7; i ++ ){ - std::vector < Ogre::Vector3 > engines = findMountPoints( &hRoot, "engine_slot_size_" + toStr( i ) ); + std::vector < Ogre::Vector3 > engines = findMountPoints( &hRoot, "engine_slot_size_" + toStr( i ) ); if ( engines.size() > 0 ){ this->setEngineMountPoints( i, engines ); break; @@ -135,12 +139,12 @@ } void Vessel::setGunMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ){ - gunMountPoints_[ size ] = mountPoints; + gunMountPoints_[ size ] = mountPoints; } void Vessel::setEngineMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ){ - engineSize_ = size; - engineMountPoints_ = mountPoints; + engineSize_ = size; + engineMountPoints_ = mountPoints; } bool Vessel::setPowerPlant( PowerPlant * item ){ Modified: trunk/src/Vessel.h =================================================================== --- trunk/src/Vessel.h 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/Vessel.h 2009-02-14 19:11:02 UTC (rev 1031) @@ -64,7 +64,7 @@ Vessel(); /*! Desctructor */ - virtual ~Vessel(){} + virtual ~Vessel(); virtual void readPropertiesFromXML( TiXmlHandle & hRoot ); @@ -103,10 +103,10 @@ Uint32 capacity() const; void setGunMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ); - std::map < int, std::vector < Ogre::Vector3 > > gunMountPoints() const { return gunMountPoints_; } + const std::map < int, std::vector < Ogre::Vector3 > > & gunMountPoints() const { return gunMountPoints_; } void setEngineMountPoints( int size, std::vector < Ogre::Vector3 > & mountPoints ); - std::vector < Ogre::Vector3 > engineMountPoints() const { return engineMountPoints_; } + const std::vector < Ogre::Vector3 > & engineMountPoints() const { return engineMountPoints_; } inline int amountEngines( ) const { return engineMountPoints_.size(); } inline void setAmountModX( int amount ){ amountModX_ = amount; } Modified: trunk/src/opengateclient.cpp =================================================================== --- trunk/src/opengateclient.cpp 2009-02-12 00:47:47 UTC (rev 1030) +++ trunk/src/opengateclient.cpp 2009-02-14 19:11:02 UTC (rev 1031) @@ -188,32 +188,29 @@ log->info( "Offline mode." ); } - try { - bool withIntro = true; - OpenGate::GameStateManager gameStateMgr( nw, option_dialog ); + try { + bool withIntro = false; + OpenGate::GameStateManager gameStateMgr( nw, option_dialog ); - if ( withIntro ){ - OpenGate::InitState::create( &gameStateMgr, "InitState" ); - gameStateMgr.start( gameStateMgr.findByName( "InitState" ) ) ; - } else { - gameStateMgr.initialiseAllResources(); - //gameStateMgr.start( gameStateMgr.findByName( "DockedState" ) ) ; - gameStateMgr.start( gameStateMgr.findByName( "UnDockedState" ) ) ; - } - - } catch( Ogre::Exception& e ) { - + if ( withIntro ){ + OpenGate::InitState::create( &gameStateMgr, "InitState" ); + gameStateMgr.start( gameStateMgr.findByName( "InitState" ) ) ; + } else { + gameStateMgr.initialiseAllResources(); + gameStateMgr.start( gameStateMgr.findByName( "DockedState" ) ) ; + //gameStateMgr.start( gameStateMgr.findByName( "UnDockedState" ) ) ; + } + } catch( Ogre::Exception& e ) { #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - MessageBox( NULL, e.getFullDescription().c_str(), + MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); #else - log->fatal( std::string("An exception has occured: ") + e.getFullDescription().c_str() ); + log->fatal( std::string("An exception has occured: ") + e.getFullDescription().c_str() ); #endif - } + } + nw.close(); - nw.close(); + delete log; - delete log; - - return EXIT_SUCCESS; + return EXIT_SUCCESS; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |