Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4091 in orxonox.OLD for orxonox/trunk/src/orxonox.cc


Ignore:
Timestamp:
May 6, 2005, 8:02:26 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: now All options get loaded in new style (be aware, quiting only works with ESCAPE, not q, but of corse you can change this now in the GUI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/orxonox.cc

    r4084 r4091  
    3232#include "data_tank.h"
    3333#include "command_node.h"
     34#include "ini_parser.h"
    3435#include "game_loader.h"
    3536#include "graphics_engine.h"
     
    173174int Orxonox::initResources()
    174175{
    175   //  printf("Not yet implemented\n");
    176176  PRINT(3)("initializing ResourceManager\n");
    177177  resourceManager = ResourceManager::getInstance();
    178   if (!resourceManager->setDataDir("../data/"))
    179     {
    180       PRINTF(1)("Data Could not be located\n");
     178
     179  // create parser
     180  IniParser parser (DEFAULT_CONFIG_FILE);
     181  if( parser.getSection (CONFIG_SECTION_DATA) == -1)
     182    {
     183      PRINTF(1)("Could not find Section %s in %s\n", CONFIG_SECTION_DATA, DEFAULT_CONFIG_FILE);
     184      return -1;
     185    }
     186  char namebuf[256];
     187  char valuebuf[256];
     188  memset (namebuf, 0, 256);
     189  memset (valuebuf, 0, 256);
     190 
     191  while( parser.nextVar (namebuf, valuebuf) != -1)
     192    {
     193      if (!strcmp(namebuf, CONFIG_NAME_DATADIR))
     194        {
     195          //  printf("Not yet implemented\n");
     196          if (!resourceManager->setDataDir(valuebuf))
     197            {
     198              PRINTF(1)("Data Could not be located\n");
     199              exit(-1);
     200            }
     201        }
     202     
     203      memset (namebuf, 0, 256);
     204      memset (valuebuf, 0, 256);
     205    }
     206 
     207  if (!resourceManager->checkDataDir(DEFAULT_DATA_DIR_CHECKFILE))
     208    {
     209      PRINTF(1)("The DataDirectory %s could not be verified\nPlease Change in File %s Section %s Entry %s to a suitable value\n",
     210                resourceManager->getDataDir(),
     211                DEFAULT_CONFIG_FILE,
     212                CONFIG_SECTION_DATA,
     213                CONFIG_NAME_DATADIR);
    181214      exit(-1);
    182215    }
     216
    183217
    184218  PRINT(3)("initializing TextEngine\n");
Note: See TracChangeset for help on using the changeset viewer.