Maelstrom: Save the hosting control preferences whenever we leave the hosting state.

https://github.com/libsdl-org/Maelstrom/commit/d83a2428f55108a72b1964552a05d23b7314eb7a

From d83a2428f55108a72b1964552a05d23b7314eb7a Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 23 Nov 2011 22:44:50 -0500
Subject: [PATCH] Save the hosting control preferences whenever we leave the
 hosting state.

---
 game/lobby.cpp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/game/lobby.cpp b/game/lobby.cpp
index 59f429fd..dbe21b22 100644
--- a/game/lobby.cpp
+++ b/game/lobby.cpp
@@ -406,20 +406,22 @@ LobbyDialogDelegate::SetState(LOBBY_STATE state)
 	if (m_state == STATE_HOSTING && m_globalGame->IsChecked()) {
 		RemoveGame();
 	}
+	if (m_state == STATE_HOSTING) {
+		// Save the control preferences
+		for (i = 0; i < MAX_PLAYERS; ++i) {
+			char name[128];
+			SDL_snprintf(name, sizeof(name), "Player%d.Controls", i+1);
+			prefs->SetNumber(name, m_game.GetPlayer(i)->controlMask);
+		}
+		prefs->Save();
+	}
+
 	if (state == STATE_NONE) {
 		if (m_state == STATE_HOSTING) {
 			// Notify the players that the game is gone
 			for (i = 0; i < m_game.GetNumNodes(); ++i) {
 				SendKick(i);
 			}
-
-			// Save the control preferences
-			for (i = 0; i < MAX_PLAYERS; ++i) {
-				char name[128];
-				SDL_snprintf(name, sizeof(name), "Player%d.Controls", i+1);
-				prefs->SetNumber(name, m_game.GetPlayer(i)->controlMask);
-			}
-			prefs->Save();
 		} else if (m_state == STATE_JOINING ||
 			   m_state == STATE_JOINED) {
 			// Notify the host that we're gone