Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5782


Ignore:
Timestamp:
Sep 24, 2009, 11:32:39 AM (15 years ago)
Author:
rgrieder
Message:

Applied changes to the real sandbox this time.

Location:
sandbox
Files:
127 deleted
35 edited
2 copied

Legend:

Unmodified
Added
Removed
  • sandbox/bin/CMakeLists.txt

    r5695 r5782  
    2626
    2727# Create run scripts for Windows to manually add the DLL path when executing
    28 SET(RUN_SCRIPTS run standalone client1 client2 server dedicated)
     28SET(RUN_SCRIPTS run)
    2929IF(WIN32)
    3030  FOREACH(_script ${RUN_SCRIPTS})
  • sandbox/cmake/CompilerConfig.cmake

    r5695 r5782  
    3434  MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
    3535ENDIF()
    36 
    37 SET(COMPILER_CONFIG_USER_SCRIPT "" CACHE FILEPATH
    38     "Specify a CMake script if you wish to write your own compiler config.
    39      See CompilerConfigGCC.cmake or CompilerConfigMSVC.cmake for examples.")
    40 IF(COMPILER_CONFIG_USER_SCRIPT)
    41   IF(EXISTS ${CMAKE_MODULE_PATH}/${COMPILER_CONFIG_USER_SCRIPT})
    42     INCLUDE(${CMAKE_MODULE_PATH}/${COMPILER_CONFIG_USER_SCRIPT})
    43   ENDIF()
    44 ENDIF(COMPILER_CONFIG_USER_SCRIPT)
  • sandbox/cmake/LibraryConfig.cmake

    r5695 r5782  
    4848# Scripts for specific library and CMake config
    4949INCLUDE(LibraryConfigTardis)
    50 INCLUDE(LibraryConfigApple)
    5150
    5251IF(DEPENDENCY_PACKAGE_ENABLE)
     
    7170ENDIF(DEPENDENCY_PACKAGE_ENABLE)
    7271
    73 # User script
    74 SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
    75     "Specify a CMake script if you wish to write your own library path config.
    76      See LibraryConfigTardis.cmake for an example.")
    77 IF(LIBRARY_CONFIG_USER_SCRIPT)
    78   IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
    79     INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
    80   ENDIF()
    81 ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
    82 
    83 
    8472############### Library finding #################
    8573# Performs the search and sets the variables    #
    8674
    8775FIND_PACKAGE(OGRE  1.4       REQUIRED)
    88 FIND_PACKAGE(ENet  1.1       REQUIRED)
    89 FIND_PACKAGE(Ogg             REQUIRED)
    90 FIND_PACKAGE(Vorbis          REQUIRED)
    91 FIND_PACKAGE(ALUT            REQUIRED)
    92 FIND_PACKAGE(ZLIB            REQUIRED)
    93 IF(WIN32)
    94   FIND_PACKAGE(DirectX       REQUIRED)
    95 ENDIF(WIN32)
    96 
    97 ##### CEGUI #####
    98 # We make use of the CEGUI script module called CEGUILua.
    99 # However there is a small issue with that: We use Tolua, a C++ binding
    100 # generator ourselves. And we also have to use our bindings in the same
    101 # lua state is CEGUILua's. Unfortunately this implies that both lua runtime
    102 # version are equal or else you get segmentation faults.
    103 # In order to match the Lua versions we decided to ship CEGUILua in our
    104 # repository, mainly because there is no way to determine which version of
    105 # Lua CEGUILua was linked against (you'd have to specify yourself) and secondly
    106 # because we can then choose the Lua version. Future plans might involve only
    107 # accepting Lua 5.1.
    108 
    109 # Insert all internally supported CEGUILua versions here
    110 SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2)
    111 OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF)
    112 FIND_PACKAGE(CEGUI 0.5 REQUIRED)
    113 
    11476##### Lua #####
    11577IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
     
    12486ENDIF()
    12587FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)
    126 
    127 ##### OpenAL #####
    128 FIND_PACKAGE(OpenAL REQUIRED)
    129 # Also use parent include dir (without AL/) for ALUT
    130 IF(OPENAL_INCLUDE_DIR MATCHES "/AL$")
    131   GET_FILENAME_COMPONENT(ALT_OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} PATH)
    132 ENDIF()
    133 SET(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR} ${ALT_OPENAL_INCLUDE_DIR})
    134 # Notfiy user
    135 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
    136 # Hide variables created by the script
    137 MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)
    138 
    139 ##### Tcl #####
    140 # We only require Tcl, so avoid confusing user about other Tcl stuff by
    141 # applying a little workaround
    142 SET(Tclsh_FIND_QUIETLY TRUE)
    143 FIND_PACKAGE(TCL QUIET)
    144 # Display messages separately
    145 SET(TCL_FIND_QUIETLY FALSE)
    146 FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
    14788
    14889##### Boost #####
     
    161102IF(WIN32)
    162103  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
    163   OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
    164   OPTION(LINK_ENET_DYNAMIC  "Link ENet dynamically on Windows" TRUE)
    165104  OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
    166   OPTION(LINK_TCL_DYNAMIC   "Link TCL dynamically on Windows" TRUE)
    167   OPTION(LINK_ZLIB_DYNAMIC  "Link ZLib dynamically on Windows" TRUE)
    168105  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
    169106  IF(_version_comparison LESS 0)
     
    175112  IF(DEPENDENCY_PACKAGE_ENABLE)
    176113    MARK_AS_ADVANCED(
    177       LINK_BOOST_DYNAMIC LINK_CEGUI_DYNAMIC LINK_ENET_DYNAMIC
    178       LINK_OGRE_DYNAMIC  LINK_TCL_DYNAMIC   LINK_ZLIB_DYNAMIC
     114      LINK_BOOST_DYNAMIC
     115      LINK_OGRE_DYNAMIC
    179116      LINK_LUA_DYNAMIC
    180117    )
    181118  ENDIF()
    182119ENDIF(WIN32)
    183 
    184 
    185 ################# OGRE Plugins ##################
    186 
    187 # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
    188 SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
    189 IF(WIN32)
    190   # CG program manager is probably DirectX related (not available under unix)
    191   LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
    192 ENDIF(WIN32)
    193 SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
    194    "Specify which OGRE plugins to load. Existance check is performed.")
    195 
    196 # Check the plugins and determine the plugin folder
    197 # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
    198 INCLUDE(CheckOGREPlugins)
    199 CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
    200 
  • sandbox/cmake/LibraryConfigTardis.cmake

    r5698 r5782  
    4444  SET(BOOST_INCLUDEDIR "/usr/pack/boost-1.36.0-sd/include/boost-1_36")
    4545  SET(BOOST_LIBRARYDIR "/usr/pack/boost-1.36.0-sd/i686-debian-linux4.0/lib")
    46   SET(ENV{CEGUIDIR}    "/usr/pack/cegui-0.6.2-sd;/usr/pack/cegui-0.6.2-sd/i686-debian-linux4.0")
    47   SET(ENV{ENETDIR}     "/usr/pack/enet-1.2-sd;/usr/pack/enet-1.2-sd/i686-debian-linux4.0")
    48   SET(ENV{ALUTDIR}     "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")
    49   SET(ENV{OGGDIR}      "/usr/pack/oggvorbis-1.0-ds;/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0")
    50   SET(ENV{VORBISDIR}   "/usr/pack/oggvorbis-1.0-ds;/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0")
    5146  SET(ENV{LUA_DIR}     "/usr/pack/lua-5.1.4-sd;/usr/pack/lua-5.1.4-sd/i686-debian-linux4.0")
    5247  SET(ENV{OGRE_HOME}   "/usr/pack/ogre-1.4.9-sd;/usr/pack/ogre-1.4.9-sd/i686-debian-linux4.0")
    53   SET(ENV{OPENALDIR}   "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")
    54   #SET(TCL_INCLUDE_PATH "/usr/pack/tcltk-8.4.9.linux-mo/include")
    5548ENDIF(TARDIS)
  • sandbox/cmake/PackageConfig.cmake

    r5770 r5782  
    5757
    5858# Include paths and other special treatments
    59 SET(ENV{ALUTDIR}               ${DEP_INCLUDE_DIR}/freealut)
    6059SET(ENV{BOOST_ROOT}            ${DEP_INCLUDE_DIR}/boost)
    61 SET(ENV{CEGUIDIR}              ${DEP_INCLUDE_DIR}/cegui)
    62 SET(ENV{DXSDK_DIR}             ${DEP_INCLUDE_DIR}/directx)
    63 SET(ENV{ENETDIR}               ${DEP_INCLUDE_DIR}/enet)
    6460SET(ENV{LUA_DIR}               ${DEP_INCLUDE_DIR}/lua)
    65 SET(ENV{OGGDIR}                ${DEP_INCLUDE_DIR}/libogg)
    66 SET(ENV{VORBISDIR}             ${DEP_INCLUDE_DIR}/libvorbis)
    6761SET(ENV{OGRE_HOME}             ${DEP_INCLUDE_DIR}/ogre)
    68 SET(ENV{OGRE_PLUGIN_DIR}       ${DEP_BINARY_DIR})
    69 SET(ENV{OPENALDIR}             ${DEP_INCLUDE_DIR}/openal)
    70 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl/include)
    71 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib/include)
    7262
    7363### INSTALL ###
    74 
    75 # Tcl script library
    76 INSTALL(
    77   DIRECTORY ${DEP_LIBRARY_DIR}/tcl/
    78   DESTINATION lib/tcl
    79 )
    8064
    8165# On Windows, DLLs have to be in the executable folder, install them
  • sandbox/cmake/PackageConfigMSVC.cmake

    r5695 r5782  
    5252  SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR})
    5353
    54   # Certain find scripts don't behave as ecpected to we have
    55   # to specify the libraries ourselves.
    56   SET(TCL_LIBRARY  ${DEP_LIBRARY_DIR}/tcl85.lib CACHE FILEPATH "")
    57   SET(ZLIB_LIBRARY ${DEP_LIBRARY_DIR}/zdll.lib  CACHE FILEPATH "")
    58 
    5954  # Visual Leak Detector
    6055  SET(VLD_INCLUDE_DIR  ${DEP_INCLUDE_DIR}/vld   CACHE PATH "")
  • sandbox/cmake/PackageConfigMinGW.cmake

    r5695 r5782  
    4545  SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR} ${DEP_BINARY_DIR})
    4646
    47   # Certain find scripts don't behave as ecpected to we have
    48   # to specify the libraries ourselves.
    49   SET(TCL_LIBRARY  ${DEP_BINARY_DIR}/tcl85.dll CACHE FILEPATH "")
    50   SET(ZLIB_LIBRARY ${DEP_BINARY_DIR}/zlib1.dll CACHE FILEPATH "")
    51 
    5247ENDIF(MINGW)
  • sandbox/data/CMakeLists.txt

    r5700 r5782  
    3030SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
    3131
    32 # Specify data directory
    33 GET_FILENAME_COMPONENT(_search_path_1 ${CMAKE_SOURCE_DIR}/../data_extern ABSOLUTE)
    34 FIND_PATH(EXTERNAL_DATA_DIRECTORY resources.oxr
    35   PATHS
    36     ${CMAKE_SOURCE_DIR}/data_extern
    37     ${_search_path_1}
    38   NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
    39 )
    40 
    41 IF(NOT EXTERNAL_DATA_DIRECTORY)
    42   MESSAGE(STATUS "Warning: External data directory not found. If you want to compile while downloading the data files, you will have to recompile about four files afterwards and relink everything.")
    43   MESSAGE(STATUS "You can specify your own folder with the EXTERNAL_DATA_DIRECTORY variable. Default location for the path is orxonox_root/data_extern")
    44   # Temporary override to the default location.
    45   SET(EXTERNAL_DATA_DIRECTORY ${CMAKE_SOURCE_DIR}/data_extern)
    46 ENDIF()
    47 
    48 
    4932################ Installation #################
    5033
    51 # Internal directory
    5234INSTALL(
    5335  DIRECTORY ${DATA_DIRECTORY}/
    5436  DESTINATION ${DATA_INSTALL_DIRECTORY}
    55   REGEX "\\.svn$|_svn$|CMakeLists.txt|InstallScript.cmake" EXCLUDE
     37  REGEX "\\.svn$|_svn$|CMakeLists.txt" EXCLUDE
    5638)
    57 # External directory
    58 INSTALL(
    59   DIRECTORY ${EXTERNAL_DATA_DIRECTORY}/
    60   DESTINATION ${DATA_INSTALL_DIRECTORY}
    61   REGEX "\\.svn$|_svn$|resources\\.oxr" EXCLUDE
    62 )
    63 # Configure the install scripts (variables not available during installation)
    64 CONFIGURE_FILE(DataInstallScript.cmake ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake @ONLY)
    65 # Join both resources.oxr files
    66 INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake)
  • sandbox/src/CMakeLists.txt

    r5753 r5782  
    3838# If no defines are specified, these libs get linked statically
    3939ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
    40 ADD_COMPILER_FLAGS("-DENET_DLL"           WIN32 LINK_ENET_DYNAMIC)
    4140ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
    42 ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
    43 ADD_COMPILER_FLAGS("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
    4441# If no defines are specified, these libs get linked dynamically
    45 ADD_COMPILER_FLAGS("-DCEGUI_STATIC"       WIN32 NOT LINK_CEGUI_DYNAMIC)
    4642ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
    47 ADD_COMPILER_FLAGS("-DSTATIC_BUILD"       WIN32 NOT LINK_TCL_DYNAMIC)
    48 
    49 # Use TinyXML++
    50 ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
    5143
    5244############## Include Directories ##############
     
    5648  # External
    5749  ${OGRE_INCLUDE_DIR}
    58   ${CEGUI_INCLUDE_DIR}
    59   ${ENET_INCLUDE_DIR}
    6050  ${Boost_INCLUDE_DIRS}
    61   ${OPENAL_INCLUDE_DIRS}
    62   ${ALUT_INCLUDE_DIR}
    63   ${VORBIS_INCLUDE_DIR}
    64   ${OGG_INCLUDE_DIR}
    6551  ${LUA_INCLUDE_DIR}
    66   ${TCL_INCLUDE_PATH}
    67   ${DIRECTX_INCLUDE_DIR}
    68   ${ZLIB_INCLUDE_DIR}
    6952  ${VLD_INCLUDE_DIR}
    7053
     
    7255  # relative to "external" to avoid conflicts
    7356  ${CMAKE_CURRENT_SOURCE_DIR}/external
    74   # Include directories needed even if only included by Orxonox
    75   ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
    76   ${CMAKE_CURRENT_SOURCE_DIR}/external/ois
    7757
    7858  # OrxonoxConfig.h
    7959  ${CMAKE_CURRENT_BINARY_DIR}
    8060)
    81 
    82 IF(CEGUILUA_USE_INTERNAL_LIBRARY)
    83   INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/external/ceguilua/ceguilua-${CEGUI_VERSION})
    84 ENDIF()
    8561
    8662################### Tolua Bind ##################
  • sandbox/src/SpecialConfig.h.in

    r5695 r5782  
    4444
    4545/**
    46 @def CEGUILUA_USE_INTERNAL_LIBRARY
    47     Set whether we must suffix "ceguilua/" for the CEGUILua.h include
    48 */
    49 #cmakedefine CEGUILUA_USE_INTERNAL_LIBRARY
    50 
    51 /**
    5246@def DEPENDENCY_PACKAGE_ENABLE
    5347    Defined if a precompiled depdency package was used. We then copy all libraries
     
    9084    // DEVELOPMENT RUN PATHS
    9185    const char dataDevDirectory[]           = "@DATA_DIRECTORY@";
    92     const char externalDataDevDirectory[]   = "@EXTERNAL_DATA_DIRECTORY@";
    9386#ifdef CMAKE_CONFIGURATION_TYPES
    9487    const char moduleDevDirectory[]         = "@CMAKE_MODULE_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
     
    107100    // Module extension
    108101    const char moduleExtension[] = "@ORXONOX_MODULE_EXTENSION@";
    109 
    110     // OGRE PLUGINS
    111 #ifdef NDEBUG
    112     const char ogrePlugins[] = "@OGRE_PLUGINS_RELEASE@";
    113 #  ifdef DEPENDENCY_PACKAGE_ENABLE
    114     const char ogrePluginsDirectory[] = ".";
    115 #  else
    116     const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_RELEASE@";
    117 #  endif
    118 #else
    119     const char ogrePlugins[] = "@OGRE_PLUGINS_DEBUG@";
    120 #  ifdef DEPENDENCY_PACKAGE_ENABLE
    121     const char ogrePluginsDirectory[] = ".";
    122 #  else
    123     const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
    124 #  endif
    125 #endif
    126102} }
    127103
  • sandbox/src/external/CMakeLists.txt

    r5738 r5782  
    2121
    2222ADD_SUBDIRECTORY(tolua)
    23 
    24 # Include CEGUILua if not requested otherwise
    25 IF(CEGUILUA_USE_INTERNAL_LIBRARY)
    26   IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
    27     MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
    28   ENDIF()
    29 
    30   ADD_SUBDIRECTORY(ceguilua)
    31   SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)
    32 ENDIF()
    33 
    34 ADD_SUBDIRECTORY(bullet)
    35 ADD_SUBDIRECTORY(cpptcl)
    36 ADD_SUBDIRECTORY(ogreceguirenderer)
    37 ADD_SUBDIRECTORY(ois)
    38 ADD_SUBDIRECTORY(tinyxml)
  • sandbox/src/libraries/CMakeLists.txt

    r5752 r5782  
    2626
    2727ADD_SUBDIRECTORY(core)
    28 ADD_SUBDIRECTORY(network)
    29 ADD_SUBDIRECTORY(tools)
    3028ADD_SUBDIRECTORY(util)
  • sandbox/src/libraries/core/BaseObject.cc

    r5738 r5782  
    3333
    3434#include "BaseObject.h"
    35 
    36 #include <tinyxml/tinyxml.h>
    37 
    38 #include "util/StringUtils.h"
    3935#include "CoreIncludes.h"
    40 #include "Event.h"
    41 #include "EventIncludes.h"
    42 #include "Functor.h"
    43 #include "Iterator.h"
    44 #include "Template.h"
    45 #include "XMLFile.h"
    46 #include "XMLNameListener.h"
    47 #include "XMLPort.h"
    4836
    4937namespace orxonox
     
    5947
    6048        this->bInitialized_ = true;
    61 
    62         this->bActive_ = true;
    63         this->bVisible_ = true;
    64         this->oldGametype_ = 0;
    65 
    66         this->lastLoadedXMLElement_ = 0;
    67 
    68         this->functorSetMainState_ = 0;
    69         this->functorGetMainState_ = 0;
    70 
    71         this->setCreator(creator);
    72         if (this->creator_)
    73         {
    74             this->setFile(this->creator_->getFile());
    75             this->setNamespace(this->creator_->getNamespace());
    76             this->setScene(this->creator_->getScene());
    77             this->setGametype(this->creator_->getGametype());
    78         }
    79         else
    80         {
    81             this->file_ = 0;
    82             this->namespace_ = 0;
    83             this->scene_ = 0;
    84             this->gametype_ = 0;
    85         }
    8649    }
    8750
     
    9356        if (this->isInitialized())
    9457        {
    95             for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
    96                 (*it)->unregisterEventListener(this);
    97 
    98             for (std::map<BaseObject*, std::string>::const_iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    99                 it->first->removeEvent(this);
    100 
    101             if (this->functorSetMainState_)
    102                 delete this->functorSetMainState_;
    103             if (this->functorGetMainState_)
    104                 delete this->functorGetMainState_;
    10558        }
    10659    }
    107 
    108     /**
    109         @brief XML loading and saving.
    110         @param xmlelement The XML-element
    111         @param loading Loading (true) or saving (false)
    112         @return The XML-element
    113     */
    114     void BaseObject::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    115     {
    116         XMLPortParam(BaseObject, "name", setXMLName, getName, xmlelement, mode);
    117         XMLPortParam(BaseObject, "visible", setVisible, isVisible, xmlelement, mode);
    118         XMLPortParam(BaseObject, "active", setActive, isActive, xmlelement, mode);
    119         XMLPortParam(BaseObject, "mainstate", setMainStateName, getMainStateName, xmlelement, mode);
    120 
    121         XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*);
    122 
    123         Element* events = xmlelement.FirstChildElement("events", false);
    124 
    125         if (events)
    126         {
    127             std::list<std::string> eventnames;
    128 
    129             if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject)
    130             {
    131                 for (ticpp::Iterator<ticpp::Element> child = events->FirstChildElement(false); child != child.end(); child++)
    132                     eventnames.push_back(child->Value());
    133             }
    134             else if (mode == XMLPort::SaveObject)
    135             {
    136                 for (std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->getIdentifier()->getXMLPortEventMapBegin(); it != this->getIdentifier()->getXMLPortEventMapEnd(); ++it)
    137                     eventnames.push_back(it->first);
    138             }
    139 
    140             for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
    141             {
    142                 std::string sectionname = (*it);
    143                 ExecutorMember<BaseObject>* loadexecutor = createExecutor(createFunctor(&BaseObject::addEvent), std::string( "BaseObject" ) + "::" + "addEvent");
    144                 ExecutorMember<BaseObject>* saveexecutor = createExecutor(createFunctor(&BaseObject::getEvent), std::string( "BaseObject" ) + "::" + "getEvent");
    145                 loadexecutor->setDefaultValue(1, sectionname);
    146 
    147                 XMLPortClassObjectContainer<BaseObject, BaseObject>* container = 0;
    148                 container = (XMLPortClassObjectContainer<BaseObject, BaseObject>*)(this->getIdentifier()->getXMLPortEventContainer(sectionname));
    149                 if (!container)
    150                 {
    151                     container = new XMLPortClassObjectContainer<BaseObject, BaseObject>(sectionname, this->getIdentifier(), loadexecutor, saveexecutor, false, true);
    152                     this->getIdentifier()->addXMLPortEventContainer(sectionname, container);
    153                 }
    154                 container->port(this, *events, mode);
    155             }
    156         }
    157     }
    158 
    159     /**
    160         @brief Loads the name of the object through XML and calls all XMLNameListener.
    161         @param name The name of the object
    162     */
    163     void BaseObject::setXMLName(const std::string& name)
    164     {
    165         this->setName(name);
    166 
    167         for (ObjectList<XMLNameListener>::iterator it = ObjectList<XMLNameListener>::begin(); it != ObjectList<XMLNameListener>::end(); ++it)
    168             it->loadedNewXMLName(this);
    169     }
    170 
    171     /**
    172         @brief Returns the levelfile that loaded this object.
    173         @return The levelfile
    174     */
    175     const std::string& BaseObject::getFilename() const
    176     {
    177         if (this->file_)
    178             return this->file_->getFilename();
    179         else
    180             return BLANKSTRING;
    181     }
    182 
    183     /**
    184         @brief Adds a Template to the object.
    185         @param name The name of the Template
    186     */
    187     void BaseObject::addTemplate(const std::string& name)
    188     {
    189         Template* temp = Template::getTemplate(name);
    190         if (temp)
    191             this->addTemplate(temp);
    192         else
    193             COUT(1) << "Error: \"" << name << "\" is not a valid Template name (in class: " << this->getIdentifier()->getName() << ", name: " << this->getName() << ")." << std::endl;
    194     }
    195 
    196     /**
    197         @brief Adds a Template to the object.
    198         @param temp The Template
    199     */
    200     void BaseObject::addTemplate(Template* temp)
    201     {
    202         this->templates_.insert(temp);
    203         temp->applyOn(this);
    204     }
    205 
    206     /**
    207         @brief Returns the Template with the given index.
    208         @param index The index
    209     */
    210     Template* BaseObject::getTemplate(unsigned int index) const
    211     {
    212         unsigned int i = 0;
    213         for (std::set<Template*>::const_iterator it = this->templates_.begin(); it != this->templates_.end(); ++it)
    214         {
    215             if (i == index)
    216                 return (*it);
    217             i++;
    218         }
    219         return 0;
    220     }
    221 
    222     void BaseObject::addEvent(BaseObject* event, const std::string& sectionname)
    223     {
    224         event->registerEventListener(this, sectionname);
    225         this->events_.push_back(event);
    226     }
    227 
    228     void BaseObject::removeEvent(BaseObject* event)
    229     {
    230         this->events_.remove(event);
    231     }
    232 
    233     BaseObject* BaseObject::getEvent(unsigned int index) const
    234     {
    235         unsigned int i = 0;
    236         for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it)
    237         {
    238             if (i == index)
    239                 return (*it);
    240             ++i;
    241         }
    242         return 0;
    243     }
    244 
    245     void BaseObject::addEventContainer(const std::string& sectionname, EventContainer* container)
    246     {
    247         std::map<std::string, EventContainer*>::const_iterator it = this->eventContainers_.find(sectionname);
    248         if (it != this->eventContainers_.end())
    249         {
    250             COUT(2) << "Warning: Overwriting EventContainer in class " << this->getIdentifier()->getName() << "." << std::endl;
    251             delete (it->second);
    252         }
    253 
    254         this->eventContainers_[sectionname] = container;
    255     }
    256 
    257     EventContainer* BaseObject::getEventContainer(const std::string& sectionname) const
    258     {
    259         std::map<std::string, EventContainer*>::const_iterator it = this->eventContainers_.find(sectionname);
    260         if (it != this->eventContainers_.end())
    261             return ((*it).second);
    262         else
    263             return 0;
    264     }
    265 
    266     void BaseObject::fireEvent()
    267     {
    268         this->fireEvent(true);
    269         this->fireEvent(false);
    270     }
    271 
    272     void BaseObject::fireEvent(bool activate)
    273     {
    274         this->fireEvent(activate, this);
    275     }
    276 
    277     void BaseObject::fireEvent(bool activate, BaseObject* originator)
    278     {
    279         Event event(activate, originator);
    280 
    281         for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    282         {
    283             event.sectionname_ = it->second;
    284             it->first->processEvent(event);
    285         }
    286     }
    287 
    288     void BaseObject::fireEvent(Event& event)
    289     {
    290         for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    291             it->first->processEvent(event);
    292     }
    293 
    294     void BaseObject::processEvent(Event& event)
    295     {
    296         ORXONOX_SET_EVENT(BaseObject, "activity", setActive, event);
    297         ORXONOX_SET_EVENT(BaseObject, "visibility", setVisible, event);
    298     }
    299 
    300     void BaseObject::setMainStateName(const std::string& name)
    301     {
    302         if (this->mainStateName_ != name)
    303         {
    304             this->mainStateName_ = name;
    305             if (this->functorSetMainState_)
    306                 delete this->functorSetMainState_;
    307             if (this->functorGetMainState_)
    308                 delete this->functorGetMainState_;
    309             this->changedMainState();
    310             if (!this->functorSetMainState_)
    311                 COUT(2) << "Warning: \"" << name << "\" is not a valid MainState." << std::endl;
    312         }
    313     }
    314 
    315     void BaseObject::setMainState(bool state)
    316     {
    317         if (this->functorSetMainState_)
    318             (*this->functorSetMainState_)(state);
    319         else
    320             COUT(2) << "Warning: No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << std::endl;
    321     }
    322 
    323     bool BaseObject::getMainState() const
    324     {
    325         if (this->functorGetMainState_)
    326         {
    327             (*this->functorGetMainState_)();
    328             return this->functorGetMainState_->getReturnvalue();
    329         }
    330         else
    331         {
    332             COUT(2) << "Warning: No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << std::endl;
    333             return false;
    334         }
    335     }
    336 
    337     void BaseObject::changedMainState()
    338     {
    339         SetMainState(BaseObject, "activity",   setActive,  isActive);
    340         SetMainState(BaseObject, "visibility", setVisible, isVisible);
    341     }
    34260}
  • sandbox/src/libraries/core/BaseObject.h

    r5738 r5782  
    3737#define _BaseObject_H__
    3838
    39 #define SetMainState(classname, statename, setfunction, getfunction) \
    40     if (this->getMainStateName() == statename) \
    41     { \
    42         this->functorSetMainState_ = createFunctor(&classname::setfunction)->setObject(this); \
    43         this->functorGetMainState_ = createFunctor(&classname::getfunction)->setObject(this); \
    44     }
    45 
    46 
    4739#include "CorePrereqs.h"
    48 
    49 #include <map>
    50 #include <list>
    51 
    52 #include "util/mbool.h"
    5340#include "OrxonoxClass.h"
    54 #include "Super.h"
    5541
    5642namespace orxonox
    5743{
    58     class Scene;
    59     class Gametype;
    60 
    6144    //! The BaseObject is the parent of all classes representing an instance in the game.
    6245    class _CoreExport BaseObject : virtual public OrxonoxClass
    6346    {
    64         template <class T> friend class XMLPortClassParamContainer;
    65 
    6647        public:
    6748            BaseObject(BaseObject* creator);
    6849            virtual ~BaseObject();
    69             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    7050
    7151            /** @brief Returns if the object was initialized (passed the object registration). @return True was the object is initialized */
    7252            inline bool isInitialized() const { return this->bInitialized_; }
    7353
    74             /** @brief Sets the name of the object. @param name The name */
    75             inline void setName(const std::string& name) { this->oldName_ = this->name_; this->name_ = name; this->changedName(); }
    76             /** @brief Returns the name of the object. */
    77             inline const std::string& getName() const { return this->name_; }
    78             /** @brief Returns the old name of the object. */
    79             inline const std::string& getOldName() const { return this->oldName_; }
    80             /** @brief This function gets called if the name of the object changes. */
    81             virtual void changedName() {}
    82 
    83             /** @brief Sets the state of the objects activity. @param bActive True = active */
    84             inline void setActive(bool bActive)
    85             {
    86                 if (this->bActive_ != bActive)
    87                 {
    88                     this->bActive_ = bActive;
    89                     this->changedActivity();
    90                 }
    91             }
    92             /** @brief Returns the state of the objects activity. @return The state of the activity */
    93             inline const mbool& isActive() const { return this->bActive_; }
    94             /** @brief This function gets called if the activity of the object changes. */
    95             virtual void changedActivity() {}
    96 
    97             /** @brief Sets the state of the objects visibility. @param bVisible True = visible */
    98             inline void setVisible(bool bVisible)
    99             {
    100                 if (this->bVisible_ != bVisible)
    101                 {
    102                     this->bVisible_ = bVisible;
    103                     this->changedVisibility();
    104                 }
    105             }
    106             /** @brief Returns the state of the objects visibility. @return The state of the visibility */
    107             inline const mbool& isVisible() const { return this->bVisible_; }
    108             /** @brief This function gets called if the visibility of the object changes. */
    109             virtual void changedVisibility() {}
    110 
    111             void setMainState(bool state);
    112             bool getMainState() const;
    113 
    114             void setMainStateName(const std::string& name);
    115             inline const std::string& getMainStateName() const { return this->mainStateName_; }
    116             virtual void changedMainState();
    117 
    118             /** @brief Sets a pointer to the xml file that loaded this object. @param file The pointer to the XMLFile */
    119             inline void setFile(const XMLFile* file) { this->file_ = file; }
    120             /** @brief Returns a pointer to the XMLFile that loaded this object. @return The XMLFile */
    121             inline const XMLFile* getFile() const { return this->file_; }
    122             const std::string& getFilename() const;
    123 
    124             void addTemplate(const std::string& name);
    125             void addTemplate(Template* temp);
    126             /** @brief Returns the set of all aplied templates. */
    127             inline const std::set<Template*>& getTemplates() const
    128                 { return this->templates_; }
    129 
    130             virtual inline void setNamespace(Namespace* ns) { this->namespace_ = ns; }
    131             inline Namespace* getNamespace() const { return this->namespace_; }
    132 
    13354            inline void setCreator(BaseObject* creator) { this->creator_ = creator; }
    13455            inline BaseObject* getCreator() const { return this->creator_; }
    13556
    136             inline void setScene(Scene* scene) { this->scene_ = scene; }
    137             inline Scene* getScene() const { return this->scene_; }
    138 
    139             inline void setGametype(Gametype* gametype)
    140             {
    141                 if (gametype != this->gametype_)
    142                 {
    143                     this->oldGametype_ = this->gametype_;
    144                     this->gametype_ = gametype;
    145                     this->changedGametype();
    146                 }
    147             }
    148             inline Gametype* getGametype() const { return this->gametype_; }
    149             inline Gametype* getOldGametype() const { return this->oldGametype_; }
    150             virtual void changedGametype() {}
    151 
    152             void fireEvent();
    153             void fireEvent(bool activate);
    154             void fireEvent(bool activate, BaseObject* originator);
    155             void fireEvent(Event& event);
    156 
    157             virtual void processEvent(Event& event);
    158 
    159             inline void registerEventListener(BaseObject* object, const std::string& sectionname)
    160                 { this->eventListeners_[object] = sectionname; }
    161             inline void unregisterEventListener(BaseObject* object)
    162                 { this->eventListeners_.erase(object); }
    163 
    164             void addEvent(BaseObject* event, const std::string& sectionname);
    165             void removeEvent(BaseObject* event);
    166             BaseObject* getEvent(unsigned int index) const;
    167 
    168             void addEventContainer(const std::string& sectionname, EventContainer* container);
    169             EventContainer* getEventContainer(const std::string& sectionname) const;
    170 
    171             /** @brief Sets the indentation of the debug output in the Loader. @param indentation The indentation */
    172             inline void setLoaderIndentation(const std::string& indentation) { this->loaderIndentation_ = indentation; }
    173             /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */
    174             inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; }
    175 
    176         protected:
    177             std::string name_;                                 //!< The name of the object
    178             std::string oldName_;                              //!< The old name of the object
    179             mbool       bActive_;                              //!< True = the object is active
    180             mbool       bVisible_;                             //!< True = the object is visible
    181             std::string mainStateName_;
    182             Functor*    functorSetMainState_;
    183             Functor*    functorGetMainState_;
    184 
    18557        private:
    186             void setXMLName(const std::string& name);
    187             Template* getTemplate(unsigned int index) const;
    188 
    18958            bool                   bInitialized_;              //!< True if the object was initialized (passed the object registration)
    190             const XMLFile*         file_;                      //!< The XMLFile that loaded this object
    191             Element*               lastLoadedXMLElement_;      //!< Non 0 if the TinyXML attributes have already been copied to our own lowercase map
    192             std::map<std::string, std::string> xmlAttributes_; //!< Lowercase XML attributes
    193             std::string            loaderIndentation_;         //!< Indentation of the debug output in the Loader
    194             Namespace*             namespace_;
    19559            BaseObject*            creator_;
    196             Scene*                 scene_;
    197             Gametype*              gametype_;
    198             Gametype*              oldGametype_;
    199             std::set<Template*>    templates_;
    200             std::map<BaseObject*,  std::string> eventListeners_;
    201             std::list<BaseObject*> events_;
    202             std::map<std::string, EventContainer*> eventContainers_;
    20360    };
    204 
    205     SUPER_FUNCTION(0, BaseObject, XMLPort, false);
    206     SUPER_FUNCTION(2, BaseObject, changedActivity, false);
    207     SUPER_FUNCTION(3, BaseObject, changedVisibility, false);
    208     SUPER_FUNCTION(4, BaseObject, processEvent, false);
    209     SUPER_FUNCTION(6, BaseObject, changedMainState, false);
    210     SUPER_FUNCTION(9, BaseObject, changedName, false);
    211     SUPER_FUNCTION(10, BaseObject, changedGametype, false);
    21261}
    21362
  • sandbox/src/libraries/core/CMakeLists.txt

    r5738 r5782  
    2525  DynLib.cc
    2626  DynLibManager.cc
    27   Event.cc
    2827  Game.cc
    29   GameMode.cc
    3028  GameState.cc
    31   GraphicsManager.cc
    32   GUIManager.cc
    3329  Language.cc
    3430  LuaState.cc
    35   MemoryArchive.cc
    3631  ObjectListBase.cc
    3732  OrxonoxClass.cc
    38   Resource.cc
    39   WindowEventListener.cc
    4033
    4134  # command
    42   ArgumentCompletionFunctions.cc
    43   CommandEvaluation.cc
    44   CommandExecutor.cc
    4535  CommandLine.cc
    46   ConsoleCommand.cc
    47   ConsoleCommandCompilation.cc
    4836  Executor.cc
    4937
     
    5543  # level
    5644  BaseObject.cc
    57   ClassTreeMask.cc
    58   Loader.cc
    59   Namespace.cc
    60   NamespaceNode.cc
    61   Template.cc
    62   XMLPort.cc
    63   XMLNameListener.cc
    6445
    65   # shell
    66   IRC.cc
    67   Shell.cc
    68   TclBind.cc
    69   TclThreadManager.cc
    70  
    7146  # multithreading
    7247  Thread.cc
    7348  ThreadPool.cc
    7449)
    75 ADD_SUBDIRECTORY(input)
    7650
    7751ORXONOX_ADD_LIBRARY(core
    7852  FIND_HEADER_FILES
    7953  TOLUA_FILES
    80     CommandExecutor.h
    81     Loader.h
    8254    LuaState.h
    8355  DEFINE_SYMBOL
     
    9163    ${Boost_THREAD_LIBRARY}
    9264    ${Boost_DATE_TIME_LIBRARY} # Thread dependency
    93     ${CEGUI_LIBRARY}
    94     ${CEGUILUA_LIBRARY}
    9565    ${LUA_LIBRARIES}
    96     cpptcl_orxonox
    97     ogreceguirenderer_orxonox
    98     ois_orxonox
    99     tinyxml++_orxonox
    10066    tolua++_orxonox
    10167    util
  • sandbox/src/libraries/core/ClassFactory.h

    r5738 r5782  
    5555    {
    5656        public:
    57             static bool create(const std::string& name, bool bLoadable = true);
     57            static bool create(const std::string& name);
    5858            BaseObject* fabricate(BaseObject* creator);
    5959
     
    7373    */
    7474    template <class T>
    75     bool ClassFactory<T>::create(const std::string& name, bool bLoadable)
     75    bool ClassFactory<T>::create(const std::string& name)
    7676    {
    7777        COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
    7878        ClassIdentifier<T>::getIdentifier(name)->addFactory(new ClassFactory<T>);
    79         ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
    8079        Factory::add(name, ClassIdentifier<T>::getIdentifier());
    8180
  • sandbox/src/libraries/core/Clock.h

    r5738 r5782  
    3131
    3232#include "CorePrereqs.h"
    33 #include "util/OgreForwardRefs.h"
     33
     34namespace Ogre { class Timer; }
    3435
    3536namespace orxonox
  • sandbox/src/libraries/core/ConfigFileManager.cc

    r5738 r5782  
    3434#include "util/Math.h"
    3535#include "util/StringUtils.h"
    36 #include "ConsoleCommand.h"
    3736#include "ConfigValueContainer.h"
    3837#include "Core.h"
     
    4039namespace orxonox
    4140{
    42     SetConsoleCommandShortcutExtern(config).argumentCompleter(0, autocompletion::configvalueclasses()).argumentCompleter(1, autocompletion::configvalues()).argumentCompleter(2, autocompletion::configvalue());
    43     SetConsoleCommandShortcutExtern(tconfig).argumentCompleter(0, autocompletion::configvalueclasses()).argumentCompleter(1, autocompletion::configvalues()).argumentCompleter(2, autocompletion::configvalue());
    44     SetConsoleCommandShortcutExtern(reloadConfig);
    45     SetConsoleCommandShortcutExtern(cleanConfig);
    46     SetConsoleCommandShortcutExtern(loadSettings).argumentCompleter(0, autocompletion::files());
    47 
    4841    bool config(const std::string& classname, const std::string& varname, const std::string& value)
    4942    {
  • sandbox/src/libraries/core/Core.cc

    r5759 r5782  
    6363#include "util/SignalHandler.h"
    6464#include "Clock.h"
    65 #include "CommandExecutor.h"
    6665#include "CommandLine.h"
    6766#include "ConfigFileManager.h"
     
    7069#include "DynLibManager.h"
    7170#include "Factory.h"
    72 #include "GameMode.h"
    73 #include "GraphicsManager.h"
    74 #include "GUIManager.h"
    7571#include "Identifier.h"
    7672#include "Language.h"
    7773#include "LuaState.h"
    78 #include "Shell.h"
    79 #include "TclBind.h"
    80 #include "TclThreadManager.h"
    81 #include "input/InputManager.h"
    8274
    8375// Boost 1.36 has some issues with deprecated functions that have been omitted
     
    117109            RegisterRootObject(CoreConfiguration);
    118110            this->setConfigValues();
    119 
    120             // External data directory only exists for dev runs
    121             if (Core::isDevelopmentRun())
    122             {
    123                 // Possible data path override by the command line
    124                 if (!CommandLine::getArgument("externalDataPath")->hasDefaultValue())
    125                     tsetExternalDataPath(CommandLine::getValue("externalDataPath"));
    126             }
    127111        }
    128112
     
    194178        }
    195179
    196         /**
    197         @brief
    198             Temporary sets the external data path
    199         @param path
    200             The new data path
    201         */
    202         void tsetExternalDataPath(const std::string& path)
    203         {
    204             externalDataPath_ = boost::filesystem::path(path);
    205         }
    206 
    207180        void initializeRandomNumberGenerator()
    208181        {
     
    228201        boost::filesystem::path modulePath_;            //!< Path to the modules
    229202        boost::filesystem::path dataPath_;              //!< Path to the data file folder
    230         boost::filesystem::path externalDataPath_;      //!< Path to the external data file folder
    231203        boost::filesystem::path configPath_;            //!< Path to the config file folder
    232204        boost::filesystem::path logPath_;               //!< Path to the log file folder
     
    237209        // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
    238210        : identifierDestroyer_(Identifier::destroyAllIdentifiers)
    239         // Cleanup guard for external console commands that don't belong to an Identifier
    240         , consoleCommandDestroyer_(CommandExecutor::destroyExternalCommands)
    241211        , configuration_(new CoreConfiguration()) // Don't yet create config values!
    242212        , bDevRun_(false)
    243         , bGraphicsLoaded_(false)
    244213    {
    245214        // Set the hard coded fixed paths
     
    339308        // possibility to configure everything below here
    340309        this->configuration_->initialise();
    341 
    342         // Load OGRE excluding the renderer and the render window
    343         this->graphicsManager_.reset(new GraphicsManager(false));
    344 
    345         // initialise Tcl
    346         this->tclBind_.reset(new TclBind(Core::getDataPathString()));
    347         this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
    348 
    349         // create a shell
    350         this->shell_.reset(new Shell());
    351310    }
    352311
     
    357316    Core::~Core()
    358317    {
    359     }
    360 
    361     void Core::loadGraphics()
    362     {
    363         // Any exception should trigger this, even in upgradeToGraphics (see its remarks)
    364         Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
    365 
    366         // Upgrade OGRE to receive a render window
    367         graphicsManager_->upgradeToGraphics();
    368 
    369         // Calls the InputManager which sets up the input devices.
    370         inputManager_.reset(new InputManager());
    371 
    372         // load the CEGUI interface
    373         guiManager_.reset(new GUIManager(graphicsManager_->getRenderWindow(),
    374             inputManager_->getMousePosition(), graphicsManager_->isFullScreen()));
    375 
    376         unloader.Dismiss();
    377 
    378         bGraphicsLoaded_ = true;
    379     }
    380 
    381     void Core::unloadGraphics()
    382     {
    383         this->guiManager_.reset();;
    384         this->inputManager_.reset();;
    385         this->graphicsManager_.reset();
    386 
    387         // Load Ogre::Root again, but without the render system
    388         try
    389             { this->graphicsManager_.reset(new GraphicsManager(false)); }
    390         catch (...)
    391         {
    392             COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl
    393                     << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl
    394                     << "Terminating the program." << std::endl;
    395             abort();
    396         }
    397 
    398         bGraphicsLoaded_ = false;
    399318    }
    400319
     
    457376    }
    458377
    459     /*static*/ void Core::tsetExternalDataPath(const std::string& path)
    460     {
    461         getInstance().configuration_->tsetExternalDataPath(path);
    462     }
    463 
    464378    /*static*/ const boost::filesystem::path& Core::getDataPath()
    465379    {
     
    469383    {
    470384        return getInstance().configuration_->dataPath_.string() + '/';
    471     }
    472 
    473     /*static*/ const boost::filesystem::path& Core::getExternalDataPath()
    474     {
    475         return getInstance().configuration_->externalDataPath_;
    476     }
    477     /*static*/ std::string Core::getExternalDataPathString()
    478     {
    479         return getInstance().configuration_->externalDataPath_.string() + '/';
    480385    }
    481386
     
    659564        {
    660565            configuration_->dataPath_  = specialConfig::dataDevDirectory;
    661             configuration_->externalDataPath_ = specialConfig::externalDataDevDirectory;
    662566            configuration_->configPath_ = specialConfig::configDevDirectory;
    663567            configuration_->logPath_    = specialConfig::logDevDirectory;
     
    725629    void Core::preUpdate(const Clock& time)
    726630    {
    727         if (this->bGraphicsLoaded_)
    728         {
    729             // process input events
    730             this->inputManager_->update(time);
    731             // process gui events
    732             this->guiManager_->update(time);
    733         }
    734         // process thread commands
    735         this->tclThreadManager_->update(time);
    736631    }
    737632
    738633    void Core::postUpdate(const Clock& time)
    739634    {
    740         if (this->bGraphicsLoaded_)
    741         {
    742             // Render (doesn't throw)
    743             this->graphicsManager_->update(time);
    744         }
    745635    }
    746636}
  • sandbox/src/libraries/core/Core.h

    r5738 r5782  
    8585            static void  resetLanguage();
    8686
    87             static void tsetExternalDataPath(const std::string& path);
    8887            //! Returns the path to the data files as boost::filesystem::path
    8988            static const boost::filesystem::path& getDataPath();
    90             //! Returns the path to the external data files as boost::filesystem::path
    91             static const boost::filesystem::path& getExternalDataPath();
    9289            //! Returns the path to the config files as boost::filesystem::path
    9390            static const boost::filesystem::path& getConfigPath();
     
    9895            //! Returns the path to the data files as std::string
    9996            static std::string getDataPathString();
    100             //! Returns the path to the external data files as std::string
    101             static std::string getExternalDataPathString();
    10297            //! Returns the path to the config files as std::string
    10398            static std::string getConfigPathString();
     
    115110            void postUpdate(const Clock& time);
    116111
    117             void loadGraphics();
    118             void unloadGraphics();
    119 
    120112            void setFixedPaths();
    121113            void setConfigurablePaths();
     
    126118            scoped_ptr<SignalHandler>     signalHandler_;
    127119            SimpleScopeGuard              identifierDestroyer_;
    128             SimpleScopeGuard              consoleCommandDestroyer_;
    129120            scoped_ptr<ConfigFileManager> configFileManager_;
    130121            scoped_ptr<Language>          languageInstance_;
    131122            scoped_ptr<CoreConfiguration> configuration_;
    132             scoped_ptr<TclBind>           tclBind_;
    133             scoped_ptr<TclThreadManager>  tclThreadManager_;
    134             scoped_ptr<Shell>             shell_;
    135             // graphical
    136             scoped_ptr<GraphicsManager>   graphicsManager_;     //!< Interface to OGRE
    137             scoped_ptr<InputManager>      inputManager_;        //!< Interface to OIS
    138             scoped_ptr<GUIManager>        guiManager_;          //!< Interface to GUI
    139123
    140124            bool                          bDevRun_;             //!< True for runs in the build directory (not installed)
    141             bool                          bGraphicsLoaded_;
    142125
    143126            static Core* singletonPtr_s;
  • sandbox/src/libraries/core/CoreIncludes.h

    r5738 r5782  
    8080*/
    8181#define CreateFactory(ClassName) \
    82     bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, true)
    83 
    84 /**
    85     @brief Creates the entry in the Factory for classes which should not be loaded through XML.
    86     @param ClassName The name of the class
    87 */
    88 #define CreateUnloadableFactory(ClassName) \
    89     bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName, false)
     82    bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName)
    9083
    9184/**
  • sandbox/src/libraries/core/CorePrecompiledHeaders.h

    r5749 r5782  
    7070#ifdef ORXONOX_COMPILER_MSVC
    7171
    72 #include <ois/OISKeyboard.h> // 15
    73 #include <ois/OISMouse.h>    // 15
    74 #include <ois/OISJoyStick.h> // 15
    75 
    7672#include "util/SubString.h"  // 14
    7773
  • sandbox/src/libraries/core/Factory.cc

    r5738 r5782  
    5555
    5656    /**
    57         @brief Returns the Identifier with a given network ID.
    58         @param id The network ID of the wanted Identifier
    59         @return The Identifier
    60     */
    61     Identifier* Factory::getIdentifier(const uint32_t id)
    62     {
    63         std::map<uint32_t, Identifier*>::const_iterator it = getFactoryPointer()->identifierNetworkIDMap_.find(id);
    64         if (it != getFactoryPointer()->identifierNetworkIDMap_.end())
    65             return it->second;
    66         else
    67             return 0;
    68     }
    69 
    70     /**
    7157        @brief Adds a new Identifier to both maps.
    7258        @param name The name of the identifier
     
    7662    {
    7763        getFactoryPointer()->identifierStringMap_[name] = identifier;
    78         getFactoryPointer()->identifierNetworkIDMap_[identifier->getNetworkID()] = identifier;
    79     }
    80 
    81     /**
    82         @brief Removes the entry with the old network ID and adds a new one.
    83         @param identifier The identifier to change
    84         @param oldID The old networkID
    85         @param newID The new networkID
    86     */
    87     void Factory::changeNetworkID(Identifier* identifier, const uint32_t oldID, const uint32_t newID)
    88     {
    89 //        getFactoryPointer()->identifierNetworkIDMap_.erase(oldID);
    90         getFactoryPointer()->identifierNetworkIDMap_[newID] = identifier;
    91     }
    92 
    93     /**
    94         @brief Cleans the NetworkID map (needed on clients for correct initialization)
    95     */
    96     void Factory::cleanNetworkIDs()
    97     {
    98         getFactoryPointer()->identifierNetworkIDMap_.clear();
    9964    }
    10065
  • sandbox/src/libraries/core/Factory.h

    r5738 r5782  
    6262            static Identifier* getIdentifier(const uint32_t id);
    6363            static void add(const std::string& name, Identifier* identifier);
    64             static void changeNetworkID(Identifier* identifier, const uint32_t oldID, const uint32_t newID);
    65             static void cleanNetworkIDs();
    6664            static void createClassHierarchy();
    6765
     
    8482
    8583            std::map<std::string, Identifier*> identifierStringMap_;            //!< The map, mapping the name with the Identifier
    86             std::map<uint32_t, Identifier*> identifierNetworkIDMap_;        //!< The map, mapping the network ID with the Identifier
    8784    };
    8885
  • sandbox/src/libraries/core/Game.cc

    r5747 r5782  
    4545#include "Clock.h"
    4646#include "CommandLine.h"
    47 #include "ConsoleCommand.h"
    4847#include "Core.h"
    4948#include "CoreIncludes.h"
    5049#include "ConfigValueIncludes.h"
    51 #include "GameMode.h"
    5250#include "GameState.h"
    5351
    5452namespace orxonox
    5553{
    56     static void stop_game()
    57         { Game::getInstance().stop(); }
    58     SetConsoleCommandShortcutExternAlias(stop_game, "exit");
    59 
    6054    std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
    6155    Game* Game::singletonPtr_s = 0;
     
    506500    void Game::loadGraphics()
    507501    {
    508         if (!GameMode::bShowsGraphics_s)
    509         {
    510             core_->loadGraphics();
    511             Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics);
    512             GameMode::bShowsGraphics_s = true;
    513 
    514             // Construct all the GameStates that require graphics
    515             for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
    516                 it != gameStateDeclarations_s.end(); ++it)
    517             {
    518                 if (it->second.bGraphicsMode)
    519                 {
    520                     // Game state loading failure is serious --> don't catch
    521                     shared_ptr<GameState> gameState = GameStateFactory::fabricate(it->second);
    522                     if (!constructedStates_.insert(std::make_pair(
    523                         it->second.stateName, gameState)).second)
    524                         assert(false); // GameState was already created!
    525                 }
    526             }
    527             graphicsUnloader.Dismiss();
    528         }
    529502    }
    530503
    531504    void Game::unloadGraphics()
    532505    {
    533         if (GameMode::bShowsGraphics_s)
    534         {
    535             // Destroy all the GameStates that require graphics
    536             for (GameStateMap::iterator it = constructedStates_.begin(); it != constructedStates_.end();)
    537             {
    538                 if (it->second->getInfo().bGraphicsMode)
    539                     constructedStates_.erase(it++);
    540                 else
    541                     ++it;
    542             }
    543 
    544             core_->unloadGraphics();
    545             GameMode::bShowsGraphics_s = false;
    546         }
    547506    }
    548507
     
    563522        // If state requires graphics, load it
    564523        Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics);
    565         if (gameStateDeclarations_s[name].bGraphicsMode && !GameMode::showsGraphics())
     524        if (gameStateDeclarations_s[name].bGraphicsMode)
    566525            this->loadGraphics();
    567526        else
  • sandbox/src/libraries/core/Identifier.cc

    r5738 r5782  
    3838#include "util/StringUtils.h"
    3939#include "ConfigValueContainer.h"
    40 #include "ConsoleCommand.h"
    4140#include "Factory.h"
    42 #include "XMLPort.h"
    4341
    4442namespace orxonox
     
    6159        this->bSetName_ = false;
    6260        this->factory_ = 0;
    63         this->bLoadable_ = true;
    6461
    6562        this->bHasConfigValues_ = false;
    66         this->bHasConsoleCommands_ = false;
    6763
    6864        this->children_ = new std::set<const Identifier*>();
    6965        this->directChildren_ = new std::set<const Identifier*>();
    70 
    71         // Default network ID is the class ID
    72         this->networkID_ = this->classID_;
    7366    }
    7467
     
    8578            delete this->factory_;
    8679
    87         for (std::map<std::string, ConsoleCommand*>::iterator it = this->consoleCommands_.begin(); it != this->consoleCommands_.end(); ++it)
    88             delete (it->second);
    8980        for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
    90             delete (it->second);
    91         for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it)
    92             delete (it->second);
    93         for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
    9481            delete (it->second);
    9582    }
     
    188175                // Tell the parent we're one of it's direct children
    189176                (*it)->getDirectChildrenIntern().insert((*it)->getDirectChildrenIntern().end(), this);
    190 
    191                 // Create the super-function dependencies
    192                 (*it)->createSuperFunctionCaller();
    193177            }
    194178        }
     
    240224
    241225    /**
    242         @brief Sets the network ID to a new value and changes the entry in the Factory.
    243         @param id The new network ID
    244     */
    245     void Identifier::setNetworkID(uint32_t id)
    246     {
    247         Factory::changeNetworkID(this, this->networkID_, id);
    248         this->networkID_ = id;
    249     }
    250 
    251     /**
    252226        @brief Returns true, if the Identifier is at least of the given type.
    253227        @param identifier The identifier to compare with
     
    371345
    372346    /**
    373         @brief Adds a new console command of this class.
    374         @param executor The executor of the command
    375         @param bCreateShortcut If this is true a shortcut gets created so you don't have to add the classname to access this command
    376         @return The executor of the command
    377     */
    378     ConsoleCommand& Identifier::addConsoleCommand(ConsoleCommand* command, bool bCreateShortcut)
    379     {
    380         std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_.find(command->getName());
    381         if (it != this->consoleCommands_.end())
    382         {
    383             COUT(2) << "Warning: Overwriting console-command with name " << command->getName() << " in class " << this->getName() << "." << std::endl;
    384             delete (it->second);
    385         }
    386 
    387         this->bHasConsoleCommands_ = true;
    388         this->consoleCommands_[command->getName()] = command;
    389         this->consoleCommands_LC_[getLowercase(command->getName())] = command;
    390 
    391         if (bCreateShortcut)
    392             CommandExecutor::addConsoleCommandShortcut(command);
    393 
    394         return (*command);
    395     }
    396 
    397     /**
    398         @brief Returns the executor of a console command with given name.
    399         @brief name The name of the requested console command
    400         @return The executor of the requested console command
    401     */
    402     ConsoleCommand* Identifier::getConsoleCommand(const std::string& name) const
    403     {
    404         std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_.find(name);
    405         if (it != this->consoleCommands_.end())
    406             return (*it).second;
    407         else
    408             return 0;
    409     }
    410 
    411     /**
    412         @brief Returns the executor of a console command with given name in lowercase.
    413         @brief name The name of the requested console command in lowercae
    414         @return The executor of the requested console command
    415     */
    416     ConsoleCommand* Identifier::getLowercaseConsoleCommand(const std::string& name) const
    417     {
    418         std::map<std::string, ConsoleCommand*>::const_iterator it = this->consoleCommands_LC_.find(name);
    419         if (it != this->consoleCommands_LC_.end())
    420             return (*it).second;
    421         else
    422             return 0;
    423     }
    424 
    425     /**
    426         @brief Returns a XMLPortParamContainer that loads a parameter of this class.
    427         @param paramname The name of the parameter
    428         @return The container
    429     */
    430     XMLPortParamContainer* Identifier::getXMLPortParamContainer(const std::string& paramname)
    431     {
    432         std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
    433         if (it != this->xmlportParamContainers_.end())
    434             return ((*it).second);
    435         else
    436             return 0;
    437     }
    438 
    439     /**
    440         @brief Adds a new XMLPortParamContainer that loads a parameter of this class.
    441         @param paramname The name of the parameter
    442         @param container The container
    443     */
    444     void Identifier::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container)
    445     {
    446         std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
    447         if (it != this->xmlportParamContainers_.end())
    448         {
    449             COUT(2) << "Warning: Overwriting XMLPortParamContainer in class " << this->getName() << "." << std::endl;
    450             delete (it->second);
    451         }
    452 
    453         this->xmlportParamContainers_[paramname] = container;
    454     }
    455 
    456     /**
    457         @brief Returns a XMLPortObjectContainer that attaches an object to this class.
    458         @param sectionname The name of the section that contains the attachable objects
    459         @return The container
    460     */
    461     XMLPortObjectContainer* Identifier::getXMLPortObjectContainer(const std::string& sectionname)
    462     {
    463         std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
    464         if (it != this->xmlportObjectContainers_.end())
    465             return ((*it).second);
    466         else
    467             return 0;
    468     }
    469 
    470     /**
    471         @brief Adds a new XMLPortObjectContainer that attaches an object to this class.
    472         @param sectionname The name of the section that contains the attachable objects
    473         @param container The container
    474     */
    475     void Identifier::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container)
    476     {
    477         std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
    478         if (it != this->xmlportObjectContainers_.end())
    479         {
    480             COUT(2) << "Warning: Overwriting XMLPortObjectContainer in class " << this->getName() << "." << std::endl;
    481             delete (it->second);
    482         }
    483 
    484         this->xmlportObjectContainers_[sectionname] = container;
    485     }
    486 
    487     /**
    488         @brief Returns a XMLPortEventContainer that attaches an event to this class.
    489         @param sectionname The name of the section that contains the event
    490         @return The container
    491     */
    492     XMLPortObjectContainer* Identifier::getXMLPortEventContainer(const std::string& eventname)
    493     {
    494         std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportEventContainers_.find(eventname);
    495         if (it != this->xmlportEventContainers_.end())
    496             return ((*it).second);
    497         else
    498             return 0;
    499     }
    500 
    501     /**
    502         @brief Adds a new XMLPortEventContainer that attaches an event to this class.
    503         @param sectionname The name of the section that contains the event
    504         @param container The container
    505     */
    506     void Identifier::addXMLPortEventContainer(const std::string& eventname, XMLPortObjectContainer* container)
    507     {
    508         std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportEventContainers_.find(eventname);
    509         if (it != this->xmlportEventContainers_.end())
    510         {
    511             COUT(2) << "Warning: Overwriting XMLPortEventContainer in class " << this->getName() << "." << std::endl;
    512             delete (it->second);
    513         }
    514 
    515         this->xmlportEventContainers_[eventname] = container;
    516     }
    517 
    518     /**
    519347        @brief Lists the names of all Identifiers in a std::set<const Identifier*>.
    520348        @param out The outstream
  • sandbox/src/libraries/core/Identifier.h

    r5738 r5782  
    6666#include "ObjectList.h"
    6767#include "ObjectListBase.h"
    68 #include "Super.h"
    6968
    7069namespace orxonox
     
    107106            bool isDirectParentOf(const Identifier* identifier) const;
    108107
    109             /** @brief Returns true if the class can be loaded through XML. */
    110             inline bool isLoadable() const { return this->bLoadable_; }
    111             /** @brief Set the class to be loadable through XML or not. */
    112             inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; }
    113 
    114108            /** @brief Returns the list of all existing objects of this class. @return The list */
    115109            inline ObjectListBase* getObjects() const
     
    181175
    182176
    183             /** @brief Returns the map that stores all console commands. @return The const_iterator */
    184             inline const std::map<std::string, ConsoleCommand*>& getConsoleCommandMap() const { return this->consoleCommands_; }
    185             /** @brief Returns a const_iterator to the beginning of the map that stores all console commands. @return The const_iterator */
    186             inline std::map<std::string, ConsoleCommand*>::const_iterator getConsoleCommandMapBegin() const { return this->consoleCommands_.begin(); }
    187             /** @brief Returns a const_iterator to the end of the map that stores all console commands. @return The const_iterator */
    188             inline std::map<std::string, ConsoleCommand*>::const_iterator getConsoleCommandMapEnd() const { return this->consoleCommands_.end(); }
    189 
    190             /** @brief Returns the map that stores all console commands with their names in lowercase. @return The const_iterator */
    191             inline const std::map<std::string, ConsoleCommand*>& getLowercaseConsoleCommandMap() const { return this->consoleCommands_LC_; }
    192             /** @brief Returns a const_iterator to the beginning of the map that stores all console commands with their names in lowercase. @return The const_iterator */
    193             inline std::map<std::string, ConsoleCommand*>::const_iterator getLowercaseConsoleCommandMapBegin() const { return this->consoleCommands_LC_.begin(); }
    194             /** @brief Returns a const_iterator to the end of the map that stores all console commands with their names in lowercase. @return The const_iterator */
    195             inline std::map<std::string, ConsoleCommand*>::const_iterator getLowercaseConsoleCommandMapEnd() const { return this->consoleCommands_LC_.end(); }
    196 
    197             /** @brief Returns the map that stores all XMLPort params. @return The const_iterator */
    198             inline const std::map<std::string, XMLPortParamContainer*>& getXMLPortParamMap() const { return this->xmlportParamContainers_; }
    199             /** @brief Returns a const_iterator to the beginning of the map that stores all XMLPort params. @return The const_iterator */
    200             inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapBegin() const { return this->xmlportParamContainers_.begin(); }
    201             /** @brief Returns a const_iterator to the end of the map that stores all XMLPort params. @return The const_iterator */
    202             inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapEnd() const { return this->xmlportParamContainers_.end(); }
    203 
    204             /** @brief Returns the map that stores all XMLPort objects. @return The const_iterator */
    205             inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortObjectMap() const { return this->xmlportObjectContainers_; }
    206             /** @brief Returns a const_iterator to the beginning of the map that stores all XMLPort objects. @return The const_iterator */
    207             inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapBegin() const { return this->xmlportObjectContainers_.begin(); }
    208             /** @brief Returns a const_iterator to the end of the map that stores all XMLPort objects. @return The const_iterator */
    209             inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapEnd() const { return this->xmlportObjectContainers_.end(); }
    210 
    211             /** @brief Returns the map that stores all XMLPort events. @return The const_iterator */
    212             inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortEventMap() const { return this->xmlportEventContainers_; }
    213             /** @brief Returns a const_iterator to the beginning of the map that stores all XMLPort events. @return The const_iterator */
    214             inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortEventMapBegin() const { return this->xmlportEventContainers_.begin(); }
    215             /** @brief Returns a const_iterator to the end of the map that stores all XMLPort events. @return The const_iterator */
    216             inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortEventMapEnd() const { return this->xmlportEventContainers_.end(); }
    217 
    218177            /** @brief Returns true if this class has at least one config value. @return True if this class has at least one config value */
    219178            inline bool hasConfigValues() const { return this->bHasConfigValues_; }
    220             /** @brief Returns true if this class has at least one console command. @return True if this class has at least one console command */
    221             inline bool hasConsoleCommands() const { return this->bHasConsoleCommands_; }
    222179
    223180            /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */
    224181            inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
    225 
    226             /** @brief Returns the network ID to identify a class through the network. @return the network ID */
    227             inline const uint32_t getNetworkID() const { return this->networkID_; }
    228 
    229             /** @brief Sets the network ID to a new value. @param id The new value */
    230             void setNetworkID(uint32_t id);
    231182
    232183            /** @brief Returns the unique ID of the class */
     
    236187            ConfigValueContainer* getConfigValueContainer(const std::string& varname);
    237188            ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname);
    238 
    239             void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container);
    240             XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname);
    241 
    242             void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container);
    243             XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname);
    244 
    245             void addXMLPortEventContainer(const std::string& eventname, XMLPortObjectContainer* container);
    246             XMLPortObjectContainer* getXMLPortEventContainer(const std::string& eventname);
    247 
    248             ConsoleCommand& addConsoleCommand(ConsoleCommand* command, bool bCreateShortcut);
    249             ConsoleCommand* getConsoleCommand(const std::string& name) const;
    250             ConsoleCommand* getLowercaseConsoleCommand(const std::string& name) const;
    251189
    252190            void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
     
    260198
    261199            static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
    262             virtual void createSuperFunctionCaller() const = 0;
    263200
    264201            /** @brief Returns the map that stores all Identifiers. @return The map */
     
    305242            bool bCreatedOneObject_;                                       //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
    306243            bool bSetName_;                                                //!< True if the name is set
    307             bool bLoadable_;                                               //!< False = it's not permitted to load the object through XML
    308244            std::string name_;                                             //!< The name of the class the Identifier belongs to
    309245            BaseFactory* factory_;                                         //!< The Factory, able to create new objects of the given class (if available)
    310246            static int hierarchyCreatingCounter_s;                         //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
    311             uint32_t networkID_;                                           //!< The network ID to identify a class through the network
    312247            const unsigned int classID_;                                   //!< Uniquely identifies a class (might not be the same as the networkID_)
    313248            static unsigned int classIDCounter_s;                          //!< Static counter for the unique classIDs
     
    316251            std::map<std::string, ConfigValueContainer*> configValues_;    //!< A map to link the string of configurable variables with their ConfigValueContainer
    317252            std::map<std::string, ConfigValueContainer*> configValues_LC_; //!< A map to link the string of configurable variables with their ConfigValueContainer
    318 
    319             bool bHasConsoleCommands_;                                     //!< True if this class has at least one assigned console command
    320             std::map<std::string, ConsoleCommand*> consoleCommands_;       //!< All console commands of this class
    321             std::map<std::string, ConsoleCommand*> consoleCommands_LC_;    //!< All console commands of this class with their names in lowercase
    322 
    323             std::map<std::string, XMLPortParamContainer*> xmlportParamContainers_;     //!< All loadable parameters
    324             std::map<std::string, XMLPortObjectContainer*> xmlportObjectContainers_;   //!< All attachable objects
    325             std::map<std::string, XMLPortObjectContainer*> xmlportEventContainers_;    //!< All events
    326253    };
    327254
     
    344271    class ClassIdentifier : public Identifier
    345272    {
    346         #define SUPER_INTRUSIVE_DECLARATION_INCLUDE
    347         #include "Super.h"
    348 
    349273        public:
    350274            static ClassIdentifier<T> *getIdentifier();
     
    360284            ClassIdentifier()
    361285            {
    362                 SuperFunctionInitialization<0, T>::initialize(this);
    363286            }
    364287            ~ClassIdentifier()
    365288            {
    366                 SuperFunctionDestruction<0, T>::destroy(this);
    367289            }
    368290
     
    630552                { return this->identifier_; }
    631553
    632 //            /** @brief Returns true, if the assigned identifier is at least of the given type. @param identifier The identifier to compare with */
    633 //            inline bool isA(const Identifier* identifier) const
    634 //                { return this->identifier_->isA(identifier); }
    635 //
    636 //            /** @brief Returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */
    637 //            inline bool isExactlyA(const Identifier* identifier) const
    638 //                { return this->identifier_->isExactlyA(identifier); }
    639 //
    640 //            /** @brief Returns true, if the assigned identifier is a child of the given identifier. @param identifier The identifier to compare with */
    641 //            inline bool isChildOf(const Identifier* identifier) const
    642 //                { return this->identifier_->isChildOf(identifier); }
    643 //
    644 //            /** @brief Returns true, if the assigned identifier is a direct child of the given identifier. @param identifier The identifier to compare with */
    645 //            inline bool isDirectChildOf(const Identifier* identifier) const
    646 //                { return this->identifier_->isDirectChildOf(identifier); }
    647 //
    648 //            /** @brief Returns true, if the assigned identifier is a parent of the given identifier. @param identifier The identifier to compare with */
    649 //            inline bool isParentOf(const Identifier* identifier) const
    650 //                { return this->identifier_->isParentOf(identifier); }
    651 //
    652 //            /** @brief Returns true, if the assigned identifier is a direct parent of the given identifier. @param identifier The identifier to compare with */
    653 //            inline bool isDirectParentOf(const Identifier* identifier) const
    654 //                { return this->identifier_->isDirectParentOf(identifier); }
    655 
    656554        private:
    657555            Identifier* identifier_;            //!< The assigned identifier
  • sandbox/src/libraries/core/LuaState.cc

    r5759 r5782  
    3030#include "LuaState.h"
    3131
     32#include <boost/filesystem.hpp>
    3233#include <tolua/tolua++.h>
    3334extern "C" {
     
    3839#include "util/Debug.h"
    3940#include "Core.h"
    40 #include "Resource.h"
    4141#include "ToluaBindCore.h"
    4242
     
    7171        // Create dummy file info
    7272        sourceFileInfo_.reset(new ResourceInfo());
    73         sourceFileInfo_->group = "General";
    74         sourceFileInfo_->size = 0;
    7573
    7674        // Push 'this' pointer
     
    8785    }
    8886
    89     shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename, const std::string& resourceGroup, bool bSearchOtherPaths)
     87    shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename, bool bSearchOtherPaths)
    9088    {
    9189        shared_ptr<ResourceInfo> sourceInfo;
    92         if (resourceGroup != "NoResourceGroupProvided")
    93             sourceInfo = Resource::getInfo(filename, resourceGroup);
     90        sourceInfo = this->getFileInfo(filename);
    9491
    9592        // Continue search if not explicitely forbidden
     
    9794        {
    9895            // Call might be relative to the file currently being processed
    99             sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename, sourceFileInfo_->group);
     96            sourceInfo = this->getFileInfo(sourceFileInfo_->path + filename);
    10097            if (sourceInfo == NULL)
    10198            {
    10299                // Maybe find something in the same group but in the root path
    103                 sourceInfo = Resource::getInfo(filename, sourceFileInfo_->group);
     100                sourceInfo = this->getFileInfo(filename);
    104101            }
    105102        }
     
    107104    }
    108105
    109     void LuaState::includeFile(const std::string& filename, const std::string& resourceGroup, bool bSearchOtherPaths)
    110     {
    111         shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename, resourceGroup, bSearchOtherPaths);
     106    shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
     107    {
     108        boost::filesystem::path filepath = Core::getDataPath() / "lua" / filename;
     109        if (boost::filesystem::exists(filepath))
     110        {
     111            shared_ptr<ResourceInfo> info(new ResourceInfo());
     112            info->filename = filepath.string();
     113            info->path = filepath.branch_path().string();
     114            info->basename = filepath.leaf();
     115            return info;
     116        }
     117        else
     118            return shared_ptr<ResourceInfo>();
     119    }
     120
     121    std::string LuaState::loadFile(const std::string& filename)
     122    {
     123        std::ifstream file(filename.c_str());
     124        std::ostringstream oss;
     125        oss << file.rdbuf();
     126        return oss.str();
     127    }
     128
     129    void LuaState::includeFile(const std::string& filename, bool bSearchOtherPaths)
     130    {
     131        shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename, bSearchOtherPaths);
    112132        if (sourceInfo != NULL)
    113             this->includeString(Resource::open(sourceInfo->filename, sourceInfo->group)->getAsString(), sourceInfo);
    114         else
    115             COUT(2) << "LuaState: Cannot include file '" << filename << "' in resource group '"
    116                     << (resourceGroup == "NoResourceGroupProvided" ? sourceFileInfo_->group : resourceGroup) << "': group not found." << std::endl;
     133            this->includeString(this->loadFile(sourceInfo->filename), sourceInfo);
     134        else
     135            COUT(2) << "LuaState: Cannot include file '" << filename << std::endl;
    117136    }
    118137
     
    129148    }
    130149
    131     void LuaState::doFile(const std::string& filename, const std::string& resourceGroup, bool bSearchOtherPaths)
    132     {
    133         shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename, resourceGroup, bSearchOtherPaths);
     150    void LuaState::doFile(const std::string& filename, bool bSearchOtherPaths)
     151    {
     152        shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename, bSearchOtherPaths);
    134153        if (sourceInfo != NULL)
    135             this->doString(Resource::open(sourceInfo->filename, sourceInfo->group)->getAsString(), sourceInfo);
    136         else
    137             COUT(2) << "LuaState: Cannot do file '" << filename << "' in resource group '"
    138                 << (resourceGroup == "NoResourceGroupProvided" ? sourceFileInfo_->group : resourceGroup) << "': group not found." << std::endl;
     154            this->doString(this->loadFile(sourceInfo->filename), sourceInfo);
     155        else
     156            COUT(2) << "LuaState: Cannot do file '" << filename << std::endl;
    139157    }
    140158
     
    186204    }
    187205
    188     bool LuaState::fileExists(const std::string& filename, const std::string& resourceGroup, bool bSearchOtherPaths)
    189     {
    190         shared_ptr<ResourceInfo> info =  this->getFileInfo(filename, resourceGroup, bSearchOtherPaths);
     206    bool LuaState::fileExists(const std::string& filename, bool bSearchOtherPaths)
     207    {
     208        shared_ptr<ResourceInfo> info =  this->getFileInfo(filename, bSearchOtherPaths);
    191209        if (info == NULL)
    192210            return false;
  • sandbox/src/libraries/core/LuaState.h

    r5738 r5782  
    4545namespace orxonox
    4646{
     47    //! Stores basic information about a File
     48    struct ResourceInfo
     49    {
     50        //! The file's fully qualified name
     51        std::string filename;
     52        //! Path name; separated by '/' and ending with '/'
     53        std::string path;
     54        //! Base filename
     55        std::string basename;
     56    };
     57
    4758    /**
    4859    @brief
     
    5667        ~LuaState();
    5768
    58         void doFile(const std::string& filename, const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export
     69        void doFile(const std::string& filename, bool bSearchOtherPaths = true); // tolua_export
    5970        void doString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo = shared_ptr<ResourceInfo>());
    6071
    61         void includeFile(const std::string& filename, const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export
     72        void includeFile(const std::string& filename, bool bSearchOtherPaths = true); // tolua_export
    6273        void includeString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo = shared_ptr<ResourceInfo>());
    6374
    6475        void luaPrint(const std::string& str); // tolua_export
    6576        void luaLog(unsigned int level, const std::string& message); // tolua_export
    66         bool fileExists(const std::string& filename, const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export
     77        bool fileExists(const std::string& filename, bool bSearchOtherPaths = true); // tolua_export
    6778
    6879        const std::stringstream& getOutput() const { return output_; }
     
    7889
    7990    private:
    80         shared_ptr<ResourceInfo> getFileInfo(const std::string& filename, const std::string& resourceGroup, bool bSearchOtherPaths);
     91        shared_ptr<ResourceInfo> getFileInfo(const std::string& filename, bool bSearchOtherPaths);
     92        shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
     93        std::string loadFile(const std::string& filename);
    8194
    8295#if LUA_VERSION_NUM != 501
  • sandbox/src/libraries/util/CMakeLists.txt

    r5749 r5782  
    1919
    2020SET_SOURCE_FILES(UTIL_SRC_FILES
    21   Clipboard.cc
    2221  CRC32.cc
    2322  Exception.cc
  • sandbox/src/libraries/util/Exception.cc

    r5747 r5782  
    3434
    3535#include "Exception.h"
    36 #include <CEGUIExceptions.h>
    3736
    3837namespace orxonox
     
    106105            return ex.what();
    107106        }
    108         catch (const CEGUI::Exception& ex)
    109         {
    110 #if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
    111             return GeneralException(ex.getMessage().c_str()).getDescription();
    112 #else
    113             return GeneralException(ex.getMessage().c_str(), ex.getLine(),
    114                 ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
    115 #endif
    116         }
    117107        catch (...)
    118108        {
  • sandbox/src/modules/CMakeLists.txt

    r5752 r5782  
    2626
    2727################ Sub Directories ################
    28 
    29 ADD_SUBDIRECTORY(gamestates)
    30 ADD_SUBDIRECTORY(objects)
    31 ADD_SUBDIRECTORY(overlays)
    32 ADD_SUBDIRECTORY(pong)
    33 ADD_SUBDIRECTORY(questsystem)
    34 ADD_SUBDIRECTORY(weapons)
  • sandbox/src/orxonox/CMakeLists.txt

    r5752 r5782  
    2626SET_SOURCE_FILES(ORXONOX_SRC_FILES
    2727  Main.cc
    28 
    29   CameraManager.cc
    30   LevelManager.cc
    31   PawnManager.cc
    32   PlayerManager.cc
    33 
    34   Level.cc
    35   Radar.cc
    36   Scene.cc
     28  GSRoot.cc
    3729)
    38 
    39 ADD_SUBDIRECTORY(collisionshapes)
    40 ADD_SUBDIRECTORY(controllers)
    41 ADD_SUBDIRECTORY(gametypes)
    42 ADD_SUBDIRECTORY(graphics)
    43 ADD_SUBDIRECTORY(infos)
    44 ADD_SUBDIRECTORY(interfaces)
    45 ADD_SUBDIRECTORY(items)
    46 ADD_SUBDIRECTORY(overlays)
    47 ADD_SUBDIRECTORY(pickup)
    48 ADD_SUBDIRECTORY(sound)
    49 ADD_SUBDIRECTORY(weaponsystem)
    50 ADD_SUBDIRECTORY(worldentities)
    5130
    5231ORXONOX_ADD_LIBRARY(orxonox
    5332  FIND_HEADER_FILES
    54   TOLUA_FILES
    55     LevelManager.h
    56     pickup/BaseItem.h
    57     pickup/PickupInventory.h
    5833  DEFINE_SYMBOL
    5934    "ORXONOX_SHARED_BUILD"
    60   PCH_FILE
    61     OrxonoxPrecompiledHeaders.h
    6235  LINK_LIBRARIES
    63     ${Boost_FILESYSTEM_LIBRARY}
    64     ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
    65     ${Boost_THREAD_LIBRARY}
    66     ${Boost_DATE_TIME_LIBRARY} # Thread dependency
    67     ${OGRE_LIBRARY}
    68     ${OPENAL_LIBRARY}
    69     ${ALUT_LIBRARY}
    70     ${VORBISFILE_LIBRARY}
    71     ${VORBIS_LIBRARY}
    72     ${OGG_LIBRARY}
    73     tinyxml++_orxonox
    7436    tolua++_orxonox
    75     bullet_orxonox
    7637    util
    7738    core
    78     network
    79     tools
    8039  SOURCE_FILES ${ORXONOX_SRC_FILES}
    8140)
  • sandbox/src/orxonox/Main.cc

    r5695 r5782  
    4141#include "core/Game.h"
    4242#include "core/LuaState.h"
    43 #include "ToluaBindOrxonox.h"
    4443#include "Main.h"
    45 
    46 SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
    47 // Shortcuts for easy direct loading
    48 SetCommandLineSwitch(server).information("Start in server mode");
    49 SetCommandLineSwitch(client).information("Start in client mode");
    50 SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
    51 SetCommandLineSwitch(standalone).information("Start in standalone mode");
    52 
    53 DeclareToluaInterface(Orxonox);
    5444
    5545namespace orxonox
     
    6555        game->setStateHierarchy(
    6656        "root"
    67         " graphics"
    68         "  mainMenu"
    69         "  standalone"
    70         "   level"
    71         "  server"
    72         "   level"
    73         "  client"
    74         "   level"
    75         " dedicated"
    76         "  level"
    77         " ioConsole"
    7857        );
    7958
    8059        game->requestState("root");
    81 
    82         // Some development hacks (not really, but in the future, this calls won't make sense anymore)
    83         if (CommandLine::getValue("standalone").getBool())
    84             Game::getInstance().requestStates("graphics, standalone, level");
    85         else if (CommandLine::getValue("server").getBool())
    86             Game::getInstance().requestStates("graphics, server, level");
    87         else if (CommandLine::getValue("client").getBool())
    88             Game::getInstance().requestStates("graphics, client, level");
    89         else if (CommandLine::getValue("dedicated").getBool())
    90             Game::getInstance().requestStates("dedicated, level");
    91         else if (CommandLine::getValue("console").getBool())
    92             Game::getInstance().requestStates("ioConsole");
    93         else
    94             Game::getInstance().requestStates("graphics, mainMenu");
    9560
    9661        game->run();
  • sandbox/src/orxonox/OrxonoxPrereqs.h

    r5738 r5782  
    3636
    3737#include "OrxonoxConfig.h"
    38 
    39 #include "tools/ToolsPrereqs.h"
    4038
    4139//-----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.