summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-01-20 23:33:57 +0000
committerTim Angus <tim@ngus.net>2006-01-20 23:33:57 +0000
commitba69ac8d95b7a05fbaf12209785492e3500f1117 (patch)
tree9727b0251042509f5bdf2b76b8d28a568d1a0fdb
parent5b13e23b457831b881db4e80deb41fbf5d1190e1 (diff)
* Fixed a couple of subtle bugs in the tutorial system
-rw-r--r--src/cgame/cg_tutorial.c8
-rw-r--r--src/client/keycodes.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c
index f54786be..8439f34a 100644
--- a/src/cgame/cg_tutorial.c
+++ b/src/cgame/cg_tutorial.c
@@ -64,7 +64,7 @@ static void CG_GetBindings( void )
for( i = 0; i < numBindings; i++ )
{
- bindings[ i ].keys[ 0 ] = bindings[ i ].keys[ 1 ] = -1;
+ bindings[ i ].keys[ 0 ] = bindings[ i ].keys[ 1 ] = K_NONE;
numKeys = 0;
for( j = 0; j < K_LAST_KEY; j++ )
@@ -102,7 +102,7 @@ static const char *CG_KeyNameForCommand( const char *command )
{
if( !Q_stricmp( command, bindings[ i ].command ) )
{
- if( bindings[ i ].keys[ 0 ] >= 0 )
+ if( bindings[ i ].keys[ 0 ] != K_NONE )
{
trap_Key_KeynumToStringBuf( bindings[ i ].keys[ 0 ],
buffer, MAX_STRING_CHARS );
@@ -111,11 +111,11 @@ static const char *CG_KeyNameForCommand( const char *command )
for( j = 0; j < firstKeyLength; j++ )
buffer[ j ] = toupper( buffer[ j ] );
- if( bindings[ i ].keys[ 1 ] >= 0 )
+ if( bindings[ i ].keys[ 1 ] != K_NONE )
{
Q_strcat( buffer, MAX_STRING_CHARS, " or " );
trap_Key_KeynumToStringBuf( bindings[ i ].keys[ 1 ],
- buffer + strlen( buffer ), MAX_STRING_CHARS );
+ buffer + strlen( buffer ), MAX_STRING_CHARS - strlen( buffer ) );
for( j = firstKeyLength + 4; j < strlen( buffer ); j++ )
buffer[ j ] = toupper( buffer[ j ] );
diff --git a/src/client/keycodes.h b/src/client/keycodes.h
index 090fb40a..69abb9f6 100644
--- a/src/client/keycodes.h
+++ b/src/client/keycodes.h
@@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// normal keys should be passed as lowercased ascii
typedef enum {
+ K_NONE = -1,
K_TAB = 9,
K_ENTER = 13,
K_ESCAPE = 27,