Changeset 2105 in orxonox.OLD for orxonox/branches/chris/src/command_node.cc
- Timestamp:
- Jul 11, 2004, 3:14:52 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/chris/src/command_node.cc
r2100 r2105 22 22 #include <stdio.h> 23 23 #include <strings.h> 24 #include <stdlib.h> 24 25 25 26 using namespace std; … … 52 53 FILE* stream; 53 54 55 printf("Loading key bindings from %s\n", filename); 56 54 57 if( filename == NULL) filename = DEFAULT_KEYBIND_FILE; 55 58 … … 73 76 char namebuf[256]; 74 77 char valuebuf[256]; 78 memset (namebuf, 0, 256); 79 memset (valuebuf, 0, 256); 75 80 int* index; 76 81 … … 81 86 { 82 87 case 0: 88 printf("Key binding %d(%s) set to %s\n", index[1], SDLK_to_keyname( index[1]), valuebuf); 83 89 strcpy (aliases->keys[index[1]], valuebuf); 84 90 break; 85 91 case 1: 92 printf("Button binding %d(%s) set to %s\n", index[1], SDLB_to_buttonname( index[1]), valuebuf); 86 93 strcpy (aliases->buttons[index[1]], valuebuf); 87 94 break; … … 89 96 break; 90 97 } 98 memset (namebuf, 0, 256); 99 memset (valuebuf, 0, 256); 91 100 } 92 101 } … … 105 114 { 106 115 coord[0] = -1; 107 if( (coord[1] = keyname_to_SDLK (name)) != -1) coord[0] = 0; 108 if( (coord[1] = buttonname_to_SDLB (name)) != -1) coord[0] = 1; 116 coord[1] = -1; 117 int c; 118 if( (c = keyname_to_SDLK (name)) != -1) 119 { 120 coord[1] = c; 121 coord[0] = 0; 122 } 123 if( (c = buttonname_to_SDLB (name)) != -1) 124 { 125 coord[1] = c; 126 coord[0] = 1; 127 } 109 128 return coord; 110 129 } … … 112 131 void CommandNode::process () 113 132 { 133 perror("CommandNode|process()"); 114 134 if( bLocalInput) process_local (); 115 135 else process_network (); … … 123 143 while( SDL_PollEvent (&event)) 124 144 { 145 memset (cmd.cmd, 0, CMD_LENGHT); 125 146 switch( event.type) 126 147 { … … 173 194 void CommandNode::relay (Command* cmd) 174 195 { 196 perror("CommandNode|relay()"); 175 197 List<WorldEntity>* plist = bound; 176 198 199 Orxonox *orx = Orxonox::getInstance(); 200 if( orx->system_command (cmd)) return; 201 177 202 if( bLocalInput) send_over_network (cmd); 178 203
Note: See TracChangeset
for help on using the changeset viewer.