Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7256 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Mar 30, 2006, 11:45:31 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the preferences back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/preferences . -r7233:HEAD
no conflicts… nice work

Location:
trunk/src
Files:
20 edited
12 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r7193 r7256  
    9696  CL_MASK_LOWLEVEL_CLASS        =    0x00000fff,
    9797
     98  CL_PREFERENCES                =    0X00000f51,
    9899
    99100  /// SINGLETON classes (range from 0x00000000 to 0x000000ff)
  • trunk/src/defs/globals.h

    r6998 r7256  
    2727#define   DEFAULT_DATA_DIR                 DATADIR "/orxonox/"
    2828#define   DEFAULT_DATA_DIR_CHECKFILE       "data.oxd"
     29
     30#define   DEFAULT_ORXONOX_PORT             9999
    2931
    3032// Defines all the Sections of the Config (in Gui and orxonox)
  • trunk/src/lib/BuildLibs.am

    r7151 r7256  
    1515                $(LIB_PREFIX)/graphics/spatial_separation/libORXquadtree.a \
    1616                $(LIB_PREFIX)/parser/tinyxml/libtinyxml.a \
     17                $(LIB_PREFIX)/parser/preferences/libPrefsParser.a \
     18                $(LIB_PREFIX)/parser/cmdline_parser/libCmdLineParser.a \
    1719                $(LIB_PREFIX)/parser/ini_parser/libIniParser.a \
    1820                $(LIB_PREFIX)/shell/libORXshell.a \
    19                 $(LIB_PREFIX)/math/libORXmath.a
     21                $(LIB_PREFIX)/math/libORXmath.a \
     22                $(LIB_PREFIX)/libORXlibs.a
  • trunk/src/lib/Makefile.am

    r7221 r7256  
    2323                util/loading/factory.cc \
    2424                util/loading/dynamic_loader.cc \
     25                util/preferences.cc \
    2526                \
    2627                data/data_tank.cc
     
    3940                util/executor/executor_specials.h \
    4041                util/executor/functor_list.h \
     42                util/preferences.h \
    4143                \
    4244                util/loading/resource_manager.h \
  • trunk/src/lib/event/event_handler.cc

    r7166 r7256  
    8888 * this has to be called before the use of the event handler
    8989*/
    90 void EventHandler::init(IniParser* iniParser)
     90void EventHandler::init()
    9191{
    9292  if (this->keyMapper == NULL)
    9393  {
    9494    this->keyMapper = new KeyMapper();
    95     this->keyMapper->loadKeyBindings(iniParser);
     95    this->keyMapper->loadKeyBindings();
    9696  }
    9797}
  • trunk/src/lib/event/event_handler.h

    r7164 r7256  
    1515// FORWARD DECLARATION
    1616class EventListener;
    17 class IniParser;
    1817
    1918//! The one Event Handler from Orxonox
     
    2423  /** @returns a Pointer to the only object of this Class */
    2524  inline static EventHandler* getInstance() { if (!singletonRef) singletonRef = new EventHandler();  return singletonRef; };
    26   void init(IniParser* iniParser);
     25  void init();
    2726
    2827  /** @param state: to which the event handler shall change */
  • trunk/src/lib/event/key_mapper.cc

    r7221 r7256  
    2525#include "globals.h"
    2626#include "parser/ini_parser/ini_parser.h"
     27#include "util/preferences.h"
    2728#include "key_names.h"
    2829#include "debug.h"
     
    145146
    146147  iniParser->firstVar();
    147   while(iniParser->getCurrentName() != "")
     148  while( iniParser->getCurrentName() != "" )
    148149  {
    149150    PRINTF(3)("Keys: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
     
    164165
    165166  iniParser->firstVar();
    166   while(iniParser->getCurrentName() != "")
     167  while( iniParser->getCurrentName() != "" )
    167168  {
    168169    PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
     
    170171    this->mapKeys(iniParser->getCurrentName(), index);
    171172    iniParser->nextVar();
     173  }
     174}
     175
     176void KeyMapper::loadKeyBindings()
     177{
     178  if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_PLAYER "1"))
     179  {
     180    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");
     181    return;
     182  }
     183  int* index;
     184
     185  std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_PLAYER "1");
     186  for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
     187  {
     188    PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, "").c_str());
     189    // map the name to an sdl index
     190    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, ""));
     191    // map the index to a internal name
     192    this->mapKeys(*it, index);
     193  }
     194
     195
     196  // PARSE MISC SECTION
     197  if( !Preferences::getInstance()->sectionExists (CONFIG_SECTION_MISC_KEYS))
     198  {
     199    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_MISC_KEYS "\n");
     200    return;
     201  }
     202
     203  keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_MISC_KEYS);
     204  for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
     205  {
     206    PRINTF(3)("MISC: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, "").c_str());
     207    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, ""));
     208    this->mapKeys(*it, index);
    172209  }
    173210}
  • trunk/src/lib/event/key_mapper.h

    r7221 r7256  
    2929  virtual ~KeyMapper();
    3030
    31   void loadKeyBindings(const std::string& fileName = "" );
     31  void loadKeyBindings(const std::string& fileName );
     32  void loadKeyBindings();
    3233  void loadKeyBindings(IniParser* iniParser);
    3334
  • trunk/src/lib/graphics/graphics_engine.cc

    r7221 r7256  
    2929#include "debug.h"
    3030
    31 #include "parser/ini_parser/ini_parser.h"
     31#include "util/preferences.h"
    3232#include "substring.h"
    3333#include "text.h"
     
    150150/**
    151151 * loads the GraphicsEngine's settings from a given ini-file and section
    152  * @param iniParser the iniParser to load from
    153  * @param section the Section in the ini-file to load from
    154152 * @returns nothing usefull
    155153 */
    156 int GraphicsEngine::initFromIniFile(IniParser* iniParser)
     154int GraphicsEngine::initFromPreferences()
    157155{
    158156  // looking if we are in fullscreen-mode
    159   const std::string fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0");
     157  const std::string fullscreen = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_FULLSCREEN, "0");
     158
    160159  if (fullscreen[0] == '1' || fullscreen == "true")
    161160    this->fullscreenFlag = SDL_FULLSCREEN;
    162161
    163162  // looking if we are in fullscreen-mode
    164   const std::string textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0");
     163  const std::string textures = Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO_ADVANCED, CONFIG_NAME_TEXTURES, "0");
    165164  if (textures[0] == '1' || textures == "true")
    166165    Texture::setTextureEnableState(true);
     
    169168
    170169  // searching for a usefull resolution
    171   SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480").c_str(), 'x'); ///FIXME
     170  SubString resolution(Preferences::getInstance()->getString(CONFIG_SECTION_VIDEO, CONFIG_NAME_RESOLUTION, "640x480").c_str(), 'x'); ///FIXME
    172171  //resolution.debug();
    173172  MultiType x = resolution.getString(0), y = resolution.getString(1);
  • trunk/src/lib/graphics/graphics_engine.h

    r7221 r7256  
    2020// Forward Declaration
    2121class Text;
    22 class IniParser;
    2322class WorldEntity;
    2423class GraphicsEffect;
     
    3938
    4039    int init();
    41     int initFromIniFile(IniParser* iniParser);
     40    int initFromPreferences();
    4241
    4342    void setWindowName(const std::string& windowName, const std::string& icon);
  • trunk/src/lib/network/network_manager.cc

    r6695 r7256  
    8888 * @param hostName: the name of the destination host
    8989 */
    90 int NetworkManager::establishConnection(const char* name, unsigned int port)
     90int NetworkManager::establishConnection(const std::string & name, unsigned int port)
    9191{
    9292  IPaddress ipAddress;
    93   int error = SDLNet_ResolveHost(&ipAddress, name, port);
     93  int error = SDLNet_ResolveHost(&ipAddress, name.c_str(), port);
    9494  if( error == -1) {
    9595    printf("\n\nerror on address resolution, program inconsistency\n\n");
  • trunk/src/lib/network/network_manager.h

    r6981 r7256  
    3636    void shutdown();
    3737
    38     int establishConnection(const char* name, unsigned int port);
     38    int establishConnection( const std::string & name, unsigned int port);
    3939    int createServer(unsigned int port);
    4040
  • trunk/src/lib/parser/Makefile.am

    r5944 r7256  
    11SUBDIRS = \
    22          tinyxml \
    3           ini_parser
     3          ini_parser \
     4          preferences \
     5          cmdline_parser
    46
    57
  • trunk/src/lib/parser/ini_parser/ini_parser.cc

    r7221 r7256  
    392392}
    393393
     394/**
     395 * @brief edits the entry speciefied by entryName in sectionName/currentSection or creates it if it doesn't exist
     396 * @param entryName the Name of the Entry to add
     397 * @param value the value to assign to this entry
     398 * @param sectionName if NULL then this entry will be set to the currentSection
     399 * otherwise to the section refered to by sectionName.
     400 * If both are NULL no entry will be added
     401 * @return true if everything is ok false on error
     402 */
     403bool IniParser::editVar(const std::string& entryName, const std::string& value, const std::string& sectionName)
     404{
     405  std::list<IniSection>::iterator section;
     406
     407  if (!sectionName.empty())
     408  {
     409    for (section = this->sections.begin(); section != this->sections.end(); section++)
     410      if ((*section).name == sectionName)
     411        break;
     412  }
     413  else
     414    section = this->currentSection;
     415
     416  if (section == this->sections.end())
     417  {
     418    IniSection sec;
     419    sec.comment = "";
     420    sec.name = sectionName;
     421    section = this->sections.insert(this->sections.end(), sec);
     422  }
     423
     424  if (section == this->sections.end())
     425  {
     426    PRINTF(2)("section '%s' not found for value '%s'\n", sectionName.c_str(), entryName.c_str());
     427    return false;
     428  }
     429  else
     430  {
     431    //try find item
     432    std::list<IniEntry>::iterator entry;
     433    for (entry = section->entries.begin(); entry!=section->entries.end(); entry++)
     434      if (entry->name == entryName )
     435        break;
     436
     437    //found it?
     438    if ( entry != section->entries.end() )
     439    {
     440      entry->value = value;
     441
     442      return true;
     443    }
     444
     445    //not found -> create it
     446    (*section).entries.push_back(IniEntry());
     447    (*section).entries.back().comment = "";
     448    (*section).entries.back().name = entryName;
     449    (*section).entries.back().value = value;
     450    PRINTF(5)("Added Entry %s with Value '%s' to Section %s\n",
     451    (*section).entries.back().name.c_str(),
     452    (*section).entries.back().value.c_str(),
     453    (*section).name);
     454    this->currentEntry = --(*section).entries.end();
     455    return true;
     456  }
     457}
     458
    394459
    395460/**
  • trunk/src/lib/parser/ini_parser/ini_parser.h

    r7221 r7256  
    6969    bool addVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "" );
    7070    const std::string& getVar(const std::string& entryName, const std::string& sectionName, const std::string& defaultValue = "") const;
     71    bool IniParser::editVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "");
    7172    void setEntryComment(const std::string& comment, const std::string& entryName, const std::string& sectionName);
    7273    const std::string& getEntryComment(const std::string& entryName, const std::string& sectionName) const;
  • trunk/src/lib/sound/sound_engine.cc

    r7225 r7256  
    2626#include "util/loading/resource_manager.h"
    2727#include "debug.h"
    28 #include "parser/ini_parser/ini_parser.h"
     28#include "util/preferences.h"
    2929#include "globals.h"
    3030
     
    9595/**
    9696 * loads the settings of the SoundEngine from an ini-file
    97  * @param iniParser the IniParser of the inifile
    9897 */
    99 void SoundEngine::loadSettings(IniParser* iniParser)
    100 {
    101   MultiType channels = iniParser->getVar(CONFIG_NAME_AUDIO_CHANNELS, CONFIG_SECTION_AUDIO, "32");
     98void SoundEngine::loadSettings()
     99{
     100  MultiType channels = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_AUDIO_CHANNELS, "32");
    102101  this->maxSourceCount = channels.getInt();
    103102
    104   MultiType effectsVolume = iniParser->getVar(CONFIG_NAME_EFFECTS_VOLUME, CONFIG_SECTION_AUDIO, "80");
     103  MultiType effectsVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_EFFECTS_VOLUME, "80");
    105104  this->effectsVolume = effectsVolume.getFloat()/100.0;
    106105
    107   MultiType musicVolume = iniParser->getVar(CONFIG_NAME_MUSIC_VOLUME, CONFIG_SECTION_AUDIO, "75");
     106  MultiType musicVolume = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_MUSIC_VOLUME, "75");
    108107  this->musicVolume = musicVolume.getFloat()/100.0;
    109108}
  • trunk/src/lib/sound/sound_engine.h

    r7225 r7256  
    3131    inline static SoundEngine* getInstance() { if (!SoundEngine::singletonRef) SoundEngine::singletonRef = new SoundEngine();  return SoundEngine::singletonRef; };
    3232
    33     void loadSettings(IniParser* iniParser);
     33    void loadSettings();
    3434
    3535    SoundSource* createSource(const std::string& fileName, PNode* sourceNode = NULL);
  • trunk/src/orxonox.cc

    r7221 r7256  
    5858
    5959#include "state.h"
    60 
     60#include "lib/parser/preferences/cmd_line_prefs_reader.h"
     61#include "lib/parser/preferences/ini_file_prefs_reader.h"
    6162#include <string.h>
    6263
     
    6667
    6768SHELL_COMMAND(restart, Orxonox, restart);
     69
     70REGISTER_ARG_FLAG( l, license, "misc", "showLicenseAndExit", "Prints the licence and exit",    "1" );
     71REGISTER_ARG_FLAG( c, client,  "game", "gameType",           "Connect to Server (-H)",         "multiplayer_client" );
     72REGISTER_ARG_FLAG( s, server,  "game", "gameType",           "Start Orxonox as Game Server",   "multiplayer_server" );
     73REGISTER_ARG_ARG(  H, host,    "game", "host",               "Host to connect to",             "host");
     74REGISTER_ARG_ARG(  p, port,    "game", "port",               "Port to use",                    "port" );
     75REGISTER_ARG_FLAG( g, gui,     "game", "showGui",            "starts the orxonox with the configuration GUI", "1");
    6876
    6977/**
     
    7785  this->setName("orxonox-main");
    7886
    79   this->iniParser = NULL;
    80 
    8187  this->argc = 0;
    8288  this->argv = NULL;
    8389
    8490  /* this way, there is no network enabled: */
    85   this->serverName = NULL;
     91  this->serverName = "";
    8692  this->port = -1;
    8793
     
    114120  // output-buffer
    115121  delete ShellBuffer::getInstance();
    116 
    117   // orxonox class-stuff
    118   delete this->iniParser;
    119122
    120123  SDL_QuitSubSystem(SDL_INIT_TIMER);
     
    175178  else
    176179    this->configFileName = ResourceManager::homeDirCheck(DEFAULT_CONFIG_FILE);
    177   this->iniParser = new IniParser(this->configFileName);
     180
    178181  PRINTF(3)("Parsed Config File: '%s'\n", this->configFileName);
    179182}
     
    182185 * initialize Orxonox with command line
    183186 */
    184 int Orxonox::init (int argc, char** argv, const char* name, int port)
     187int Orxonox::init (int argc, char** argv, const std::string & name, int port)
    185188{
    186189  this->argc = argc;
     
    227230  GraphicsEngine::getInstance();
    228231
    229   GraphicsEngine::getInstance()->initFromIniFile(this->iniParser);
     232  GraphicsEngine::getInstance()->initFromPreferences();
    230233
    231234  std::string iconName = ResourceManager::getFullName("pictures/fighter-top-32x32.bmp");
     
    247250  SoundEngine::getInstance();
    248251
    249   SoundEngine::getInstance()->loadSettings(this->iniParser);
     252  SoundEngine::getInstance()->loadSettings();
    250253  SoundEngine::getInstance()->initAudio();
    251254  return 0;
     
    260263  PRINT(3)("> Initializing input\n");
    261264
    262   EventHandler::getInstance()->init(this->iniParser);
     265  EventHandler::getInstance()->init();
    263266  EventHandler::getInstance()->subscribe(GraphicsEngine::getInstance(), ES_ALL, EV_VIDEO_RESIZE);
    264267
     
    274277  PRINT(3)("> Initializing networking\n");
    275278
    276   if( this->serverName != NULL) // we are a client
     279  if( this->serverName != "") // we are a client
    277280  {
    278281    State::setOnline(true);
     
    299302  // init the resource manager
    300303  std::string dataPath;
    301   if ((dataPath = this->iniParser->getVar(CONFIG_NAME_DATADIR, CONFIG_SECTION_DATA))!= "")
     304  if ((dataPath = Preferences::getInstance()->getString(CONFIG_SECTION_DATA, CONFIG_NAME_DATADIR, ""))!= "")
    302305  {
    303306    if (!ResourceManager::getInstance()->setDataDir(dataPath) &&
     
    403406int main(int argc, char** argv)
    404407{
    405   int i;
    406   for(i = 1; i < argc; ++i)
    407   {
    408     if(     !strcmp( "--help", argv[i])     || !strcmp("-h", argv[i]))
    409       return showHelp(argc, argv);
    410     else if(!strcmp( "--gui", argv[i])      || !strcmp("-g", argv[i]))
    411       showGui = true;
    412     else if(!strcmp( "--client", argv[i])   || !strcmp("-c", argv[i]))
    413       return startNetworkOrxonox(argc, argv);
    414     else if(!strcmp( "--server", argv[i])   || !strcmp("-s", argv[i]))
    415       return startNetworkOrxonox(argc, argv);
    416     else if(!strcmp( "--license", argv[i])  || !strcmp("-l", argv[i]))
    417       return PRINT(0)(ORXONOX_LICENSE_SHORT);
    418   }
    419 
    420   return startOrxonox(argc, argv, NULL, -1);
    421 }
    422 
    423 
    424 
    425 int showHelp(int argc, char** argv)
    426 {
    427   PRINT(0)("Orxonox Version %s\n", PACKAGE_VERSION);
    428   PRINT(0)(" Starts Orxonox - The most furious 3D Action Game :)\n");
    429   PRINT(0)("\n");
    430   PRINT(0)("Common options:\n");
    431   PRINT(0)(" -g, --gui                        starts the orxonox with the configuration GUI \n");
    432   PRINT(0)(" -h, --help                       shows this help\n");
    433   PRINT(0)("\n");
    434   PRINT(0)("Network options:\n");
    435   PRINT(0)(" -s, --server [port]              starts Orxonox and listens on the [port] for players\n");
    436   PRINT(0)(" -c, --client [hostname] [port]   starts Orxonox as a Client\n");
    437   PRINT(0)(" -c, --client [ip address] [port] starts Orxonox as a Client\n");
    438   PRINT(0)("\n");
    439   PRINT(0)("Other options:\n");
    440   PRINT(0)("     --license     prints the licence and exit\n\n");
    441   PRINT(0)("\n");
    442 
    443   //   {
    444   //     Gui* gui = new Gui(argc, argv);
    445   //     gui->printHelp();
    446   //     delete gui;
    447   //   }
    448 }
    449 
     408  CmdLinePrefsReader prefs;
     409 
     410  IniFilePrefsReader ini(ResourceManager::homeDirCheck(DEFAULT_CONFIG_FILE));
     411 
     412  prefs.parse(argc, argv);
     413 
     414  if ( Preferences::getInstance()->getString("misc", "showLicenseAndExit", "") == "1" )
     415  {
     416    PRINT(0)(ORXONOX_LICENSE_SHORT);
     417    return 0;
     418  }
     419 
     420  if( Preferences::getInstance()->getString("game", "showGui", "") == "1" )
     421    showGui = true;
     422  else if( Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_server" ||
     423           Preferences::getInstance()->getString( "game", "gameType", "" ) == "multiplayer_client" )
     424    return startNetworkOrxonox(argc, argv);
     425 
     426  return startOrxonox(argc, argv, "", -1);
     427  return 0;
     428}
    450429
    451430
     
    459438{
    460439
    461   int i;
    462   for(i = 0; i < argc; ++i )
    463   {
    464     if( !strcmp( "--client", argv[i]) || !strcmp("-c", argv[i]))
     440  std::string gameType = Preferences::getInstance()->getString( "game", "gameType", "" );
     441 
     442  if ( gameType == "multiplayer_client" )
     443  {
     444    int port = Preferences::getInstance()->getInt( "game", "port", DEFAULT_ORXONOX_PORT );
     445    std::string host = Preferences::getInstance()->getString( "game", "host", "" );
     446   
     447    if ( host == "" )
    465448    {
    466       if( argc <= (i+2))
    467       {
    468         printf(" Wrong arguments try following notations:\n");
    469         printf("   --client [server ip address] [port number]\n");
    470         printf("   --client [dns name] [port number]\n");
    471         return 0;
    472       }
    473 
    474       const char* name = argv[i+1];
    475       int port = atoi(argv[i+2]);
    476       printf("Starting Orxonox as client: connecting to %s, on port %i\n", name, port);
    477 
    478       startOrxonox(argc, argv, name, port);
     449      printf("You need to specify a host to connect to ( -H <host> )\n");
     450      return 1;
    479451    }
    480     else if( !strcmp( "--server", argv[i]) || !strcmp("-s", argv[i]))
    481     {
    482       if( argc <= (i+1))
    483       {
    484         printf(" Wrong arguments try following notations:\n");
    485         printf("   --server [port number]\n");
    486         return 0;
    487       }
    488 
    489       int port = atoi(argv[i+1]);
    490       printf("Starting Orxonox as server, listening on port %i\n", port);
    491 
    492       startOrxonox(argc, argv, NULL, port);
    493     }
     452   
     453    printf("Starting Orxonox as client: connecting to %s, on port %i\n", host.c_str(), port);
     454   
     455    startOrxonox(argc, argv, host.c_str(), port);
     456  }
     457  else if ( gameType == "multiplayer_server" )
     458  {
     459    int port = Preferences::getInstance()->getInt( "game", "port", DEFAULT_ORXONOX_PORT );
     460   
     461    printf("Starting Orxonox as server: listening on port %i\n", port);
     462   
     463    startOrxonox(argc, argv, "", port);
    494464  }
    495465}
     
    502472 * @param argv parameters given to orxonox
    503473 */
    504 int startOrxonox(int argc, char** argv, const char* name, int port)
     474int startOrxonox(int argc, char** argv, const std::string & name, int port)
    505475{
    506476  // checking for existence of the configuration-files, or if the lock file is still used
  • trunk/src/orxonox.h

    r7221 r7256  
    1111class WorldEntity;
    1212class GameLoader;
    13 class IniParser;
    1413
    1514//! orxonox core singleton class
     
    2322  inline static Orxonox* getInstance() { if (!singletonRef) singletonRef = new Orxonox();  return singletonRef; };
    2423
    25   int init(int argc, char** argv, const char* name, int port);
     24  int init(int argc, char** argv, const std::string & name, int port);
    2625
    2726  void restart();
     
    3130 private:
    3231  Orxonox ();
    33 
    34   void parseIniFile(const std::string& fileName);
    3532
    3633  int initResources ();
     
    4643  static Orxonox*   singletonRef;            //!< singleton reference to orxonox
    4744
    48   IniParser*        iniParser;               //!< Reference to the ini-parser used in orxonox
    4945  std::string       configFileName;          //!< Filename of the configuration-file.
    5046  GameLoader*       gameLoader;              //!< The gameLoader
     
    5349  char**            argv;                    //!< Values of th Arguments of orxonox.
    5450
    55   const char*       serverName;              //!< Name of the Orxonox client if == NULL -> server
     51  std::string       serverName;              //!< Name of the Orxonox client if == "" -> server
    5652  int               port;                    //!< number of the network port of the server/client if == -1 no network
    5753};
     
    6157// Start-up functions //
    6258////////////////////////
    63 int showHelp(int argc, char** argv);
    64 int showLicense();
     59
    6560int startNetworkOrxonox(int argc, char** argv);
    66 int startOrxonox(int argc, char** argv, const char* clientName, int port);
     61int startOrxonox(int argc, char** argv, const std::string & clientName, int port);
    6762
    6863#endif /* _ORXONOX_H */
  • trunk/src/subprojects/framework.cc

    r7193 r7256  
    2323#include "util/loading/resource_manager.h"
    2424#include "camera.h"
    25 #include "parser/ini_parser/ini_parser.h"
     25#include "util/preferences.h"
    2626#include "globals.h"
    2727
     
    3030void Framework::init(void)
    3131{
    32   // create parser
    33   char* configFileName = ResourceManager::homeDirCheck(DEFAULT_CONFIG_FILE);
    34 
    35   IniParser iniParser (configFileName);
    36   delete configFileName;
    37 
    38   GraphicsEngine::getInstance()->initFromIniFile(&iniParser);
     32  GraphicsEngine::getInstance()->initFromPreferences();
    3933
    4034  LightManager::getInstance();
    4135
    4236  const char* dataPath;
    43   if ((dataPath = iniParser.getVar(CONFIG_NAME_DATADIR, CONFIG_SECTION_DATA))!= NULL)
     37  if ((dataPath = Preferences::getInstance()->getString(CONFIG_SECTION_DATA, CONFIG_NAME_DATADIR, ""))!= NULL)
    4438  {
    4539    if (!ResourceManager::getInstance()->setDataDir(dataPath))
Note: See TracChangeset for help on using the changeset viewer.