Re #769 First (and main) step : race engine moved to modules/racing/standardgame

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5081 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: d2add7a6f5ac0031fcf5fcd6ad29a48fc42521b3
Former-commit-id: 69f9fd27dc95ef8d6e6cd9b1a98019fb142af4e7
This commit is contained in:
pouillot 2012-12-30 18:24:16 +00:00
parent f8a0ae1100
commit 67e4b7a021
36 changed files with 193 additions and 139 deletions

View file

@ -1,14 +1,13 @@
INCLUDE("../../cmake/macros.cmake")
IF(NOT OPTION_3RDPARTY_EXPAT)
ADD_SUBDIRECTORY(txml)
ADD_SUBDIRECTORY(txml)
ENDIF(NOT OPTION_3RDPARTY_EXPAT)
ADD_SUBDIRECTORY(tgf)
ADD_SUBDIRECTORY(tgfclient)
ADD_SUBDIRECTORY(tgfdata)
ADD_SUBDIRECTORY(robottools)
ADD_SUBDIRECTORY(raceengine)
ADD_SUBDIRECTORY(learning)
ADD_SUBDIRECTORY(math)
ADD_SUBDIRECTORY(portability)

View file

@ -6,22 +6,22 @@ SET(_TARGET_NAME speed-dreams-2)
SET(_SOURCES main.cpp)
IF(MSVC)
SET(_SOURCES ${_SOURCES} main.rc resource.h ../../data/data/icons/icon.ico)
SET(_SOURCES ${_SOURCES} main.rc resource.h ../../data/data/icons/icon.ico)
ENDIF(MSVC)
ADD_INTERFACE_INCLUDEDIR()
ADD_SDLIB_INCLUDEDIR(tgf tgfclient tgfdata raceengine math portability)
ADD_SDLIB_INCLUDEDIR(tgf tgfclient tgfdata math portability)
ADD_SDL_INCLUDEDIR()
ADD_PLIB_INCLUDEDIR()
# Disable developer warning
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
ADD_EXECUTABLE(${_TARGET_NAME} ${_SOURCES})
ADD_SDLIB_LIBRARY(${_TARGET_NAME} portability tgf tgfclient tgfdata raceengine)
ADD_SDLIB_LIBRARY(${_TARGET_NAME} portability tgf tgfclient tgfdata)
# Needed when using the "MinGW Makefiles" CMake generator (but not with the "MSYS Makefiles" one !?)
IF(MINGW)
@ -29,7 +29,7 @@ IF(MINGW)
ENDIF(MINGW)
IF(UNIX)
SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
@ -37,5 +37,5 @@ SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
# Under Windows, install needed 3rd party DLLs close to Speed Dreams executable.
IF(WIN32)
INCLUDE(customthirdparty)
SD_INSTALL_CUSTOM_3RDPARTY()
SD_INSTALL_CUSTOM_3RDPARTY()
ENDIF(WIN32)

View file

@ -34,7 +34,7 @@
#include <config.h>
#endif
#include <raceengine.h>
#include <iraceengine.h>
#include <iuserinterface.h>
@ -138,14 +138,26 @@ main(int argc, char *argv[])
piUserItf = pmodUserItf->getInterface<IUserInterface>();
}
// Initialize the race engine and the user interface modules.
if (piUserItf)
// Load the race engine module (the "standard game" one, for the moment).
ossModLibName.str("");
ossModLibName << GfLibDir() << "modules/racing/standardgame" << '.' << DLLEXT;
GfModule* pmodRaceEngine = GfModule::load(ossModLibName.str());
// Check that it implements IRaceEngine.
IRaceEngine* piRaceEngine = 0;
if (pmodRaceEngine)
{
RaceEngine::self().setUserInterface(*piUserItf);
piUserItf->setRaceEngine(RaceEngine::self());
piRaceEngine = pmodRaceEngine->getInterface<IRaceEngine>();
}
// Connect the race engine and the user interface modules.
if (piUserItf && piRaceEngine)
{
piRaceEngine->setUserInterface(*piUserItf);
piUserItf->setRaceEngine(*piRaceEngine);
}
if (piUserItf)
if (piUserItf && piRaceEngine)
{
// Enter the user interface.
if (piUserItf->activate())
@ -154,14 +166,12 @@ main(int argc, char *argv[])
pApp->eventLoop()();
}
// Shutdown the user interface.
// Shutdown and unload the user interface and race engine modules.
piUserItf->shutdown();
// Shutdown the race engine.
RaceEngine::self().shutdown();
piRaceEngine->shutdown();
// Unload the user interface module.
GfModule::unload(pmodUserItf);
GfModule::unload(pmodRaceEngine);
}
// Done with the app instance.
@ -169,12 +179,12 @@ main(int argc, char *argv[])
delete pApp;
// That's all (but trace what we are doing).
if (piUserItf)
if (piUserItf && piRaceEngine)
GfLogInfo("Exiting normally from %s.\n", strAppName.c_str());
else
std::cerr << "Exiting from " << strAppName
<< " after some error occurred (see above)." << std::endl;
return piUserItf ? 0 : 1;
return (piUserItf && piRaceEngine) ? 0 : 1;
}

View file

@ -1,9 +1,16 @@
INCLUDE(../../cmake/macros.cmake)
ADD_SUBDIRECTORY(graphic)
ADD_SUBDIRECTORY(simu)
ADD_SUBDIRECTORY(telemetry)
ADD_SUBDIRECTORY(networking)
ADD_SUBDIRECTORY(userinterface)
ADD_SUBDIRECTORY(track)
ADD_SUBDIRECTORY(sound)
ADD_SUBDIRECTORY(simu)
ADD_SUBDIRECTORY(track)
ADD_SUBDIRECTORY(userinterface)
ADD_SUBDIRECTORY(racing)
ADD_SUBDIRECTORY(telemetry)
ADD_SUBDIRECTORY(networking)

View file

@ -0,0 +1,4 @@
INCLUDE(../../../cmake/macros.cmake)
ADD_SUBDIRECTORY(standardgame)

View file

@ -1,32 +1,36 @@
INCLUDE(../../../cmake/macros.cmake)
INCLUDE(../../../../cmake/macros.cmake)
#PROJECT(raceengine)
#PROJECT(standardgame)
SET(RACEENGINE_SOURCES raceengine.cpp
SET(STANDARDGAME_SOURCES standardgame.cpp
racecareer.cpp raceupdate.cpp racenetwork.cpp racecars.cpp
raceinit.cpp racemain.cpp
racetrack.cpp raceresults.cpp racesimusimu.cpp
racestate.cpp racesituation.cpp racemessage.cpp
raceutil.cpp)
SET(RACEENGINE_HEADERS raceengine.h
SET(STANDARDGAME_HEADERS standardgame.h
racecareer.h raceupdate.h racenetwork.h racecars.h
raceinit.h
racetrack.h raceresults.h racesimusimu.h
racestate.h racesituation.h racemessage.h
raceutil.h)
SET(RACEENGINE_OTHER_SOURCES raceengine.xml raceresults.xsl)
SET(STANDARDGAME_OTHER_SOURCES raceengine.xml raceresults.xsl)
ADD_INTERFACE_INCLUDEDIR()
ADD_SDLIB_INCLUDEDIR(math portability robottools tgf tgfclient tgfdata
networking)
ADD_SDLIB_INCLUDEDIR(math portability robottools tgf tgfclient tgfdata networking)
ADD_PLIB_INCLUDEDIR()
ADD_SDL_INCLUDEDIR()
# Disable developer warning
IF (COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
IF(WIN32)
# DLL export stuff under Windows (to avoid .def file)
ADD_DEFINITIONS(-DRACEENGINE_DLL)
ADD_DEFINITIONS(-DSTANDARDGAME_DLL)
ENDIF(WIN32)
IF(MSVC)
@ -34,30 +38,21 @@ IF(MSVC)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:msvcrt.lib")
ENDIF(MSVC)
# Disable developer warning
IF (COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
# Note: Other source files and headers needed for having them available in IDEs.
ADD_LIBRARY(raceengine SHARED ${RACEENGINE_SOURCES} ${RACEENGINE_HEADERS} ${RACEENGINE_OTHER_SOURCES})
ADD_LIBRARY(standardgame SHARED ${STANDARDGAME_SOURCES} ${STANDARDGAME_HEADERS}
${STANDARDGAME_OTHER_SOURCES})
# Might not work with GCC 4.5 or + (non-robot modules crash at 1st reload = after 1 dlclose)
#SET_TARGET_PROPERTIES(raceengine PROPERTIES VERSION ${VERSION} SOVERSION 0.0.0)
#SET_TARGET_PROPERTIES(standardgame PROPERTIES VERSION ${VERSION} SOVERSION 0.0.0)
ADD_SDLIB_LIBRARY(raceengine
portability tgf tgfdata robottools
networking)
IF(UNIX OR MINGW)
SET_TARGET_PROPERTIES(standardgame PROPERTIES PREFIX "")
ENDIF(UNIX OR MINGW)
IF(WIN32)
SD_INSTALL_FILES(BIN TARGETS raceengine)
ELSE(WIN32)
SD_INSTALL_FILES(LIB lib TARGETS raceengine)
ENDIF(WIN32)
ADD_SDLIB_LIBRARY(standardgame portability tgf tgfdata robottools networking)
SD_INSTALL_FILES(DATA config FILES raceresults.xsl)
SD_INSTALL_FILES(DATA config USER config FILES raceengine.xml)
SD_INSTALL_FILES(INCLUDE FILES raceinit.h)
SD_INSTALL_FILES(LIB modules/racing TARGETS standardgame)

View file

@ -32,7 +32,7 @@
#include <robottools.h>
#include <teammanager.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racesituation.h"
#include "raceupdate.h"

View file

@ -39,7 +39,7 @@
#include <racemanagers.h>
#include <race.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racesituation.h"
#include "racemain.h"
@ -93,7 +93,7 @@ ReExit(void)
{
// Stop and cleanup the race engine.
ReStop();
RaceEngine::self().cleanup();
StandardGame::self().cleanup();
// Notify the user interface.
ReUI().quit();
@ -119,7 +119,7 @@ ReRaceSelectRaceman(GfRaceManager* pRaceMan, bool bKeepHumans)
ReInfo->_reFilename = pRaceMan->getId().c_str();
// (Re-)initialize the currrent race configuration from the selected race manager.
RaceEngine::self().race()->load(pRaceMan, bKeepHumans);
StandardGame::self().race()->load(pRaceMan, bKeepHumans);
}
// Start configuring the race
@ -128,7 +128,7 @@ ReRaceConfigure(bool bInteractive)
{
// Update race engine info.
ReInfo->mainParams = ReInfo->params =
RaceEngine::self().race()->getManager()->getDescriptorHandle();
StandardGame::self().race()->getManager()->getDescriptorHandle();
GfParmRemoveVariable(ReInfo->params, "/", "humanInGroup");
GfParmSetVariable(ReInfo->params, "/", "humanInGroup", ReHumanInGroup() ? 1.0f : 0.0f);
@ -144,7 +144,7 @@ ReRaceRestore(void* hparmResults)
{
// Update race engine info in order to set it in the exact state
// it was in when the race mode was saved.
GfRace* pRace = RaceEngine::self().race();
GfRace* pRace = StandardGame::self().race();
ReInfo->mainParams = pRace->getManager()->getDescriptorHandle();
ReInfo->mainResults = pRace->getResultsDescriptorHandle();
if (!pRace->getManager()->hasSubFiles())
@ -183,7 +183,7 @@ void
ReStartNewRace()
{
// Save the race settings to the race manager file is anything changed.
GfRace* pRace = RaceEngine::self().race();
GfRace* pRace = StandardGame::self().race();
if (pRace->isDirty())
{
pRace->store(); // Save data to params.
@ -823,7 +823,7 @@ void
ReRaceCleanup(void)
{
RePhysicsEngine().shutdown();
RaceEngine::self().unloadPhysicsEngine();
StandardGame::self().unloadPhysicsEngine();
ReStoreRaceResults(ReInfo->_reRaceName);

View file

@ -29,7 +29,7 @@
#include <robot.h>
#include <network.h>
#include "raceengine.h"
#include "standardgame.h"
#include "raceutil.h" // RmGetFeaturesList
#include "racesituation.h"
@ -112,7 +112,7 @@ void ReRaceAbort()
ReShutdownUpdaters();
RePhysicsEngine().shutdown();
RaceEngine::self().unloadPhysicsEngine();
StandardGame::self().unloadPhysicsEngine();
ReUI().onRaceFinishing();
@ -624,7 +624,7 @@ ReRaceRealStart(void)
void* carHdle;
// Load the physics engine
if (!RaceEngine::self().loadPhysicsEngine())
if (!StandardGame::self().loadPhysicsEngine())
return RM_ERROR;
// Get the session display mode (default to "All sessions" ones, or else "normal").

View file

@ -29,7 +29,7 @@
#include <raceman.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racemessage.h"

View file

@ -24,7 +24,7 @@
#include <network.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racesituation.h"
#include "racenetwork.h"

View file

@ -31,7 +31,7 @@
#include <portability.h>
#include <robot.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racesituation.h"
#include "racestate.h"

View file

@ -34,7 +34,7 @@
#include <robot.h>
#include <raceman.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racecars.h"
#include "racesituation.h"

View file

@ -24,7 +24,7 @@
#include <raceman.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racesituation.h"
#include "racemain.h"

View file

@ -34,7 +34,7 @@
#include <tracks.h>
#include "raceengine.h"
#include "standardgame.h"
#include "racesituation.h"
#include "raceinit.h"

View file

@ -30,7 +30,7 @@
#include <robot.h>
#include <raceman.h>
#include "raceengine.h"
#include "standardgame.h"
#include "raceresults.h"
#include "racesimusimu.h"

View file

@ -1,6 +1,6 @@
/***************************************************************************
file : raceengine.cpp
file : standardgame.cpp
copyright : (C) 2010 by Jean-Philippe Meuret
email : pouillot@users.sourceforge.net
version : $Id$
@ -17,7 +17,7 @@
***************************************************************************/
/** @file
The race engine implementation of its IRaceEngine interface
The standard game race engine module
@version $Id$
*/
@ -38,28 +38,54 @@
#include "racestate.h"
#include "raceupdate.h"
#include "raceengine.h"
#include "standardgame.h"
// The singleton.
RaceEngine* RaceEngine::_pSelf = 0;
StandardGame* StandardGame::_pSelf = 0;
RaceEngine& RaceEngine::self()
int openGfModule(const char* pszShLibName, void* hShLibHandle)
{
if (!_pSelf)
_pSelf = new RaceEngine;
// Instanciate the (only) module instance.
StandardGame::_pSelf = new StandardGame(pszShLibName, hShLibHandle);
// Register it to the GfModule module manager if OK.
if (StandardGame::_pSelf)
GfModule::register_(StandardGame::_pSelf);
// Report about success or error.
return StandardGame::_pSelf ? 0 : 1;
}
int closeGfModule()
{
// Unregister it from the GfModule module manager.
if (StandardGame::_pSelf)
GfModule::unregister(StandardGame::_pSelf);
// Delete the (only) module instance.
delete StandardGame::_pSelf;
StandardGame::_pSelf = 0;
// Report about success or error.
return 0;
}
StandardGame& StandardGame::self()
{
// Pre-condition : 1 successfull openGfModule call.
return *_pSelf;
}
RaceEngine::RaceEngine()
: _piUserItf(0), _piTrkLoader(0), _piPhysEngine(0), _pRace(new GfRace())
StandardGame::StandardGame(const std::string& strShLibName, void* hShLibHandle)
: GfModule(strShLibName, hShLibHandle),
_piUserItf(0), _piTrkLoader(0), _piPhysEngine(0), _pRace(new GfRace())
{
GfData::initialize();
GfData::initialize(); // ???? Shouldn't this move elsewhere ? (main ?)
}
// Implementation of IRaceEngine.
void RaceEngine::reset(void)
void StandardGame::reset(void)
{
GfLogInfo("Resetting race engine.\n");
@ -90,7 +116,7 @@ void RaceEngine::reset(void)
GfTracks::self()->setTrackLoader(_piTrkLoader);
}
void RaceEngine::cleanup(void)
void StandardGame::cleanup(void)
{
GfLogInfo("Cleaning up race engine.\n");
@ -125,17 +151,17 @@ void RaceEngine::cleanup(void)
}
}
void RaceEngine::shutdown(void)
void StandardGame::shutdown(void)
{
// Destroy the race engine itself.
delete _pSelf;
_pSelf = 0;
// Shutdown the data layer.
GfData::shutdown();
GfData::shutdown(); // ???? Shouldn't this move elsewhere ? (main ?)
}
RaceEngine::~RaceEngine()
StandardGame::~StandardGame()
{
cleanup();
@ -144,127 +170,127 @@ RaceEngine::~RaceEngine()
delete _pRace;
}
void RaceEngine::setUserInterface(IUserInterface& userItf)
void StandardGame::setUserInterface(IUserInterface& userItf)
{
_piUserItf = &userItf;
}
void RaceEngine::initializeState(void *prevMenu)
void StandardGame::initializeState(void *prevMenu)
{
::ReStateInit(prevMenu);
}
void RaceEngine::updateState(void)
void StandardGame::updateState(void)
{
::ReStateManage();
}
void RaceEngine::applyState(int state)
void StandardGame::applyState(int state)
{
::ReStateApply((void*)(long)state);
}
void RaceEngine::selectRaceman(GfRaceManager* pRaceMan, bool bKeepHumans)
void StandardGame::selectRaceman(GfRaceManager* pRaceMan, bool bKeepHumans)
{
::ReRaceSelectRaceman(pRaceMan, bKeepHumans);
}
void RaceEngine::restoreRace(void* hparmResults)
void StandardGame::restoreRace(void* hparmResults)
{
::ReRaceRestore(hparmResults);
}
void RaceEngine::configureRace(bool bInteractive)
void StandardGame::configureRace(bool bInteractive)
{
::ReRaceConfigure(bInteractive);
}
//************************************************************
void RaceEngine::startNewRace()
void StandardGame::startNewRace()
{
::ReStartNewRace();
}
void RaceEngine::resumeRace()
void StandardGame::resumeRace()
{
::ReResumeRace();
}
//************************************************************
void RaceEngine::startRace()
void StandardGame::startRace()
{
// TODO: Process error status ?
(void)::ReRaceRealStart();
}
void RaceEngine::abandonRace()
void StandardGame::abandonRace()
{
::ReRaceAbandon();
}
void RaceEngine::abortRace()
void StandardGame::abortRace()
{
::ReRaceAbort();
}
void RaceEngine::skipRaceSession()
void StandardGame::skipRaceSession()
{
::ReRaceSkipSession();
}
void RaceEngine::restartRace()
void StandardGame::restartRace()
{
::ReRaceRestart();
}
//************************************************************
void RaceEngine::start(void)
void StandardGame::start(void)
{
::ReStart();
}
void RaceEngine::stop(void)
void StandardGame::stop(void)
{
::ReStop();
}
#ifdef SD_DEBUG
void RaceEngine::step(double dt)
void StandardGame::step(double dt)
{
::ReOneStep(dt);
}
#endif
//************************************************************
GfRace* RaceEngine::race()
GfRace* StandardGame::race()
{
return _pRace;
}
const GfRace* RaceEngine::race() const
const GfRace* StandardGame::race() const
{
return _pRace;
}
// TODO: Remove when safe dedicated setters ready.
tRmInfo* RaceEngine::inData()
tRmInfo* StandardGame::inData()
{
return ReSituation::self().data(); // => ReInfo
}
const tRmInfo* RaceEngine::outData() const
const tRmInfo* StandardGame::outData() const
{
return ::ReOutputSituation();
}
// Accessor to the user interface.
IUserInterface& RaceEngine::userInterface()
IUserInterface& StandardGame::userInterface()
{
return *_piUserItf;
}
// Physics engine management.
bool RaceEngine::loadPhysicsEngine()
bool StandardGame::loadPhysicsEngine()
{
// Load the Physics engine module if not already done.
if (_piPhysEngine)
@ -303,7 +329,7 @@ bool RaceEngine::loadPhysicsEngine()
return _piPhysEngine ? true : false;
}
void RaceEngine::unloadPhysicsEngine()
void StandardGame::unloadPhysicsEngine()
{
// Unload the Physics engine module if not already done.
if (!_piPhysEngine)
@ -316,13 +342,13 @@ void RaceEngine::unloadPhysicsEngine()
}
// Accessor to the track loader.
ITrackLoader& RaceEngine::trackLoader()
ITrackLoader& StandardGame::trackLoader()
{
return *_piTrkLoader;
}
// Accessor to the physics engine.
IPhysicsEngine& RaceEngine::physicsEngine()
IPhysicsEngine& StandardGame::physicsEngine()
{
return *_piPhysEngine;
}
@ -331,17 +357,17 @@ IPhysicsEngine& RaceEngine::physicsEngine()
//************************************************************
// WIP : dedicated situation setters.
bool RaceEngine::setSchedulingSpecs(double fSimuRate, double fOutputRate)
bool StandardGame::setSchedulingSpecs(double fSimuRate, double fOutputRate)
{
return ::ReSetSchedulingSpecs(fSimuRate, fOutputRate);
}
void RaceEngine::accelerateTime(double fMultFactor)
void StandardGame::accelerateTime(double fMultFactor)
{
ReSituation::self().accelerateTime(fMultFactor);
}
void RaceEngine::setPitCommand(int nCarIndex, const struct CarPitCmd* pPitCmd)
void StandardGame::setPitCommand(int nCarIndex, const struct CarPitCmd* pPitCmd)
{
ReSituation::self().setPitCommand(nCarIndex, pPitCmd);
}

View file

@ -1,6 +1,6 @@
/***************************************************************************
file : raceengine.h
file : standardgame.h
copyright : (C) 2010 by Jean-Philippe Meuret
email : pouillot@users.sourceforge.net
version : $Id$
@ -17,31 +17,38 @@
***************************************************************************/
/** @file
The race engine implementation of its IRaceEngine interface
The standard game race engine module
@version $Id$
*/
#ifndef _RACEENGINE_H_
#define _RACEENGINE_H_
#ifndef _STANDARDGAME_H_
#define _STANDARDGAME_H_
#include <iphysicsengine.h>
#include <iraceengine.h>
#include <itrackloader.h>
#include <tgf.hpp>
// DLL exported symbols declarator for Windows.
#ifdef WIN32
# ifdef RACEENGINE_DLL
# define RACEENGINE_API __declspec(dllexport)
# ifdef STANDARDGAME_DLL
# define STANDARDGAME_API __declspec(dllexport)
# else
# define RACEENGINE_API __declspec(dllimport)
# define STANDARDGAME_API __declspec(dllimport)
# endif
#else
# define RACEENGINE_API
# define STANDARDGAME_API
#endif
// The C interface of the module.
extern "C" int STANDARDGAME_API openGfModule(const char* pszShLibName, void* hShLibHandle);
extern "C" int STANDARDGAME_API closeGfModule();
class RACEENGINE_API RaceEngine : public IRaceEngine
// The module main class
// (Singleton, inherits GfModule, and implements IRaceEngine).
class STANDARDGAME_API StandardGame : public GfModule, public IRaceEngine
{
public:
@ -91,14 +98,7 @@ public:
virtual void setPitCommand(int nCarIndex, const struct CarPitCmd* pPitCmd);
// Accessor to the singleton.
static RaceEngine& self();
// Accessor to the user interface.
IUserInterface& userInterface();
// Physics engine management.
bool loadPhysicsEngine();
void unloadPhysicsEngine();
static StandardGame& self();
// Accessor to the track loader.
ITrackLoader& trackLoader();
@ -106,16 +106,29 @@ public:
// Accessor to the physics engine.
IPhysicsEngine& physicsEngine();
// Physics engine management.
bool loadPhysicsEngine();
void unloadPhysicsEngine();
// Destructor.
virtual ~StandardGame();
// Accessor to the user interface.
IUserInterface& userInterface();
protected:
// Protected constructor and destructor : clients can not use them.
RaceEngine();
virtual ~RaceEngine();
// Protected constructor to avoid instanciation outside (but friends).
StandardGame(const std::string& strShLibName, void* hShLibHandle);
// Make the C interface functions nearly member functions.
friend int openGfModule(const char* pszShLibName, void* hShLibHandle);
friend int closeGfModule();
protected:
// The singleton.
static RaceEngine* _pSelf;
static StandardGame* _pSelf;
// The user interface.
IUserInterface* _piUserItf;
@ -133,19 +146,19 @@ protected:
//! Shortcut to the user interface.
inline extern IUserInterface& ReUI()
{
return RaceEngine::self().userInterface();
return StandardGame::self().userInterface();
}
//! Shortcut to the physics engine.
inline extern IPhysicsEngine& RePhysicsEngine()
{
return RaceEngine::self().physicsEngine();
return StandardGame::self().physicsEngine();
}
//! Shortcut to the track loader.
inline extern ITrackLoader& ReTrackLoader()
{
return RaceEngine::self().trackLoader();
return StandardGame::self().trackLoader();
}
#endif /* _RACEENGINE_H_ */
#endif /* _STANDARDGAME_H_ */