Changeset 4084 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- May 6, 2005, 4:04:57 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/command_node.cc
r3654 r4084 57 57 this->bEnabled = true; 58 58 this->world = NULL; 59 this->loadBindings 59 this->loadBindings(filename); 60 60 } 61 61 … … 111 111 \param filename: The path and name of the file to load the bindings from 112 112 */ 113 void CommandNode::loadBindings (char* filename )113 void CommandNode::loadBindings (char* filename = DEFAULT_KEYBIND_FILE) 114 114 { 115 115 FILE* stream; 116 116 117 117 PRINTF(4)("Loading key bindings from %s\n", filename); 118 119 if( filename == NULL) filename = DEFAULT_KEYBIND_FILE;120 118 121 119 // remove old bindings if present … … 128 126 // create parser 129 127 IniParser parser (filename); 130 if( parser.getSection (" Bindings") == -1)128 if( parser.getSection ("player1") == -1) 131 129 { 132 130 PRINTF(1)("Could not find key bindings in %s\n", filename); -
orxonox/trunk/src/command_node.h
r3608 r4084 18 18 #define N_STD_KEYS SDLK_LAST 19 19 #define N_BUTTONS 6 20 #define DEFAULT_KEYBIND_FILE " default.ini"20 #define DEFAULT_KEYBIND_FILE "~/.orxonox/orxonox.conf" 21 21 22 22 //! Key aliasing structure -
orxonox/trunk/src/defs/debug.h
r3966 r4084 59 59 #define DEBUG_MODULE_PNODE 1 60 60 #define DEBUG_MODULE_WORLD_ENTITY 0 61 #define DEBUG_MODULE_COMMAND_NODE 061 #define DEBUG_MODULE_COMMAND_NODE 2 62 62 #define DEBUG_MODULE_GRAPHICS 0 63 63 #define DEBUG_MODULE_LOAD 0 -
orxonox/trunk/src/lib/util/ini_parser.cc
r4028 r4084 16 16 17 17 #include "ini_parser.h" 18 #include "resource_manager.h" 18 19 19 20 using namespace std; 20 21 21 22 /** 22 23 23 \brief constructs an IniParser using a file 24 \param filename: the path and name of the file to parse 24 25 */ 25 26 IniParser::IniParser (const char* filename) … … 31 32 32 33 /** 33 34 \brief removes the IniParser from memory 34 35 */ 35 36 IniParser::~IniParser () … … 45 46 int IniParser::openFile(const char* filename) 46 47 { 48 char* tmpName = ResourceManager::homeDirCheck(filename); 47 49 if( filename == NULL) return -1; 48 50 if( stream != NULL) fclose (stream); 49 if( (stream = fopen ( filename, "r")) == NULL)51 if( (stream = fopen (tmpName, "r")) == NULL) 50 52 { 51 printf("IniParser could not open %s\n", filename); 53 PRINTF(1)("IniParser could not open %s\n", filename); 54 delete tmpName; 52 55 return -1; 53 56 } 54 57 bInSection = false; 58 delete tmpName; 55 59 return 0; 56 60 } … … 123 127 return -1; 124 128 } 125 if( (ptr = strchr( linebuffer, '=')) != NULL) 129 sscanf(linebuffer, "%s = %s", name, value); 130 return 0; 131 /* 132 if( (ptr = strchr( tmpBuffer, '=')) != NULL) 126 133 { 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; 131 139 } 140 */ 132 141 } 133 142 return -1; -
orxonox/trunk/src/orxonox.cc
r4059 r4084 93 93 void Orxonox::getConfigFile (int argc, char** argv) 94 94 { 95 strcpy (configfilename, " orxonox.conf");95 strcpy (configfilename, "~/.orxonox/orxonox.conf"); 96 96 } 97 97 … … 152 152 { 153 153 // create localinput 154 localinput = new CommandNode( 154 localinput = new CommandNode(configfilename); 155 155 156 156 return 0;
Note: See TracChangeset
for help on using the changeset viewer.