Maelstrom: Remove the game from the global server if we stop hosting it.

https://github.com/libsdl-org/Maelstrom/commit/4afbc1e59a0c6cab20ed56736c12bb18200a3305

From 4afbc1e59a0c6cab20ed56736c12bb18200a3305 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 6 Nov 2011 12:03:08 -0500
Subject: [PATCH] Remove the game from the global server if we stop hosting it.

---
 netlogic/lobby.cpp | 4 ++++
 netlogic/lobby.h   | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/netlogic/lobby.cpp b/netlogic/lobby.cpp
index 9d1dadb6..959b5e3d 100644
--- a/netlogic/lobby.cpp
+++ b/netlogic/lobby.cpp
@@ -144,6 +144,7 @@ LobbyDialogDelegate::OnHide()
 {
 	// Start the game!
 	if (m_dialog->GetDialogStatus() > 0) {
+		SetState(STATE_PLAYING);
 		for (int i = 0; i < MAX_PLAYERS; ++i) {
 			GameInfoPlayer *player = m_game.GetPlayer(i);
 			if (player->playerID) {
@@ -283,6 +284,9 @@ void
 LobbyDialogDelegate::SetState(LOBBY_STATE state)
 {
 	// Handle any state transitions here
+	if (m_state == STATE_HOSTING && m_globalGame->IsChecked()) {
+		RemoveGame();
+	}
 	if (state == STATE_NONE) {
 		if (m_state == STATE_HOSTING) {
 			// Notify the players that the game is gone
diff --git a/netlogic/lobby.h b/netlogic/lobby.h
index a33a5a52..877bc346 100644
--- a/netlogic/lobby.h
+++ b/netlogic/lobby.h
@@ -89,7 +89,8 @@ class LobbyDialogDelegate : public UIDialogDelegate
 		STATE_HOSTING,
 		STATE_LISTING,
 		STATE_JOINING,
-		STATE_JOINED
+		STATE_JOINED,
+		STATE_PLAYING
 	} m_state;
 
 	Uint32 m_uniqueID;