Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1531 for code


Ignore:
Timestamp:
Jun 4, 2008, 8:06:38 PM (16 years ago)
Author:
rgrieder
Message:
  • added various error code in GraphicsEngine
  • Config values for plugins.cfg, resources.cfg and ogre.log
  • created Settings class for general orxonox settings like dataPath
  • rewrote ArgReader to support any type of argument that converValue can convert
  • There is now a possibility to use boolean arguments (either given or not)
Location:
code/branches/input
Files:
2 added
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/core/Core.h

    r1524 r1531  
    3535*/
    3636
    37 #ifndef _CoreSettings_H__
    38 #define _CoreSettings_H__
     37#ifndef _Core_H__
     38#define _Core_H__
    3939
    4040#include "CorePrereqs.h"
     
    7575}
    7676
    77 #endif /* _CoreSettings_H__ */
     77#endif /* _Core_H__ */
  • code/branches/input/src/core/input/InputBuffer.cc

    r1519 r1531  
    3939    InputBuffer::InputBuffer()
    4040    {
    41         RegisterObject(InputBuffer);
     41        RegisterRootObject(InputBuffer);
    4242
    4343        this->buffer_ = "";
     
    5959    InputBuffer::InputBuffer(const std::string allowedChars)
    6060    {
    61         RegisterObject(InputBuffer);
     61        RegisterRootObject(InputBuffer);
    6262
    6363        this->allowedChars_ = allowedChars;
  • code/branches/input/src/core/input/InputManager.cc

    r1524 r1531  
    6969      keyboardModifiers_(0)
    7070  {
    71     RegisterObject(InputManager);
     71    RegisterRootObject(InputManager);
    7272  }
    7373
  • code/branches/input/src/core/input/KeyBinder.cc

    r1520 r1531  
    5353    mousePosition_[1] = 0;
    5454
    55     RegisterObject(KeyBinder);
     55    RegisterRootObject(KeyBinder);
    5656
    5757    // keys
  • code/branches/input/src/orxonox/CMakeLists.txt

    r1524 r1531  
    33  Main.cc
    44  Orxonox.cc
     5  Settings.cc
    56
    67  console/InGameConsole.cc
  • code/branches/input/src/orxonox/GraphicsEngine.cc

    r1519 r1531  
    2121 *
    2222 *   Author:
    23  *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
     23 *      Reto Grieder
    2424 *   Co-authors:
    25  *      Reto Grieder
     25 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007, Felix Schulthess
    2626 *
    2727 */
     
    3535#include "GraphicsEngine.h"
    3636
     37#include <OgreConfigFile.h>
     38#include <OgreException.h>
     39#include <OgreLogManager.h>
    3740#include <OgreRoot.h>
    38 #include <OgreException.h>
    39 #include <OgreConfigFile.h>
    40 #include <OgreLogManager.h>
     41#include <OgreSceneManager.h>
    4142#include <OgreTextureManager.h>
    42 #include "core/input/InputManager.h"
     43#include <OgreViewport.h>
     44
    4345#include "core/CoreIncludes.h"
    4446#include "core/ConfigValueIncludes.h"
    4547#include "core/Debug.h"
    4648#include "core/CommandExecutor.h"
    47 #include "core/TclBind.h"
     49#include "core/ConsoleCommand.h"
     50#include "core/input/InputManager.h"
     51
    4852#include "console/InGameConsole.h"
    49 
    50 #include "core/ConsoleCommand.h"
    51 #include <OgreSceneManager.h>
    52 #include <OgreCompositorManager.h>
    53 #include <OgreViewport.h>
     53#include "Settings.h"
     54
    5455
    5556namespace orxonox {
     
    7071    root_(0),
    7172    scene_(0),
    72     renderWindow_(0),
    73     //configPath_(""),
    74     dataPath_(""),
    75     ogreLogfile_("")
     73    renderWindow_(0)
    7674  {
    7775    RegisterObject(GraphicsEngine);
     
    8381  void GraphicsEngine::setConfigValues()
    8482  {
    85     SetConfigValue(dataPath_, "../../Media/").description("relative path to media data");
    86     SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
     83    SetConfigValue(resourceFile_,    "resources.cfg").description("Location of the resources file in the data path.");
     84    SetConfigValue(ogreConfigFile_,  "ogre.cfg").description("Location of the Ogre config file");
     85    SetConfigValue(ogrePluginsFile_, "plugins.cfg").description("Location of the Ogre plugins file");
     86    SetConfigValue(ogreLogFile_,     "ogre.log").description("Logfile for messages from Ogre. \
     87                                                             Use \"\" to suppress log file creation.");
    8788    SetConfigValue(ogreLogLevelTrivial_ , 5).description("Corresponding orxonox debug level for ogre Trivial");
    8889    SetConfigValue(ogreLogLevelNormal_  , 4).description("Corresponding orxonox debug level for ogre Normal");
    8990    SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
    90 
    91     TclBind::getInstance().setDataPath(this->dataPath_);
    9291  }
    9392
     
    126125    @brief Creates the Ogre Root object and sets up the ogre log.
    127126  */
    128   bool GraphicsEngine::setup(std::string& dataPath)
     127  bool GraphicsEngine::setup()
    129128  {
    130129    CCOUT(3) << "Setting up..." << std::endl;
    131130    // temporary overwrite of dataPath, change ini file for permanent change
    132     if (dataPath != "")
    133       dataPath_ = dataPath;
    134     if (dataPath_ == "")
    135       return false;
    136     if (dataPath_[dataPath_.size() - 1] != '/')
    137       dataPath_ += "/";
    138 
    139     //TODO: Check if file exists (maybe not here)
    140 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && defined(_DEBUG)
    141     std::string plugin_filename = "plugins_d.cfg";
    142 #else
    143     std::string plugin_filename = "plugins.cfg";
    144 #endif
    145131
    146132// TODO: LogManager doesn't work on specific systems. The why is unknown yet.
     
    154140    // create our own log that we can listen to
    155141    Ogre::Log *myLog;
    156     if (this->ogreLogfile_ == "")
     142    if (this->ogreLogFile_ == "")
    157143      myLog = logger->createLog("ogre.log", true, false, true);
    158144    else
    159       myLog = logger->createLog(this->ogreLogfile_, true, false, false);
     145      myLog = logger->createLog(this->ogreLogFile_, true, false, false);
    160146    CCOUT(4) << "Ogre Log created" << std::endl;
    161147
     
    167153    CCOUT(4) << "Creating Ogre Root..." << std::endl;
    168154
    169     root_ = new Ogre::Root(plugin_filename, "ogre.cfg", this->ogreLogfile_);
     155    if (ogrePluginsFile_ == "")
     156    {
     157      COUT(1) << "Error: Ogre plugins file set to \"\". Cannot load." << std::endl;
     158      return false;
     159    }
     160    if (ogreConfigFile_ == "")
     161    {
     162      COUT(1) << "Error: Ogre config file set to \"\". Cannot load." << std::endl;
     163      return false;
     164    }
     165    if (ogreLogFile_ == "")
     166    {
     167      COUT(1) << "Error: Ogre log file set to \"\". Cannot load." << std::endl;
     168      return false;
     169    }
     170
     171    try
     172    {
     173      root_ = new Ogre::Root(ogrePluginsFile_, ogreConfigFile_, ogreLogFile_);
     174    }
     175    catch (Ogre::Exception ex)
     176    {
     177      COUT(2) << "Error: There was an exception when creating Ogre Root." << std::endl;
     178      return false;
     179    }
     180
     181    if (!root_->getInstalledPlugins().size())
     182    {
     183      COUT(1) << "Error: No plugins declared. Cannot load Ogre." << std::endl;
     184      COUT(0) << "Is the plugins file correctly declared?" << std::endl;
     185      return false;
     186    }
    170187
    171188#if 0
     
    180197
    181198    // specify where Ogre has to look for resources. This call doesn't parse anything yet!
    182     declareRessourceLocations();
     199    if (!declareRessourceLocations())
     200      return false;
    183201
    184202    CCOUT(3) << "Set up done." << std::endl;
     
    186204  }
    187205
    188   void GraphicsEngine::declareRessourceLocations()
     206  bool GraphicsEngine::declareRessourceLocations()
    189207  {
    190208    CCOUT(4) << "Declaring Resources" << std::endl;
    191209    //TODO: Specify layout of data file and maybe use xml-loader
    192210    //TODO: Work with ressource groups (should be generated by a special loader)
     211
     212    if (resourceFile_ == "")
     213    {
     214      COUT(1) << "Error: Resource file set to \"\". Cannot load." << std::endl;
     215      return false;
     216    }
     217
    193218    // Load resource paths from data file using configfile ressource type
    194219    Ogre::ConfigFile cf;
    195     cf.load(dataPath_ + "resources.cfg");
     220    try
     221    {
     222      cf.load(Settings::getDataPath() + resourceFile_);
     223    }
     224    catch (Ogre::Exception ex)
     225    {
     226      COUT(1) << "Error: Could not load resources.cfg in path " << Settings::getDataPath() << std::endl;
     227      COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl;
     228      return false;
     229    }
    196230
    197231    // Go through all sections & settings in the file
     
    201235    while (seci.hasMoreElements())
    202236    {
    203       secName = seci.peekNextKey();
    204       Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
    205       Ogre::ConfigFile::SettingsMultiMap::iterator i;
    206       for (i = settings->begin(); i != settings->end(); ++i)
     237      try
    207238      {
    208         typeName = i->first; // for instance "FileSystem" or "Zip"
    209         archName = i->second; // name (and location) of archive
    210 
    211         Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
    212                                            std::string(dataPath_ + archName),
    213                                            typeName, secName);
     239        secName = seci.peekNextKey();
     240        Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
     241        Ogre::ConfigFile::SettingsMultiMap::iterator i;
     242        for (i = settings->begin(); i != settings->end(); ++i)
     243        {
     244          typeName = i->first; // for instance "FileSystem" or "Zip"
     245          archName = i->second; // name (and location) of archive
     246
     247          Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
     248              std::string(Settings::getDataPath() + archName), typeName, secName);
     249        }
    214250      }
    215     }
     251      catch (Ogre::Exception ex)
     252      {
     253        COUT(2) << "Exception while reading resources.cfg. Proceeding.." << ex.getDescription() << std::endl;
     254      }
     255    }
     256    return true;
    216257  }
    217258
     
    223264
    224265    CCOUT(4) << "Creating render window" << std::endl;
    225     this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
     266    try
     267    {
     268      this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
     269    }
     270    catch (Ogre::Exception ex)
     271    {
     272      COUT(2) << "Error: There was an exception when initialising Ogre Root." << std::endl;
     273      return false;
     274    }
     275
    226276    if (!root_->isInitialised())
    227277    {
    228       CCOUT(2) << "Error: Creating Ogre root object failed" << std::endl;
     278      CCOUT(2) << "Error: Initialising Ogre root object failed." << std::endl;
    229279      return false;
    230280    }
  • code/branches/input/src/orxonox/GraphicsEngine.h

    r1505 r1531  
    2121 *
    2222 *   Author:
    23  *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
     23 *      Reto Grieder
    2424 *   Co-authors:
    25  *      Reto Grieder
     25 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007, Felix Schulthess
    2626 *
    2727 */
     
    5656        public:
    5757            void setConfigValues();
    58             bool setup(std::string& dataPath);
    59             void declareRessourceLocations();
     58            bool setup();
     59            bool declareRessourceLocations();
    6060            bool loadRenderer();
    6161            bool initialiseResources();
     
    6565
    6666            Ogre::SceneManager* getSceneManager() { return scene_; }
    67             std::string& getDataPath() { return dataPath_; }
    6867
    6968            // several window properties
     
    101100                             bool, const std::string&);
    102101
    103             Ogre::Root*         root_;        //!< Ogre's root
    104             Ogre::SceneManager* scene_;       //!< scene manager of the game
    105             Ogre::RenderWindow* renderWindow_;//!< the current render window
    106             //bool               bOverwritePath_; //!< overwrites path
    107             //std::string         configPath_;  //!< path to config file
    108             std::string         dataPath_;    //!< path to data file
    109             std::string         ogreLogfile_; //!< log file name for Ogre log messages
    110             int ogreLogLevelTrivial_;         //!< Corresponding Orxonx debug level for LL_TRIVIAL
    111             int ogreLogLevelNormal_;          //!< Corresponding Orxonx debug level for LL_NORMAL
    112             int ogreLogLevelCritical_;        //!< Corresponding Orxonx debug level for LL_CRITICAL
     102            Ogre::Root*         root_;              //!< Ogre's root
     103            Ogre::SceneManager* scene_;             //!< scene manager of the game
     104            Ogre::RenderWindow* renderWindow_;      //!< the current render window
     105            std::string         resourceFile_;      //!< resources file name
     106            std::string         ogreConfigFile_;    //!< ogre config file name
     107            std::string         ogrePluginsFile_;   //!< ogre plugins file name
     108            std::string         ogreLogFile_;      //!< log file name for Ogre log messages
     109            int ogreLogLevelTrivial_;               //!< Corresponding Orxonx debug level for LL_TRIVIAL
     110            int ogreLogLevelNormal_;                //!< Corresponding Orxonx debug level for LL_NORMAL
     111            int ogreLogLevelCritical_;              //!< Corresponding Orxonx debug level for LL_CRITICAL
    113112    };
    114113}
  • code/branches/input/src/orxonox/Main.cc

    r1505 r1531  
    8282    res = orx->init(argc, argv, macBundlePath());
    8383#else
    84     res = orx->init(argc, argv, "");
     84    res = orx->init(argc, argv);
    8585#endif
    8686
  • code/branches/input/src/orxonox/Orxonox.cc

    r1524 r1531  
    2121 *
    2222 *   Author:
     23 *      Reto Grieder
     24 *   Co-authors:
    2325 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
    24  *   Co-authors:
    25  *      ...
    2626 *
    2727 */
     
    7373
    7474#include "GraphicsEngine.h"
     75#include "Settings.h"
    7576
    7677// FIXME: is this really file scope?
     
    166167   * @param path path to config (in home dir or something)
    167168   */
    168   bool Orxonox::init(int argc, char **argv, std::string path)
    169   {
    170     //TODO: find config file (assuming executable directory)
    171     //TODO: read config file
    172     //TODO: give config file to Ogre
     169  bool Orxonox::init(int argc, char **argv)
     170  {
     171#ifdef _DEBUG
     172    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox_d.ini");
     173#else
     174    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
     175#endif
     176    Factory::createClassHierarchy();
     177
    173178    std::string mode;
    174     std::string dataPath;
     179    std::string tempDataPath;
    175180
    176181    ArgReader ar(argc, argv);
    177     ar.checkArgument("mode", mode, false);
    178     ar.checkArgument("data", dataPath, false);
    179     ar.checkArgument("ip", serverIp_, false);
    180     ar.checkArgument("port", serverPort_, false);
     182    ar.checkArgument("mode", &mode, false);
     183    ar.checkArgument("data", &tempDataPath, false);
     184    ar.checkArgument("ip",   &serverIp_, false);
     185    ar.checkArgument("port", &serverPort_, false);
    181186    if(ar.errorHandling())
     187    {
     188      COUT(1) << "Error while parsing command line arguments" << std::endl;
     189      COUT(1) << ar.getErrorString();
     190      COUT(0) << "Usage:" << std::endl << "orxonox [mode client|server|dedicated|standalone] "
     191        << "[--data PATH] [--ip IP] [--port PORT]" << std::endl;
    182192      return false;
     193    }
    183194
    184195    if (mode == "client")
     
    190201    else
    191202    {
    192       mode = "standalone";
     203      if (mode == "")
     204        mode = "standalone";
     205      if (mode != "standalone")
     206      {
     207        COUT(2) << "Warning: mode \"" << mode << "\" doesn't exist. "
     208          << "Defaulting to standalone" << std::endl;
     209        mode = "standalone";
     210      }
    193211      mode_ = STANDALONE;
    194212    }
    195213    COUT(3) << "Orxonox: Mode is " << mode << "." << std::endl;
     214
     215    if (tempDataPath != "")
     216    {
     217      if (tempDataPath[tempDataPath.size() - 1] != '/')
     218        tempDataPath += "/";
     219      Settings::tsetDataPath(tempDataPath);
     220    }
     221
     222    // initialise TCL
     223    TclBind::getInstance().setDataPath(Settings::getDataPath());
    196224
    197225    //if (mode_ == DEDICATED)
     
    202230    // procedure until the GUI is identical
    203231
    204     ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
    205     Factory::createClassHierarchy();
    206 
    207232    ogre_ = &GraphicsEngine::getSingleton();
    208     if (!ogre_->setup(path))       // creates ogre root and other essentials
     233    if (!ogre_->setup())       // creates ogre root and other essentials
    209234      return false;
    210235
  • code/branches/input/src/orxonox/Orxonox.h

    r1505 r1531  
    2121 *
    2222 *   Author:
    23  *      ...
     23 *      Reto Grieder
    2424 *   Co-authors:
    25  *      ...
     25 *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
    2626 *
    2727 */
     
    5858  {
    5959    public:
    60       bool init(int argc, char **argv, std::string path);
     60      bool init(int argc, char **argv);
    6161      bool start();
    6262
  • code/branches/input/src/util/ArgReader.cc

    r1505 r1531  
    2121 *
    2222 *   Author:
    23  *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
     23 *      Reto Grieder
    2424 *   Co-authors:
    25  *      ...
     25 *      Benjamin Knecht <beni_at_orxonox.net>
    2626 *
    2727 */
     
    3333
    3434#include "ArgReader.h"
     35#include "SubString.h"
    3536
    36 #include <iostream>
     37ArgReader::ArgReader(int argc, char **argv)
     38{
     39  failure_ = false;
     40  errorString_ = "";
     41  CmdLineArg arg;
    3742
    38 ArgReader::ArgReader(int argc, char** argv)
    39 {
    40   counter_ = argc;
    41   arguments_ = argv;
    42   fail_ = false;
    43   errorStr_ = "";
    44 }
     43  int i = 1;
     44  while (i < argc)
     45  {
     46    if (argv[i][0] == '-' && argv[i][1] == '-') // name
     47    {
     48      if (argv[i][2] == '\0')
     49      {
     50        failure_ = true;
     51        errorString_ += "Expected word after \"--\".\n";
     52      }
     53      arg.bChecked_ = false;
     54      arg.name_ = argv[i] + 2;
     55      arg.value_ = "";
     56      arguments_.push_back(arg);
     57    }
     58    else // value
     59    {
     60      if (arguments_.size() == 0)
     61      {
     62        failure_ = true;
     63        errorString_ += "Expected \"--\" in command line arguments.\n";
     64        arg.bChecked_ = false;
     65        arg.name_ = "";
     66        arg.value_ = "";
     67        arguments_.push_back(arg);
     68      }
    4569
    46 void ArgReader::checkArgument(std::string option, std::string &string, bool must)
    47 {
    48   int argpos = checkOption(option) + 1;
    49   if(argpos != 0)
    50   {
    51     string = arguments_[argpos];
     70      if (arguments_.back().value_ != "")
     71        arguments_.back().value_ += " " + std::string(argv[i]);
     72      else
     73        arguments_.back().value_ = argv[i];
     74    }
     75    ++i;
    5276  }
    53   else
    54   {
    55     if(must) {
    56       errorStr_ = errorStr_ + "Cannot find mandatory argument \"" + option + "\"\n";
    57       fail_ = true;
    58     }
    59   }
    60 
    61 }
    62 
    63 void ArgReader::checkArgument(std::string option, int &integer, bool must)
    64 {
    65   int argpos = checkOption(option) + 1;
    66   if(argpos != 0)
    67   {
    68     integer = atoi(arguments_[argpos]);
    69   }
    70   else
    71   {
    72     if(must) {
    73       errorStr_ = errorStr_ + "Cannot find mandatory argument \"" + option + "\"\n";
    74       fail_ = true;
    75     }
    76   }
    77 }
    78 
    79 void ArgReader::checkArgument(std::string option, float &floating, bool must)
    80 {
    81   int argpos = checkOption(option) + 1;
    82   if(argpos != 0)
    83   {
    84     floating = (float)atof(arguments_[argpos]);
    85   }
    86   else
    87   {
    88     if(must) {
    89       errorStr_ = errorStr_ + "Cannot find mandatory argument \"" + option + "\"\n";
    90       fail_ = true;
    91     }
    92   }
    93 }
    94 
    95 int ArgReader::checkOption(std::string option)
    96 {
    97   for(int i = 1; i < counter_; i++)
    98   {
    99     if(arguments_[i] == "--" + option)
    100         return i;
    101   }
    102   return -1;
    10377}
    10478
    10579bool ArgReader::errorHandling()
    10680{
    107   if(fail_)
    108     std::cout << errorStr_;
    109   return fail_;
     81  bool argumentsChecked = true;
     82  for (unsigned int i = 1; i < arguments_.size(); ++i)
     83    argumentsChecked &= arguments_[i].bChecked_;
     84
     85  if (!argumentsChecked)
     86    errorString_ += "Not all arguments could be matched.\n";
     87
     88  return !argumentsChecked || failure_;
    11089}
     90
     91const std::string& ArgReader::getErrorString()
     92{
     93  return errorString_;
     94}
  • code/branches/input/src/util/ArgReader.h

    r1505 r1531  
    2121 *
    2222 *   Author:
     23 *      Reto Grieder
     24 *   Co-authors:
    2325 *      Benjamin Knecht <beni_at_orxonox.net>
    24  *   Co-authors:
    25  *      ...
    2626 *
    2727 */
     
    3939
    4040#include <string>
     41#include <vector>
     42#include "Convert.h"
     43
     44struct _UtilExport CmdLineArg
     45{
     46  std::string name_;
     47  std::string value_;
     48  bool bChecked_;
     49};
    4150
    4251class _UtilExport ArgReader
     
    4453  public:
    4554    ArgReader(int argc, char **argv);
    46     void checkArgument(std::string option, std::string& string, bool must=false);
    47     void checkArgument(std::string option, int& integer, bool must=false);
    48     void checkArgument(std::string option, float& floating, bool must=false);
     55    template <class T>
     56    void checkArgument(std::string option, T* value, bool must = false);
    4957    bool errorHandling();
    50   private:
    51     int checkOption(std::string option);
     58    const std::string& getErrorString();
    5259
    5360  private:
    54     int counter_;
    55     char **arguments_;
    56     bool fail_;
    57     std::string errorStr_;
     61    std::vector<CmdLineArg> arguments_;
     62    bool failure_;
     63    std::string errorString_;
    5864};
    5965
     66template <class T>
     67void ArgReader::checkArgument(std::string option, T* value, bool must)
     68{
     69  unsigned int iArg = 0;
     70  while (iArg < arguments_.size())
     71  {
     72    if (arguments_[iArg].name_ == option)
     73      break;
     74    ++iArg;
     75  }
     76  if (iArg == arguments_.size())
     77  {
     78    if (must)
     79    {
     80      failure_ = true;
     81      errorString_ += "Cannot find mandatory argument \"" + option + "\"\n";
     82      return;
     83    }
     84    else
     85      return;
     86  }
     87
     88  arguments_[iArg].bChecked_ = true;
     89
     90  if (!convertValue(value, arguments_[iArg].value_))
     91  {
     92    failure_ = true;
     93    errorString_ += "Cannot convert argument value for option \"" + option + "\"\n";
     94  }
     95}
     96
     97template <>
     98void ArgReader::checkArgument(std::string option, bool* value, bool must)
     99{
     100  // for type bool, only check whether the option was set or not
     101  unsigned int iArg = 0;
     102  while (iArg < arguments_.size())
     103  {
     104    if (arguments_[iArg].name_ == option)
     105    {
     106      arguments_[iArg].bChecked_ = true;
     107      *value = true;
     108      break;
     109    }
     110    ++iArg;
     111  }
     112  if (iArg == arguments_.size())
     113    *value = false;
     114}
     115
    60116#endif /* _ArgReader_H__ */
  • code/branches/input/visual_studio/vc8/orxonox.vcproj

    r1524 r1531  
    184184                                </FileConfiguration>
    185185                        </File>
     186                        <File
     187                                RelativePath="..\..\src\orxonox\Settings.cc"
     188                                >
     189                        </File>
    186190                        <Filter
    187191                                Name="hud"
     
    468472                        <File
    469473                                RelativePath="..\..\src\orxonox\OrxonoxStableHeaders.h"
     474                                >
     475                        </File>
     476                        <File
     477                                RelativePath="..\..\src\orxonox\Settings.h"
    470478                                >
    471479                        </File>
Note: See TracChangeset for help on using the changeset viewer.