Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 4, 2005, 1:57:55 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: orxonox now starts the Gui by default, and also if orxonox shuts down unexpected

File:
1 edited

Legend:

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

    r4010 r4032  
    3737
    3838#include <string.h>
     39
    3940int verbose = 4;
    4041
     
    4647Orxonox::Orxonox ()
    4748{
     49  ResourceManager::touchFile("~/.orxonox/orxonox.lock");
     50
    4851  pause = false;
    4952}
     
    6164  delete ResourceManager::getInstance(); // deletes the Resource Manager
    6265  delete TextEngine::getInstance();
     66
     67  ResourceManager::deleteFile("~/.orxonox/orxonox.lock");
    6368}
    6469
     
    302307
    303308  int i;
    304   for(i = 0; i < argc; ++i)
     309  for(i = 1; i < argc; ++i)
    305310    {
    306311      if(! strcmp( "--help", argv[i])) return startHelp();
    307312      else if(! strcmp( "--benchmark", argv[i])) return startBenchmarks();
     313     
     314      else PRINTF(2)("Orxonox does not understand the arguments %s\n", argv[i]);
    308315    }
    309316
    310   PRINTF(2)("Orxonox does not understand the arguments");
    311317  return startOrxonox(argc, argv);
    312318}
     
    316322int startHelp()
    317323{
    318   printf("orxonox: starts the orxonox game - rules\n");
    319   printf("usage: orxonox [arg]\n\n");
    320   printf("valid options:\n");
    321   printf(" --benchmark\tstarts the orxonox benchmark\n");
    322   printf(" --help \tshows this menu\n");
     324  PRINT(0)("orxonox: starts the orxonox game - rules\n");
     325  PRINT(0)("usage: orxonox [arg]\n\n");
     326  PRINT(0)("valid options:\n");
     327  PRINT(0)(" --benchmark\tstarts the orxonox benchmark\n");
     328  PRINT(0)(" --help \tshows this menu\n");
    323329}
    324330
     
    326332int startOrxonox(int argc, char** argv)
    327333{
    328   printf(">>> Starting Orxonox <<<\n");
     334  // checking for existence of the configuration-files
     335  if (!ResourceManager::isFile("~/.orxonox/orxonox.conf") || ResourceManager::isFile("~/.orxonox/orxonox.lock"))
     336    {
     337      if (ResourceManager::isFile("~/.orxonox/orxonox.lock"))
     338        ResourceManager::deleteFile("~/.orxonox/orxonox.lock");
     339      if (system("./orxonoxGui --gui") == -1)
     340        system ("orxonoxGui --gui");
     341      return 0;
     342    }
     343 
     344  PRINT(0)(">>> Starting Orxonox <<<\n");
    329345  Orxonox *orx = Orxonox::getInstance();
    330346 
    331347  if((*orx).init(argc, argv) == -1)
    332348    {
    333       printf("! Orxonox initialization failed\n");
     349      PRINTF(1)("! Orxonox initialization failed\n");
    334350      return -1;
    335351    }
Note: See TracChangeset for help on using the changeset viewer.