Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4084 in orxonox.OLD


Ignore:
Timestamp:
May 6, 2005, 4:04:57 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now orxonox parses the config-file from ~/.orxonox/orxonox.conf

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

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

    r3654 r4084  
    5757  this->bEnabled = true;
    5858  this->world = NULL;
    59   this->loadBindings (filename);
     59  this->loadBindings(filename);
    6060}
    6161
     
    111111   \param filename: The path and name of the file to load the bindings from
    112112*/
    113 void CommandNode::loadBindings (char* filename)
     113void CommandNode::loadBindings (char* filename = DEFAULT_KEYBIND_FILE)
    114114{
    115115  FILE* stream;
    116116 
    117117  PRINTF(4)("Loading key bindings from %s\n", filename);
    118  
    119   if( filename == NULL) filename = DEFAULT_KEYBIND_FILE;
    120118 
    121119  // remove old bindings if present
     
    128126  // create parser
    129127  IniParser parser (filename);
    130   if( parser.getSection ("Bindings") == -1)
     128  if( parser.getSection ("player1") == -1)
    131129    {
    132130      PRINTF(1)("Could not find key bindings in %s\n", filename);
  • orxonox/trunk/src/command_node.h

    r3608 r4084  
    1818#define N_STD_KEYS SDLK_LAST
    1919#define N_BUTTONS 6
    20 #define DEFAULT_KEYBIND_FILE "default.ini"
     20#define DEFAULT_KEYBIND_FILE "~/.orxonox/orxonox.conf"
    2121
    2222//! Key aliasing structure
  • orxonox/trunk/src/defs/debug.h

    r3966 r4084  
    5959#define DEBUG_MODULE_PNODE              1
    6060#define DEBUG_MODULE_WORLD_ENTITY       0
    61 #define DEBUG_MODULE_COMMAND_NODE       0
     61#define DEBUG_MODULE_COMMAND_NODE       2
    6262#define DEBUG_MODULE_GRAPHICS           0
    6363#define DEBUG_MODULE_LOAD               0
  • orxonox/trunk/src/lib/util/ini_parser.cc

    r4028 r4084  
    1616
    1717#include "ini_parser.h"
     18#include "resource_manager.h"
    1819
    1920using namespace std;
    2021
    2122/**
    22         \brief constructs an IniParser using a file
    23         \param filename: the path and name of the file to parse
     23   \brief constructs an IniParser using a file
     24   \param filename: the path and name of the file to parse
    2425*/
    2526IniParser::IniParser (const char* filename)
     
    3132
    3233/**
    33         \brief removes the IniParser from memory
     34   \brief removes the IniParser from memory
    3435*/
    3536IniParser::~IniParser ()
     
    4546int IniParser::openFile(const char* filename)
    4647{
     48  char* tmpName = ResourceManager::homeDirCheck(filename);
    4749  if( filename == NULL) return -1;
    4850  if( stream != NULL)   fclose (stream);
    49   if( (stream = fopen (filename, "r")) == NULL)
     51  if( (stream = fopen (tmpName, "r")) == NULL)
    5052    {
    51       printf("IniParser could not open %s\n", filename);
     53      PRINTF(1)("IniParser could not open %s\n", filename);
     54      delete tmpName;
    5255      return -1;
    5356    }
    5457  bInSection = false;
     58  delete tmpName;
    5559  return 0;
    5660}
     
    123127          return -1;
    124128        }
    125       if( (ptr = strchr( linebuffer, '=')) != NULL)
     129      sscanf(linebuffer, "%s = %s", name, value);
     130      return 0;
     131      /*
     132        if( (ptr = strchr( tmpBuffer, '=')) != NULL)
    126133        {
    127           if( ptr == linebuffer) continue;
    128           strcpy (value, &ptr[1]);
    129           strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1);
    130           return 0;
     134        if( ptr == linebuffer) continue;
     135        strcpy (value, &ptr[1]);
     136        strncpy (name, linebuffer, strlen (linebuffer) - strlen (value) - 1);
     137        printf ("%s, %s\n", value, name);
     138        return 0;
    131139        }
     140      */
    132141    }
    133142  return -1;   
  • orxonox/trunk/src/orxonox.cc

    r4059 r4084  
    9393void Orxonox::getConfigFile (int argc, char** argv)
    9494{
    95   strcpy (configfilename, "orxonox.conf");
     95  strcpy (configfilename, "~/.orxonox/orxonox.conf");
    9696}
    9797
     
    152152{
    153153  // create localinput
    154   localinput = new CommandNode( configfilename);
     154  localinput = new CommandNode(configfilename);
    155155 
    156156  return 0;
Note: See TracChangeset for help on using the changeset viewer.