Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2005, 11:27:40 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/movie_player: merged the trunk back into the movie_player
merged with command:
svn merge -r 4014:HEAD ../trunk/ movie_player/
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/movie_player/src/command_node.cc

    r3654 r4217  
    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)
    131     {
    132       PRINTF(1)("Could not find key bindings in %s\n", filename);
     128  if( parser.getSection (CONFIG_SECTION_PLAYER "1") == -1)
     129    {
     130      PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1 in %s\n", filename);
    133131      return;
    134132    }
     
    144142  while( parser.nextVar (namebuf, valuebuf) != -1)
    145143    {
    146       index = nameToIndex (namebuf);
     144      index = nameToIndex (valuebuf);
    147145      switch( index[0])
    148146        {
    149147        case 0:
    150           PRINTF(4)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), valuebuf);
    151           strcpy (aliases->keys[index[1]], valuebuf);
     148          PRINTF(4)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), namebuf);
     149          strcpy (aliases->keys[index[1]], namebuf);
    152150          break;
    153151        case 1:
    154           PRINTF(4)("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), valuebuf);
    155           strcpy (aliases->buttons[index[1]], valuebuf);
     152          PRINTF(4)("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), namebuf);
     153          strcpy (aliases->buttons[index[1]], namebuf);
    156154          break;
    157155        default:
     
    161159      memset (valuebuf, 0, 256);
    162160    }
     161
     162
     163  // PARSE MISC SECTION
     164  if( parser.getSection (CONFIG_SECTION_MISC_KEYS) == -1)
     165    {
     166      PRINTF(1)("Could not find key bindings in %s\n", filename);
     167      return;
     168    }
     169
     170  while( parser.nextVar (namebuf, valuebuf) != -1)
     171    {
     172      index = nameToIndex (valuebuf);
     173      switch( index[0])
     174        {
     175        case 0:
     176          PRINTF(4)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), namebuf);
     177          strcpy (aliases->keys[index[1]], namebuf);
     178          break;
     179        case 1:
     180          PRINTF(4)("Button binding %d(%s) set to %s\n", index[1], SDLBToButtonname( index[1]), namebuf);
     181          strcpy (aliases->buttons[index[1]], namebuf);
     182          break;
     183        default:
     184          break;
     185        }
     186      memset (namebuf, 0, 256);
     187      memset (valuebuf, 0, 256);
     188    }
     189
    163190}
    164191
Note: See TracChangeset for help on using the changeset viewer.