Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 17, 2011, 5:47:22 AM (13 years ago)
Author:
rgrieder
Message:

Stripped down trunk to form a new light sandbox.

Location:
code/forks/sandbox_light/src/libraries
Files:
86 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • code/forks/sandbox_light/src/libraries/CMakeLists.txt

    r7401 r7908  
    2424ADD_SUBDIRECTORY(util)
    2525ADD_SUBDIRECTORY(core)
    26 ADD_SUBDIRECTORY(network)
    27 ADD_SUBDIRECTORY(tools)
  • code/forks/sandbox_light/src/libraries/core/CMakeLists.txt

    r7284 r7908  
    2020SET_SOURCE_FILES(CORE_SRC_FILES
    2121  CommandLineParser.cc
    22   ConfigValueContainer.cc
    2322  Core.cc
    24   DynLib.cc
    25   DynLibManager.cc
    26   Event.cc
    27   Game.cc
    28   GameMode.cc
    29   GameState.cc
    30   GraphicsManager.cc
    31   GUIManager.cc
    32   Language.cc
    33   LuaState.cc
    34   ObjectListBase.cc
    35   OrxonoxClass.cc
    36   Resource.cc
    37   WindowEventListener.cc
    38 
    39   # hierarchy
    40   Identifier.cc
    41   MetaObjectList.cc
    42 
    43   # level
    44   BaseObject.cc
    45   ClassTreeMask.cc
    46   Loader.cc
    47   Namespace.cc
    48   NamespaceNode.cc
    49   Template.cc
    50   XMLPort.cc
    51   XMLNameListener.cc
    52 
    53 COMPILATION_BEGIN FilesystemCompilation.cc
    54   command/ArgumentCompletionFunctions.cc
    55   ConfigFileManager.cc
    56   MemoryArchive.cc
    5723  PathConfig.cc
    58 COMPILATION_END
    59 
    60   # multithreading
    61   ThreadPool.cc
    62 COMPILATION_BEGIN ThreadCompilation.cc
    63   command/TclThreadManager.cc
    64   Thread.cc
    65 COMPILATION_END
    6624)
    67 
    68 ADD_SUBDIRECTORY(command)
    69 ADD_SUBDIRECTORY(input)
    7025
    7126ORXONOX_ADD_LIBRARY(core
    7227  FIND_HEADER_FILES
    73   TOLUA_FILES
    74     command/CommandExecutor.h
    75     ConfigFileManager.h
    76     Game.h
    77     GameMode.h
    78     GUIManager.h
    79     Loader.h
    80     LuaState.h
    81     PathConfig.h
    82     input/InputManager.h
    83     input/KeyBinder.h
    84     input/KeyBinderManager.h
    85   PCH_FILE
    86     CorePrecompiledHeaders.h
    8728  LINK_LIBRARIES
    88     ${OGRE_LIBRARY}
    8929    ${Boost_FILESYSTEM_LIBRARY}
    9030    ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
    91     ${Boost_THREAD_LIBRARY}
    92     ${Boost_DATE_TIME_LIBRARY} # Thread dependency
    93     ${CEGUI_LIBRARY}
    94     ${CEGUILUA_LIBRARY}
    95     ${LUA_LIBRARIES}
    96     cpptcl_orxonox
    97     ogreceguirenderer_orxonox
    98     ois_orxonox
    99     tinyxml_orxonox
    100     tolua_orxonox
    10131    util
    10232  SOURCE_FILES
  • code/forks/sandbox_light/src/libraries/core/Core.cc

    r7872 r7908  
    5151#endif
    5252
    53 #include "util/Clock.h"
    5453#include "util/Debug.h"
    55 #include "util/Exception.h"
    56 #include "util/Scope.h"
    57 #include "util/ScopedSingletonManager.h"
    5854#include "util/SignalHandler.h"
    5955#include "PathConfig.h"
    6056#include "CommandLineParser.h"
    61 #include "ConfigFileManager.h"
    62 #include "ConfigValueIncludes.h"
    63 #include "CoreIncludes.h"
    64 #include "DynLibManager.h"
    65 #include "GameMode.h"
    66 #include "GraphicsManager.h"
    67 #include "GUIManager.h"
    68 #include "Identifier.h"
    69 #include "Language.h"
    70 #include "LuaState.h"
    71 #include "command/ConsoleCommand.h"
    72 #include "command/IOConsole.h"
    73 #include "command/TclBind.h"
    74 #include "command/TclThreadManager.h"
    75 #include "input/InputManager.h"
    7657
    7758namespace orxonox
     
    8061    Core* Core::singletonPtr_s  = 0;
    8162
    82     SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
    83     SetCommandLineSwitch(noIOConsole).information("Use this if you don't want to use the IOConsole (for instance for Lua debugging)");
    84 
    8563#ifdef ORXONOX_PLATFORM_WINDOWS
    8664    SetCommandLineArgument(limitToCPU, 1).information("Limits the program to one CPU/core (1, 2, 3, etc.). Default is the first core (faster than off)");
     
    8866
    8967    Core::Core(const std::string& cmdLine)
    90         // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
    91         : identifierDestroyer_(Identifier::destroyAllIdentifiers)
    92         // Cleanup guard for external console commands that don't belong to an Identifier
    93         , consoleCommandDestroyer_(ConsoleCommand::destroyAll)
    94         , bGraphicsLoaded_(false)
    95         , bStartIOConsole_(true)
    96         , lastLevelTimestamp_(0)
    97         , ogreConfigTimestamp_(0)
    9868    {
    9969        // Set the hard coded fixed paths
    10070        this->pathConfig_.reset(new PathConfig());
    101 
    102         // Create a new dynamic library manager
    103         this->dynLibManager_.reset(new DynLibManager());
    104 
    105         // Load modules
    106         const std::vector<std::string>& modulePaths = this->pathConfig_->getModulePaths();
    107         for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)
    108         {
    109             try
    110             {
    111                 this->dynLibManager_->load(*it);
    112             }
    113             catch (...)
    114             {
    115                 COUT(1) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << std::endl;
    116             }
    117         }
    11871
    11972        // Parse command line arguments AFTER the modules have been loaded (static code!)
     
    14396#endif
    14497
    145         // Manage ini files and set the default settings file (usually orxonox.ini)
    146         this->configFileManager_.reset(new ConfigFileManager());
    147         this->configFileManager_->setFilename(ConfigFileType::Settings,
    148             CommandLineParser::getValue("settingsFile").getString());
    149 
    150         // Required as well for the config values
    151         this->languageInstance_.reset(new Language());
    152 
    153         // Do this soon after the ConfigFileManager has been created to open up the
    154         // possibility to configure everything below here
    155         ClassIdentifier<Core>::getIdentifier("Core")->initialiseObject(this, "Core", true);
    156         this->setConfigValues();
    157 
    158         // create persistent io console
    159         if (CommandLineParser::getValue("noIOConsole").getBool())
    160         {
    161             ModifyConfigValue(bStartIOConsole_, tset, false);
    162         }
    163         if (this->bStartIOConsole_)
    164             this->ioConsole_.reset(new IOConsole());
    165 
    166         // creates the class hierarchy for all classes with factories
    167         Identifier::createClassHierarchy();
    168 
    169         // Load OGRE excluding the renderer and the render window
    170         this->graphicsManager_.reset(new GraphicsManager(false));
    171 
    172         // initialise Tcl
    173         this->tclBind_.reset(new TclBind(PathConfig::getDataPathString()));
    174         this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
    175 
    176         // Create singletons that always exist (in other libraries)
    177         this->rootScope_.reset(new Scope<ScopeID::Root>());
    178 
    17998        // Generate documentation instead of normal run?
    18099        std::string docFilename;
     
    199118    Core::~Core()
    200119    {
    201         // Remove us from the object lists again to avoid problems when destroying them
    202         this->unregisterObject();
    203     }
    204 
    205     //! Function to collect the SetConfigValue-macro calls.
    206     void Core::setConfigValues()
    207     {
    208 #ifdef ORXONOX_RELEASE
    209         const unsigned int defaultLevelLogFile = 3;
    210 #else
    211         const unsigned int defaultLevelLogFile = 4;
    212 #endif
    213         SetConfigValueExternal(softDebugLevelLogFile_, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile)
    214             .description("The maximum level of debug output shown in the log file");
    215         OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);
    216 
    217         SetConfigValue(language_, Language::getInstance().defaultLanguage_)
    218             .description("The language of the in game text")
    219             .callback(this, &Core::languageChanged);
    220         SetConfigValue(bInitRandomNumberGenerator_, true)
    221             .description("If true, all random actions are different each time you start the game")
    222             .callback(this, &Core::initRandomNumberGenerator);
    223         SetConfigValue(bStartIOConsole_, true)
    224             .description("Set to false if you don't want to use the IOConsole (for Lua debugging for instance)");
    225         SetConfigValue(lastLevelTimestamp_, 0)
    226             .description("Timestamp when the last level was started.");
    227         SetConfigValue(ogreConfigTimestamp_, 0)
    228             .description("Timestamp when the ogre config file was changed.");
    229     }
    230 
    231     //! Callback function if the language has changed.
    232     void Core::languageChanged()
    233     {
    234         // Read the translation file after the language was configured
    235         Language::getInstance().readTranslatedLanguageFile();
    236120    }
    237121
     
    245129            bInitialized = true;
    246130        }
    247     }
    248 
    249     void Core::loadGraphics()
    250     {
    251         // Any exception should trigger this, even in upgradeToGraphics (see its remarks)
    252         Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
    253 
    254         // Upgrade OGRE to receive a render window
    255         try
    256         {
    257             graphicsManager_->upgradeToGraphics();
    258         }
    259         catch (const InitialisationFailedException&)
    260         {
    261             // Exit the application if the Ogre config dialog was canceled
    262             COUT(1) << Exception::handleMessage() << std::endl;
    263             exit(EXIT_FAILURE);
    264         }
    265         catch (...)
    266         {
    267             // Recovery from this is very difficult. It requires to completely
    268             // destroy Ogre related objects and load again (without graphics).
    269             // However since Ogre 1.7 there seems to be a problem when Ogre
    270             // throws an exception and the graphics engine then gets destroyed
    271             // and reloaded between throw and catch (access violation in MSVC).
    272             // That's why we abort completely and only display the exception.
    273             COUT(1) << "An exception occurred during upgrade to graphics. "
    274                     << "That is unrecoverable. The message was:" << endl
    275                     << Exception::handleMessage() << endl;
    276             abort();
    277         }
    278 
    279         // Calls the InputManager which sets up the input devices.
    280         inputManager_.reset(new InputManager());
    281 
    282         // Load the CEGUI interface
    283         guiManager_.reset(new GUIManager(inputManager_->getMousePosition()));
    284 
    285         bGraphicsLoaded_ = true;
    286         GameMode::bShowsGraphics_s = true;
    287 
    288         // Load some sort of a debug overlay (only denoted by its name, "debug.oxo")
    289         graphicsManager_->loadDebugOverlay();
    290 
    291         // Create singletons associated with graphics (in other libraries)
    292         graphicsScope_.reset(new Scope<ScopeID::Graphics>());
    293 
    294         unloader.Dismiss();
    295     }
    296 
    297     void Core::unloadGraphics()
    298     {
    299         this->graphicsScope_.reset();
    300         this->guiManager_.reset();
    301         this->inputManager_.reset();
    302         this->graphicsManager_.reset();
    303 
    304         // Load Ogre::Root again, but without the render system
    305         try
    306             { this->graphicsManager_.reset(new GraphicsManager(false)); }
    307         catch (...)
    308         {
    309             COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl
    310                     << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl
    311                     << "Terminating the program." << std::endl;
    312             abort();
    313         }
    314 
    315         bGraphicsLoaded_ = false;
    316         GameMode::bShowsGraphics_s = false;
    317     }
    318 
    319     //! Sets the language in the config-file back to the default.
    320     void Core::resetLanguage()
    321     {
    322         ResetConfigValue(language_);
    323131    }
    324132
     
    368176#endif
    369177    }
    370 
    371     void Core::preUpdate(const Clock& time)
    372     {
    373         // Update singletons before general ticking
    374         ScopedSingletonManager::preUpdate<ScopeID::Root>(time);
    375         if (this->bGraphicsLoaded_)
    376         {
    377             // Process input events
    378             this->inputManager_->preUpdate(time);
    379             // Update GUI
    380             this->guiManager_->preUpdate(time);
    381             // Update singletons before general ticking
    382             ScopedSingletonManager::preUpdate<ScopeID::Graphics>(time);
    383         }
    384         // Process console events and status line
    385         if (this->ioConsole_ != NULL)
    386             this->ioConsole_->preUpdate(time);
    387         // Process thread commands
    388         this->tclThreadManager_->preUpdate(time);
    389     }
    390 
    391     void Core::postUpdate(const Clock& time)
    392     {
    393         // Update singletons just before rendering
    394         ScopedSingletonManager::postUpdate<ScopeID::Root>(time);
    395         if (this->bGraphicsLoaded_)
    396         {
    397             // Update singletons just before rendering
    398             ScopedSingletonManager::postUpdate<ScopeID::Graphics>(time);
    399             // Render (doesn't throw)
    400             this->graphicsManager_->postUpdate(time);
    401         }
    402     }
    403 
    404     void Core::updateLastLevelTimestamp()
    405     {
    406         ModifyConfigValue(lastLevelTimestamp_, set, static_cast<long long>(time(NULL)));
    407     }
    408 
    409     void Core::updateOgreConfigTimestamp()
    410     {
    411         ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(NULL)));
    412     }
    413178}
  • code/forks/sandbox_light/src/libraries/core/Core.h

    r7870 r7908  
    4646#include <string>
    4747#include <boost/scoped_ptr.hpp>
    48 #include <loki/ScopeGuard.h>
    4948
    5049#include "util/Singleton.h"
    51 #include "OrxonoxClass.h"
    5250
    5351namespace orxonox
     
    5957        You should only create this singleton once because it destroys the identifiers!
    6058    */
    61     class _CoreExport Core : public Singleton<Core>, public OrxonoxClass
     59    class _CoreExport Core : public Singleton<Core>
    6260    {
    63         typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
    6461        friend class Singleton<Core>;
    65         friend class Game;
    6662
    6763        public:
     
    7672            ~Core();
    7773
    78             void setConfigValues();
    79 
    80             //! Returns the configured language.
    81             const std::string& getLanguage()
    82                 { return this->language_; }
    83             void resetLanguage();
    84 
    85             void updateLastLevelTimestamp();
    86             inline long long getLastLevelTimestamp() const
    87                 { return this->lastLevelTimestamp_; }
    88 
    89             void updateOgreConfigTimestamp();
    90             inline long long getOgreConfigTimestamp() const
    91                 { return this->ogreConfigTimestamp_; }
    92 
    9374        private:
    9475            Core(const Core&); //!< Don't use (undefined symbol)
    9576
    96             void languageChanged();
    9777            void initRandomNumberGenerator();
    9878
    99             void preUpdate(const Clock& time);
    100             void postUpdate(const Clock& time);
     79            void setThreadAffinity(int limitToCPU);
    10180
    102             void loadGraphics();
    103             void unloadGraphics();
    104 
    105             void setThreadAffinity(int limitToCPU);
    10681            // MANAGED SINGLETONS/OBJECTS
    10782            // Mind the order for the destruction!
    10883            scoped_ptr<PathConfig>        pathConfig_;
    109             scoped_ptr<DynLibManager>     dynLibManager_;
    11084            scoped_ptr<SignalHandler>     signalHandler_;
    111             SimpleScopeGuard              identifierDestroyer_;
    112             SimpleScopeGuard              consoleCommandDestroyer_;
    113             scoped_ptr<ConfigFileManager> configFileManager_;
    114             scoped_ptr<Language>          languageInstance_;
    115             scoped_ptr<IOConsole>         ioConsole_;
    116             scoped_ptr<TclBind>           tclBind_;
    117             scoped_ptr<TclThreadManager>  tclThreadManager_;
    118             scoped_ptr<Scope<ScopeID::Root> > rootScope_;
    119             // graphical
    120             scoped_ptr<GraphicsManager>   graphicsManager_;     //!< Interface to OGRE
    121             scoped_ptr<InputManager>      inputManager_;        //!< Interface to OIS
    122             scoped_ptr<GUIManager>        guiManager_;          //!< Interface to GUI
    123             scoped_ptr<Scope<ScopeID::Graphics> > graphicsScope_;
    12485
    125             bool                          bGraphicsLoaded_;
    12686            int                           softDebugLevelLogFile_;      //!< The debug level for the log file (belongs to OutputHandler)
    127             std::string                   language_;                   //!< The language
    12887            bool                          bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
    129             bool                          bStartIOConsole_;            //!< Set to false if you don't want to use the IOConsole
    130             long long                     lastLevelTimestamp_;         ///< Timestamp when the last level was started
    131             long long                     ogreConfigTimestamp_;        ///< Timestamp wehen the ogre config level was modified
    13288
    13389            static Core*                  singletonPtr_s;
  • code/forks/sandbox_light/src/libraries/core/CorePrereqs.h

    r7849 r7908  
    6565namespace orxonox
    6666{
    67     static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
    6867}
    6968
     
    7473namespace orxonox
    7574{
    76     namespace XMLPort
    77     {
    78         enum Mode
    79         {
    80             NOP,
    81             LoadObject,
    82             SaveObject,
    83             ExpandObject
    84         };
    85     }
    86 
    87     namespace ConfigFileType
    88     {
    89         enum Value
    90         {
    91             Settings,
    92             JoyStickCalibration,
    93             CommandHistory
    94             // Don't forget to adjust the array size in the ConfigFileManager when adding a new entry here!
    95         };
    96     }
    97 
    98     namespace KeybindMode
    99     {
    100         enum Value
    101         {
    102             OnPress,
    103             OnHold,
    104             OnRelease,
    105             None
    106         };
    107     };
    10875}
    10976
     
    11481namespace orxonox
    11582{
    116     typedef std::string LanguageEntryLabel;
    117 
    118     template <class T, class U>
    119     T orxonox_cast(U*);
    120 
    121     class BaseObject;
    122     template <class T>
    123     class ClassFactory;
    124     template <class T>
    125     class ClassIdentifier;
    126     class ClassTreeMask;
    127     class ClassTreeMaskIterator;
    128     class ClassTreeMaskNode;
    129     class ClassTreeMaskObjectIterator;
    13083    class CommandLineParser;
    13184    class CommandLineArgument;
    132     class ConfigFile;
    133     class ConfigFileEntry;
    134     class ConfigFileEntryComment;
    135     class ConfigFileEntryValue;
    136     class ConfigFileManager;
    137     class ConfigFileSection;
    138     class ConfigValueContainer;
    13985    class Core;
    140     class DestructionListener;
    141     class DynLib;
    142     class DynLibManager;
    143     struct Event;
    144     class EventState;
    145     class Factory;
    146     class Game;
    147     class GameState;
    148     struct GameStateInfo;
    149     struct GameStateTreeNode;
    150     class GraphicsManager;
    151     class GUIManager;
    152     class Identifier;
    153     template <class T>
    154     class Iterator;
    155     class Language;
    156     class LuaFunctor;
    157     class LuaState;
    158     class MemoryArchive;
    159     class MemoryArchiveFactory;
    160     class MetaObjectList;
    161     class MetaObjectListElement;
    162     class Namespace;
    163     class NamespaceNode;
    164     template <class T>
    165     class ObjectList;
    166     class ObjectListBase;
    167     class ObjectListBaseElement;
    168     template <class T>
    169     class ObjectListElement;
    170     template <class T>
    171     class ObjectListIterator;
    172     class OgreWindowEventListener;
    173     class OrxonoxClass;
    17486    class PathConfig;
    175     struct ResourceInfo;
    176     class SettingsConfigFile;
    177     template <class T>
    178     class SmartPtr;
    179     template <class T>
    180     class SubclassIdentifier;
    181     class Template;
    182     class Thread;
    183     class ThreadPool;
    184     template <class T>
    185     class WeakPtr;
    186     class WindowEventListener;
    187     class XMLFile;
    188     class XMLNameListener;
    189     template <class T, class O>
    190     class XMLPortClassObjectContainer;
    191     template <class T>
    192     class XMLPortClassParamContainer;
    193     class XMLPortObjectContainer;
    194     class XMLPortParamContainer;
    195 
    196     // Command
    197     class ArgumentCompleter;
    198     class ArgumentCompletionListElement;
    199     class CommandEvaluation;
    200     class ConsoleCommand;
    201     class Executor;
    202     template <class T>
    203     class ExecutorMember;
    204     class ExecutorStatic;
    205     class Functor;
    206     template <class O>
    207     class FunctorMember;
    208     typedef FunctorMember<void> FunctorStatic;
    209     template <class F, class O>
    210     class FunctorPointer;
    211     class IOConsole;
    212     class IRC;
    213     class Shell;
    214     class ShellListener;
    215     class TclBind;
    216     struct TclInterpreterBundle;
    217     template <class T>
    218     class TclThreadList;
    219     class TclThreadManager;
    220 
    221     // Input
    222     class BaseCommand;
    223     class BufferedParamCommand;
    224     class Button;
    225     class HalfAxis;
    226     class InputBuffer;
    227     class InputDevice;
    228     template <class Traits>
    229     class InputDeviceTemplated;
    230     class InputHandler;
    231     class InputManager;
    232     class InputState;
    233     struct InputStatePriority;
    234     class JoyStickQuantityListener;
    235     class JoyStick;
    236     class KeyBinder;
    237     class KeyBinderManager;
    238     class Keyboard;
    239     class KeyDetector;
    240     class KeyEvent;
    241     class Mouse;
    242     class ParamCommand;
    243     class SimpleCommand;
    244 }
    245 
    246 #include "command/FunctorPtr.h"
    247 #include "command/ExecutorPtr.h"
    248 
    249 // CppTcl
    250 namespace Tcl
    251 {
    252     class interpreter;
    253     class object;
    25487}
    25588
     
    278111    }
    279112#endif
    280     class thread;
    281     class mutex;
    282     class shared_mutex;
    283     class condition_variable;
    284 }
    285 
    286 // Ogre
    287 namespace Ogre
    288 {
    289     class DataStream;
    290     template <class T> class SharedPtr;
    291     typedef SharedPtr<DataStream> DataStreamPtr;
    292 }
    293 namespace orxonox
    294 {
    295     // Import the Ogre::DataStream
    296     using Ogre::DataStream;
    297     using Ogre::DataStreamPtr;
    298 }
    299 
    300 // CEGUI
    301 namespace CEGUI
    302 {
    303     class DefaultLogger;
    304     class Logger;
    305     class LuaScriptModule;
    306 
    307     class OgreCEGUIRenderer;
    308     class OgreCEGUIResourceProvider;
    309     class OgreCEGUITexture;
    310 }
    311 
    312 // Lua
    313 struct lua_State;
    314 
    315 // TinyXML and TinyXML++
    316 class TiXmlString;
    317 class TiXmlOutStream;
    318 class TiXmlNode;
    319 class TiXmlHandle;
    320 class TiXmlDocument;
    321 class TiXmlElement;
    322 class TiXmlComment;
    323 class TiXmlUnknown;
    324 class TiXmlAttribute;
    325 class TiXmlText;
    326 class TiXmlDeclaration;
    327 class TiXmlParsingData;
    328 namespace ticpp
    329 {
    330     class Document;
    331     class Element;
    332     class Declaration;
    333     class StylesheetReference;
    334     class Text;
    335     class Comment;
    336     class Attribute;
    337 }
    338 namespace orxonox
    339 {
    340     using ticpp::Element;
    341113}
    342114
  • code/forks/sandbox_light/src/libraries/core/PathConfig.cc

    r6417 r7908  
    7676        : rootPath_(*(new bf::path()))
    7777        , executablePath_(*(new bf::path()))
    78         , modulePath_(*(new bf::path()))
    7978        , dataPath_(*(new bf::path()))
    80         , externalDataPath_(*(new bf::path()))
    8179        , configPath_(*(new bf::path()))
    8280        , logPath_(*(new bf::path()))
     
    138136            COUT(1) << "Running from the build tree." << std::endl;
    139137            PathConfig::bDevRun_ = true;
    140             modulePath_ = specialConfig::moduleDevDirectory;
    141138        }
    142139        else
     
    153150                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
    154151
    155             // Module path is fixed as well
    156             modulePath_ = rootPath_ / specialConfig::defaultModulePath;
    157 
    158152#else
    159153
    160154            // There is no root path, so don't set it at all
    161             // Module path is fixed as well
    162             modulePath_ = specialConfig::moduleInstallDirectory;
    163155
    164156#endif
     
    170162        delete &rootPath_;
    171163        delete &executablePath_;
    172         delete &modulePath_;
    173164        delete &dataPath_;
    174         delete &externalDataPath_;
    175165        delete &configPath_;
    176166        delete &logPath_;
     
    184174            configPath_       = specialConfig::configDevDirectory;
    185175            logPath_          = specialConfig::logDevDirectory;
    186 
    187             // Check for data path override by the command line
    188             if (!CommandLineParser::getArgument("externalDataPath")->hasDefaultValue())
    189                 externalDataPath_ = CommandLineParser::getValue("externalDataPath").getString();
    190             else
    191                 externalDataPath_ = specialConfig::externalDataDevDirectory;
    192176        }
    193177        else
     
    251235    }
    252236
    253     std::vector<std::string> PathConfig::getModulePaths()
    254     {
    255         std::vector<std::string> modulePaths;
    256 
    257         // We search for helper files with the following extension
    258         const std::string& moduleextension = specialConfig::moduleExtension;
    259         size_t moduleextensionlength = moduleextension.size();
    260 
    261         // Add that path to the PATH variable in case a module depends on another one
    262         std::string pathVariable(getenv("PATH"));
    263         putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));
    264 
    265         // Make sure the path exists, otherwise don't load modules
    266         if (!boost::filesystem::exists(modulePath_))
    267             return modulePaths;
    268 
    269         boost::filesystem::directory_iterator file(modulePath_);
    270         boost::filesystem::directory_iterator end;
    271 
    272         // Iterate through all files
    273         while (file != end)
    274         {
    275             const std::string& filename = file->BOOST_LEAF_FUNCTION();
    276 
    277             // Check if the file ends with the exension in question
    278             if (filename.size() > moduleextensionlength)
    279             {
    280                 if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
    281                 {
    282                     // We've found a helper file
    283                     const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
    284                     modulePaths.push_back((modulePath_ / library).file_string());
    285                 }
    286             }
    287             ++file;
    288         }
    289 
    290         return modulePaths;
    291     }
    292 
    293237    /*static*/ std::string PathConfig::getRootPathString()
    294238    {
     
    306250    }
    307251
    308     /*static*/ std::string PathConfig::getExternalDataPathString()
    309     {
    310         return getInstance().externalDataPath_.string() + '/';
    311     }
    312 
    313252    /*static*/ std::string PathConfig::getConfigPathString()
    314253    {
     
    320259        return getInstance().logPath_.string() + '/';
    321260    }
    322 
    323     /*static*/ std::string PathConfig::getModulePathString()
    324     {
    325         return getInstance().modulePath_.string() + '/';
    326     }
    327261}
  • code/forks/sandbox_light/src/libraries/core/PathConfig.h

    r7427 r7908  
    8585            static const boost::filesystem::path& getDataPath()
    8686                { return getInstance().dataPath_; }
    87             //! Returns the path to the external data files as boost::filesystem::path
    88             static const boost::filesystem::path& getExternalDataPath()
    89                 { return getInstance().externalDataPath_; }
    9087            //! Returns the path to the config files as boost::filesystem::path
    9188            static const boost::filesystem::path& getConfigPath()
     
    9491            static const boost::filesystem::path& getLogPath()
    9592                { return getInstance().logPath_; }
    96             //! Returns the path to the modules as boost::filesystem::path
    97             static const boost::filesystem::path& getModulePath()
    98                 { return getInstance().modulePath_; }
    9993
    10094            //! Returns the path to the root folder as std::string
     
    10498            //! Returns the path to the data files as std::string
    10599            static std::string getDataPathString();
    106             //! Returns the path to the external data files as std::string
    107             static std::string getExternalDataPathString();
    108100            //! Returns the path to the config files as std::string
    109101            static std::string getConfigPathString(); //tolua_export
    110102            //! Returns the path to the log files as std::string
    111103            static std::string getLogPathString();
    112             //! Returns the path to the modules as std::string
    113             static std::string getModulePathString();
    114104
    115105            //! Return trrue for runs in the build directory (not installed)
     
    126116            */
    127117            void setConfigurablePaths();
    128             //! Returns a list with all modules declared by a *.module file in the module folder.
    129             std::vector<std::string> getModulePaths();
    130118
    131119            //! Path to the parent directory of the ones above if program was installed with relativ paths
    132120            boost::filesystem::path& rootPath_;
    133121            boost::filesystem::path& executablePath_;        //!< Path to the executable
    134             boost::filesystem::path& modulePath_;            //!< Path to the modules
    135122            boost::filesystem::path& dataPath_;              //!< Path to the data files folder
    136             boost::filesystem::path& externalDataPath_;      //!< Path to the external data files folder
    137123            boost::filesystem::path& configPath_;            //!< Path to the config files folder
    138124            boost::filesystem::path& logPath_;               //!< Path to the log files folder
  • code/forks/sandbox_light/src/libraries/util/CMakeLists.txt

    r7449 r7908  
    2121  Clock.cc
    2222  Exception.cc
    23   ExprParser.cc
    2423  Math.cc
    2524  MultiType.cc
    26   Scope.cc
    2725  StringUtils.cc
    2826COMPILATION_BEGIN StableCompilation.cc
    29   Clipboard.cc
    3027  Convert.cc
    3128  CRC32.cc
    3229  OutputHandler.cc
    33   ScopedSingletonManager.cc
    3430  SharedPtr.cc
    3531  SignalHandler.cc
     
    5450  FIND_HEADER_FILES
    5551  LINK_LIBRARIES
    56     ${CEGUI_LIBRARY}
    57     ${OGRE_LIBRARY}
     52    ogremath_orxonox
    5853  SOURCE_FILES
    5954    ${UTIL_SRC_FILES}
  • code/forks/sandbox_light/src/libraries/util/Clock.cc

    r7401 r7908  
    2828
    2929#include "Clock.h"
    30 #include <OgreTimer.h>
     30#include <ogremath/OgreTimer.h>
    3131
    3232namespace orxonox
  • code/forks/sandbox_light/src/libraries/util/Exception.cc

    r7401 r7908  
    3535#include "Exception.h"
    3636
    37 #include <CEGUIExceptions.h>
    3837#include "Debug.h"
    3938
     
    9998            return ex.what();
    10099        }
    101         catch (const CEGUI::Exception& ex)
    102         {
    103 #if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
    104             return GeneralException(ex.getMessage().c_str()).getDescription();
    105 #else
    106             return GeneralException(ex.getMessage().c_str(), ex.getLine(),
    107                 ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
    108 #endif
    109         }
    110100        catch (...)
    111101        {
  • code/forks/sandbox_light/src/libraries/util/Math.cc

    r7401 r7908  
    3434#include "Math.h"
    3535
    36 #include <OgrePlane.h>
     36#include <ogremath/OgrePlane.h>
    3737
    3838#include "MathConvert.h"
  • code/forks/sandbox_light/src/libraries/util/Math.h

    r7427 r7908  
    4747#include <cstdlib>
    4848
    49 #include <OgreMath.h>
    50 #include <OgreVector2.h>
    51 #include <OgreVector3.h>
    52 #include <OgreVector4.h>
    53 #include <OgreQuaternion.h>
    54 #include <OgreColourValue.h>
     49#include <ogremath/OgreMath.h>
     50#include <ogremath/OgreVector2.h>
     51#include <ogremath/OgreVector3.h>
     52#include <ogremath/OgreVector4.h>
     53#include <ogremath/OgreQuaternion.h>
     54#include <ogremath/OgreColourValue.h>
    5555
    5656// Certain headers might define unwanted macros...
  • code/forks/sandbox_light/src/libraries/util/MultiType.h

    r7401 r7908  
    100100#include <cassert>
    101101#include <string>
    102 #include <OgreVector2.h>
    103 #include <OgreVector3.h>
    104 #include <OgreVector4.h>
    105 #include <OgreQuaternion.h>
    106 #include <OgreColourValue.h>
     102#include <ogremath/OgreVector2.h>
     103#include <ogremath/OgreVector3.h>
     104#include <ogremath/OgreVector4.h>
     105#include <ogremath/OgreQuaternion.h>
     106#include <ogremath/OgreColourValue.h>
    107107#include <loki/TypeTraits.h>
    108108#include "mbool.h"
     
    260260
    261261            virtual void toString(std::ostream& outstream) const = 0;
    262 
    263             virtual void importData( uint8_t*& mem )=0;
    264             virtual void exportData( uint8_t*& mem ) const=0;
    265             virtual uint8_t getSize() const=0;
    266262
    267263            MT_Type::Value type_;   ///< The type of the current value
     
    374370            std::string                       getTypename()               const;
    375371
    376             /// Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT
    377             inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
    378             /// Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT
    379             inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }
    380             /// Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT
    381             inline uint8_t*&                  operator << (uint8_t*& mem) { importData(mem); return mem; }
    382             /// Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT
    383             inline void                       operator >> (uint8_t*& mem) const { exportData(mem); }
    384             inline uint32_t                   getNetworkSize() const { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); }
    385 
    386372            /// Checks whether the value is a default one (assigned after a failed conversion)
    387373            bool                              hasDefaultValue() const { return this->value_->hasDefaultValue(); }
  • code/forks/sandbox_light/src/libraries/util/MultiTypeValue.h

    r7401 r7908  
    4343#include "MathConvert.h"
    4444#include "MultiType.h"
    45 #include "Serialise.h"
    4645
    4746namespace orxonox
     
    155154        inline void toString(std::ostream& outstream) const { outstream << this->value_; }
    156155
    157         /// loads data from the bytestream (mem) into the MT and increases the bytestream pointer by the size of the data
    158         inline void importData( uint8_t*& mem )         { loadAndIncrease( /*(const T&)*/this->value_, mem ); }
    159         /// saves data from the MT into the bytestream (mem) and increases the bytestream pointer by the size of the data
    160         inline void exportData( uint8_t*& mem ) const   { saveAndIncrease( /*(const T&)*/this->value_, mem ); }
    161         /// returns the size of the data that would be saved by exportData
    162         inline uint8_t getSize() const { return returnSize( this->value_ ); }
    163 
    164156        T value_; ///< The stored value
    165157    };
    166 
    167     // Import / Export specialisation
    168     // ColourValue
    169     template <> inline void MT_Value<ColourValue>::importData( uint8_t*& mem )
    170     {
    171         loadAndIncrease( this->value_.r, mem );
    172         loadAndIncrease( this->value_.g, mem );
    173         loadAndIncrease( this->value_.b, mem );
    174         loadAndIncrease( this->value_.a, mem );
    175     }
    176     template <> inline void MT_Value<ColourValue>::exportData( uint8_t*& mem ) const
    177     {
    178         saveAndIncrease( this->value_.r, mem );
    179         saveAndIncrease( this->value_.g, mem );
    180         saveAndIncrease( this->value_.b, mem );
    181         saveAndIncrease( this->value_.a, mem );
    182     }
    183     template <> inline uint8_t MT_Value<ColourValue>::getSize() const
    184     {
    185         return 4*returnSize(this->value_.r);
    186     }
    187     // Ogre::Quaternion
    188     template <> inline void MT_Value<Ogre::Quaternion>::importData( uint8_t*& mem )
    189     {
    190         loadAndIncrease( this->value_.x, mem );
    191         loadAndIncrease( this->value_.y, mem );
    192         loadAndIncrease( this->value_.z, mem );
    193         loadAndIncrease( this->value_.w, mem );
    194     }
    195     template <> inline void MT_Value<Ogre::Quaternion>::exportData( uint8_t*& mem ) const
    196     {
    197         saveAndIncrease( this->value_.x, mem );
    198         saveAndIncrease( this->value_.y, mem );
    199         saveAndIncrease( this->value_.z, mem );
    200         saveAndIncrease( this->value_.w, mem );
    201     }
    202     template <> inline uint8_t MT_Value<Ogre::Quaternion>::getSize() const
    203     {
    204         return 4*returnSize(this->value_.x);
    205     }
    206     // Ogre::Vector2
    207     template <> inline void MT_Value<Ogre::Vector2>::importData( uint8_t*& mem )
    208     {
    209         loadAndIncrease( this->value_.x, mem );
    210         loadAndIncrease( this->value_.y, mem );
    211     }
    212     template <> inline void MT_Value<Ogre::Vector2>::exportData( uint8_t*& mem ) const
    213     {
    214         saveAndIncrease( this->value_.x, mem );
    215         saveAndIncrease( this->value_.y, mem );
    216     }
    217     template <> inline uint8_t MT_Value<Ogre::Vector2>::getSize() const
    218     {
    219         return 2*returnSize(this->value_.x);
    220     }
    221     // Ogre::Vector3
    222     template <> inline void MT_Value<Ogre::Vector3>::importData( uint8_t*& mem )
    223     {
    224         loadAndIncrease( this->value_.x, mem );
    225         loadAndIncrease( this->value_.y, mem );
    226         loadAndIncrease( this->value_.z, mem );
    227     }
    228     template <> inline void MT_Value<Ogre::Vector3>::exportData( uint8_t*& mem ) const
    229     {
    230         saveAndIncrease( this->value_.x, mem );
    231         saveAndIncrease( this->value_.y, mem );
    232         saveAndIncrease( this->value_.z, mem );
    233     }
    234     template <> inline uint8_t MT_Value<Ogre::Vector3>::getSize() const
    235     {
    236         return 3*returnSize(this->value_.x);
    237     }
    238     // Ogre::Vector4
    239     template <> inline void MT_Value<Ogre::Vector4>::importData( uint8_t*& mem )
    240     {
    241         loadAndIncrease( this->value_.x, mem );
    242         loadAndIncrease( this->value_.y, mem );
    243         loadAndIncrease( this->value_.z, mem );
    244         loadAndIncrease( this->value_.w, mem );
    245     }
    246     template <> inline void MT_Value<Ogre::Vector4>::exportData( uint8_t*& mem ) const
    247     {
    248         saveAndIncrease( this->value_.x, mem );
    249         saveAndIncrease( this->value_.y, mem );
    250         saveAndIncrease( this->value_.z, mem );
    251         saveAndIncrease( this->value_.w, mem );
    252     }
    253     template <> inline uint8_t MT_Value<Ogre::Vector4>::getSize() const
    254     {
    255         return 4*returnSize(this->value_.x);
    256     }
    257     template <> inline void MT_Value<void*>::importData( uint8_t*& mem )
    258     {
    259         assert(0);
    260     }
    261     template <> inline void MT_Value<void*>::exportData( uint8_t*& mem ) const
    262     {
    263         assert(0);
    264     }
    265     template <> inline uint8_t MT_Value<void*>::getSize() const
    266     {
    267         assert(0); return 0;
    268     }
    269158}
    270159
  • code/forks/sandbox_light/src/libraries/util/UtilPrereqs.h

    r6417 r7908  
    6464namespace orxonox
    6565{
    66     namespace ScopeID
    67     {
    68         //!A list of available scopes for the Scope template.
    69         enum Value
    70         {
    71             Root,
    72             Graphics
    73         };
    74     }
    7566}
    7667
     
    8374    class Clock;
    8475    class Exception;
    85     class ExprParser;
    8676    class IntVector2;
    8777    class IntVector3;
     
    8979    class OutputHandler;
    9080    class OutputListener;
    91     template <ScopeID::Value>
    92     class Scope;
    93     template <class, ScopeID::Value>
    94     class ScopedSingleton;
    95     class ScopeListener;
    9681    class SignalHandler;
    9782    template <class T>
Note: See TracChangeset for help on using the changeset viewer.