/** * Both client and server can use this, and it will * do the appropriate things. */ void Com_Quit (void) { #ifdef DEDICATED_ONLY Com_WriteConfigToFile("dedconfig.cfg"); #else Com_WriteConfigToFile("config.cfg"); #endif SV_Shutdown("Server quit.", false); SV_Clear(); CL_Shutdown(); /* send an receive net messages a last time */ NET_Wait(0); FS_CloseFile(&logfile); if (pipefile.f != nullptr) { FS_CloseFile(&pipefile); FS_RemoveFile(va("%s/%s", FS_Gamedir(), pipefile.name)); } Sys_Quit(); }
/* =============== Com_WriteConfig_f Write the config file to a specific name =============== */ void Com_WriteConfig_f( void ) { char filename[MAX_QPATH]; if ( Cmd_Argc() != 2 ) { Com_Printf( "Usage: writeconfig <filename>\n" ); return; } Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) ); COM_DefaultExtension( filename, sizeof( filename ), ".cfg" ); Com_Printf( "Writing %s.\n", filename ); Com_WriteConfigToFile( filename ); }
/* =============== Com_WriteConfiguration Writes key bindings and archived cvars to config file if modified =============== */ void Com_WriteConfiguration( void ) { // if we are quiting without fully initializing, make sure // we don't write out anything if ( !com_fullyInitialized ) { return; } if ( !(cvar_modifiedFlags & CVAR_ARCHIVE ) ) { return; } cvar_modifiedFlags &= ~CVAR_ARCHIVE; Com_WriteConfigToFile( Q3CONFIG_NAME ); }
static BOOL CALLBACK RBFProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: SetDlgItemInt(hwndDlg, IDC_RBF_WIDTH, rbfg_DefaultWidth.GetInteger(), FALSE); SetDlgItemInt(hwndDlg, IDC_RBF_HEIGHT, rbfg_DefaultHeight.GetInteger(), FALSE); SetDlgItemText(hwndDlg, IDC_RBF_FILENAME, RBFName); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { int width, height; width = GetDlgItemInt(hwndDlg, IDC_RBF_WIDTH, 0, FALSE); height = GetDlgItemInt(hwndDlg, IDC_RBF_HEIGHT, 0, FALSE); rbfg_DefaultWidth.SetInteger( width ); rbfg_DefaultHeight.SetInteger( height ); Com_WriteConfigToFile( CONFIG_FILE ); if (!CheckPow2(width) || !CheckPow2(height)) { return TRUE; } DestroyWindow(hwndDlg); cmdSystem->BufferCommandText( CMD_EXEC_APPEND, va("renderbumpflat -size %d %d %s\n", width, height, RBFName.c_str() ) ); return TRUE; } case IDCANCEL: DestroyWindow(hwndDlg); return TRUE; } } return FALSE; }
/* =============== Com_WriteConfig_f Write the config file to a specific name =============== */ void Com_WriteConfig_f( void ) { char filename[MAX_QPATH]; if ( Cmd_Argc() != 2 ) { Com_Printf( "Usage: writeconfig <filename>\n" ); return; } Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) ); COM_DefaultExtension( filename, sizeof( filename ), ".cfg" ); if(!COM_CompareExtension(filename, ".cfg")) { Com_Printf( "Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n" ); return; } Com_Printf( "Writing %s.\n", filename ); Com_WriteConfigToFile( filename ); }