summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2007-07-15 14:15:41 +0000
committerTim Angus <tim@ngus.net>2007-07-15 14:15:41 +0000
commitffbf946dd63dccf0d6b6553c8bc1c9da4d3c89b3 (patch)
tree62b48381afabceca4c2aad7c39e0eeb51e328126 /src/client
parent655d4c12eea45edf2041300eccace352a503b690 (diff)
* Merge of ioq3-r1112
Diffstat (limited to 'src/client')
-rw-r--r--src/client/cl_cgame.c2
-rw-r--r--src/client/cl_curl.c2
-rw-r--r--src/client/cl_keys.c107
-rw-r--r--src/client/cl_main.c3
-rw-r--r--src/client/cl_ui.c2
5 files changed, 73 insertions, 43 deletions
diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c
index b2fafe08..68b34c6b 100644
--- a/src/client/cl_cgame.c
+++ b/src/client/cl_cgame.c
@@ -775,7 +775,7 @@ void CL_InitCGame( void ) {
VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );
// reset any CVAR_CHEAT cvars registered by cgame
- if ( !cl_connectedToCheatServer )
+ if ( !clc.demoplaying && !cl_connectedToCheatServer )
Cvar_SetCheatState();
// we will send a usercmd this frame, which
diff --git a/src/client/cl_curl.c b/src/client/cl_curl.c
index 734cc306..9c5e3cc4 100644
--- a/src/client/cl_curl.c
+++ b/src/client/cl_curl.c
@@ -298,6 +298,8 @@ void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
CL_cURL_CallbackProgress);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
+ qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
+ qcurl_easy_setopt(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
clc.downloadCURLM = qcurl_multi_init();
if(!clc.downloadCURLM) {
qcurl_easy_cleanup(clc.downloadCURL);
diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c
index fe88526a..b283ffbc 100644
--- a/src/client/cl_keys.c
+++ b/src/client/cl_keys.c
@@ -1417,8 +1417,10 @@ void Key_SetCatcher( int catcher ) {
}
// This must not exceed MAX_CMD_LINE
-#define MAX_CONSOLE_SAVE_BUFFER 1024
-static char consoleSaveBuffer[ MAX_CONSOLE_SAVE_BUFFER ];
+#define MAX_CONSOLE_SAVE_BUFFER 1024
+#define CONSOLE_HISTORY_FILE "q3history"
+static char consoleSaveBuffer[ MAX_CONSOLE_SAVE_BUFFER ];
+static int consoleSaveBufferSize = 0;
/*
================
@@ -1429,51 +1431,63 @@ Load the console history from cl_consoleHistory
*/
void CL_LoadConsoleHistory( void )
{
- char *token, *text_p;
- int i, numChars, numLines = 0;
- cvar_t *cv;
+ char *token, *text_p;
+ int i, numChars, numLines = 0;
+ fileHandle_t f;
- cv = Cvar_Get( "cl_consoleHistory", "", CVAR_ARCHIVE|CVAR_ROM );
- Q_strncpyz( consoleSaveBuffer, cv->string, MAX_CONSOLE_SAVE_BUFFER );
-
- text_p = consoleSaveBuffer;
+ consoleSaveBufferSize = FS_FOpenFileRead( CONSOLE_HISTORY_FILE, &f, qfalse );
+ if( !f )
+ {
+ Com_Printf( "Couldn't read %s.\n", CONSOLE_HISTORY_FILE );
+ return;
+ }
- for( i = COMMAND_HISTORY - 1; i >= 0; i-- )
+ if( consoleSaveBufferSize <= MAX_CONSOLE_SAVE_BUFFER &&
+ FS_Read( consoleSaveBuffer, consoleSaveBufferSize, f ) == consoleSaveBufferSize )
{
- if( !*( token = COM_Parse( &text_p ) ) )
- break;
+ text_p = consoleSaveBuffer;
+
+ for( i = COMMAND_HISTORY - 1; i >= 0; i-- )
+ {
+ if( !*( token = COM_Parse( &text_p ) ) )
+ break;
- historyEditLines[ i ].cursor = atoi( token );
+ historyEditLines[ i ].cursor = atoi( token );
- if( !*( token = COM_Parse( &text_p ) ) )
- break;
+ if( !*( token = COM_Parse( &text_p ) ) )
+ break;
- historyEditLines[ i ].scroll = atoi( token );
+ historyEditLines[ i ].scroll = atoi( token );
- if( !*( token = COM_Parse( &text_p ) ) )
- break;
+ if( !*( token = COM_Parse( &text_p ) ) )
+ break;
- numChars = atoi( token );
- text_p++;
- if( numChars > ( strlen( consoleSaveBuffer ) - ( text_p - consoleSaveBuffer ) ) )
- {
- Com_DPrintf( S_COLOR_YELLOW "WARNING: probable corrupt history\n" );
- break;
+ numChars = atoi( token );
+ text_p++;
+ if( numChars > ( strlen( consoleSaveBuffer ) - ( text_p - consoleSaveBuffer ) ) )
+ {
+ Com_DPrintf( S_COLOR_YELLOW "WARNING: probable corrupt history\n" );
+ break;
+ }
+ Com_Memcpy( historyEditLines[ i ].buffer,
+ text_p, numChars );
+ historyEditLines[ i ].buffer[ numChars ] = '\0';
+ text_p += numChars;
+
+ numLines++;
}
- Com_Memcpy( historyEditLines[ i ].buffer,
- text_p, numChars );
- historyEditLines[ i ].buffer[ numChars ] = '\0';
- text_p += numChars;
- numLines++;
- }
+ memmove( &historyEditLines[ 0 ], &historyEditLines[ i + 1 ],
+ numLines * sizeof( field_t ) );
+ for( i = numLines; i < COMMAND_HISTORY; i++ )
+ Field_Clear( &historyEditLines[ i ] );
- memmove( &historyEditLines[ 0 ], &historyEditLines[ i + 1 ],
- numLines * sizeof( field_t ) );
- for( i = numLines; i < COMMAND_HISTORY; i++ )
- Field_Clear( &historyEditLines[ i ] );
+ historyLine = nextHistoryLine = numLines;
+ }
+ else
+ Com_Printf( "Couldn't read %s.\n", CONSOLE_HISTORY_FILE );
- historyLine = nextHistoryLine = numLines;
+ FS_FCloseFile( f );
}
/*
@@ -1486,8 +1500,9 @@ so that it persists across invocations of q3
*/
void CL_SaveConsoleHistory( void )
{
- int i;
- int lineLength, saveBufferLength, additionalLength;
+ int i;
+ int lineLength, saveBufferLength, additionalLength;
+ fileHandle_t f;
consoleSaveBuffer[ 0 ] = '\0';
@@ -1499,8 +1514,8 @@ void CL_SaveConsoleHistory( void )
lineLength = strlen( historyEditLines[ i ].buffer );
saveBufferLength = strlen( consoleSaveBuffer );
- //ICK "seta cl_consoleHistory " + "%d %d %d " = 23 + 13 = 36
- additionalLength = lineLength + 36;
+ //ICK
+ additionalLength = lineLength + strlen( "999 999 999 " );
if( saveBufferLength + additionalLength < MAX_CONSOLE_SAVE_BUFFER )
{
@@ -1518,5 +1533,17 @@ void CL_SaveConsoleHistory( void )
}
while( i != ( nextHistoryLine - 1 ) % COMMAND_HISTORY );
- Cvar_Set( "cl_consoleHistory", consoleSaveBuffer );
+ consoleSaveBufferSize = strlen( consoleSaveBuffer );
+
+ f = FS_FOpenFileWrite( CONSOLE_HISTORY_FILE );
+ if( !f )
+ {
+ Com_Printf( "Couldn't write %s.\n", CONSOLE_HISTORY_FILE );
+ return;
+ }
+
+ if( FS_Write( consoleSaveBuffer, consoleSaveBufferSize, f ) < consoleSaveBufferSize )
+ Com_Printf( "Couldn't write %s.\n", CONSOLE_HISTORY_FILE );
+
+ FS_FCloseFile( f );
}
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 2fe3151d..28d95739 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -509,7 +509,8 @@ void CL_PlayDemo_f( void ) {
}
// make sure a local server is killed
- Cvar_Set( "sv_killserver", "1" );
+ // 2 means don't force disconnect of local client
+ Cvar_Set( "sv_killserver", "2" );
CL_Disconnect( qtrue );
diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c
index 2ba7736a..6a4bb16f 100644
--- a/src/client/cl_ui.c
+++ b/src/client/cl_ui.c
@@ -1082,7 +1082,7 @@ void CL_InitUI( void ) {
}
// reset any CVAR_CHEAT cvars registered by ui
- if ( !cl_connectedToCheatServer )
+ if ( !clc.demoplaying && !cl_connectedToCheatServer )
Cvar_SetCheatState();
}