Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2008, 12:22:42 AM (16 years ago)
Author:
rgrieder
Message:

Merged r2101 (objecthierarchy) to trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/trunk/src/core/RootGameState.cc

    r2087 r2103  
    2929#include "RootGameState.h"
    3030
    31 #include "util/String.h"
    32 #include "util/SubString.h"
    3331#include "util/Debug.h"
    3432#include "util/Exception.h"
     
    130128        State to start with (usually main menu or specified by command line)
    131129    */
    132     void RootGameState::start(int argc, char** argv)
     130    void RootGameState::start()
    133131    {
    134132#ifdef NDEBUG
     
    141139            // create the Core settings to configure the output level
    142140            Core::getInstance();
    143 
    144             parseArguments(argc, argv);
    145141
    146142            this->activate();
     
    168164            COUT(1) << ex.what() << std::endl;
    169165            COUT(1) << "Program aborted." << std::endl;
    170             abort();
    171166        }
    172167        // anything that doesn't inherit from std::exception
     
    174169        {
    175170            COUT(1) << "An unidentifiable exception has occured. Program aborted." << std::endl;
    176             abort();
    177171        }
    178172#endif
    179173    }
    180 
    181     /**
    182     @brief
    183         Parses both command line and start.ini for CommandLineArguments.
    184     */
    185     void RootGameState::parseArguments(int argc, char** argv)
    186     {
    187         // parse command line first
    188         std::vector<std::string> args;
    189         for (int i = 1; i < argc; ++i)
    190             args.push_back(argv[i]);
    191 
    192         try
    193         {
    194             orxonox::CommandLine::parse(args);
    195         }
    196         catch (orxonox::ArgumentException& ex)
    197         {
    198             COUT(1) << ex.what() << std::endl;
    199             COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
    200         }
    201 
    202         // look for additional arguments in start.ini
    203         std::ifstream file;
    204         file.open("start.ini");
    205         args.clear();
    206         if (file)
    207         {
    208             while (!file.eof())
    209             {
    210                 std::string line;
    211                 std::getline(file, line);
    212                 line = removeTrailingWhitespaces(line);
    213                 //if (!(line[0] == '#' || line[0] == '%'))
    214                 //{
    215                 SubString tokens(line, " ", " ", false, 92, false, 34, false, 40, 41, false, '#');
    216                 for (unsigned i = 0; i < tokens.size(); ++i)
    217                     if (tokens[i][0] != '#')
    218                         args.push_back(tokens[i]);
    219                 //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end());
    220                 //}
    221             }
    222             file.close();
    223         }
    224 
    225         try
    226         {
    227             orxonox::CommandLine::parse(args);
    228         }
    229         catch (orxonox::ArgumentException& ex)
    230         {
    231             COUT(1) << "An Exception occured while parsing start.ini" << std::endl;
    232             COUT(1) << ex.what() << std::endl;
    233             COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
    234         }
    235     }
    236174}
Note: See TracChangeset for help on using the changeset viewer.