The final, very, very last piece of code we are going to change will allow us to remain in the program after we exit a game. Previously, when we exited a game using the Escape key, the program quit. This final change tidies that up for us. Open the file C:\koob\control\ client\misc\presetkeys.cs and locate the function DoExitGame() and change it to match the following:
function DoExitGame() { if ( $Server::ServerType $= "SinglePlayer" ) MessageBoxYesNo( "Exit Mission", "Exit?", "disconnect();", ""); else MessageBoxYesNo( "Disconnect", "Disconnect?", "disconnect();", ""); }
This function now checks to see if we are in single- or multiplayer mode. It does this to provide a customized exit prompt depending on which mode it is. In any event, the disconnect function is called to break the connection with the game server.