about summary refs log tree commit diff
path: root/src/engine
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-12-11 22:04:50 +0100
committeroy <Tom_Adams@web.de>2010-12-11 22:04:50 +0100
commitecd7afd9ffe8f764cf8fbc6f01aeef55b9e2aa7f (patch)
tree09ad68dae4a82ceabdd19b13eea3b5163b304122 /src/engine
parenteb569e60bd98bc044b9cda8b11ffbe25b30382a2 (diff)
downloadzcatch-ecd7afd9ffe8f764cf8fbc6f01aeef55b9e2aa7f.tar.gz
zcatch-ecd7afd9ffe8f764cf8fbc6f01aeef55b9e2aa7f.zip
added cleaner exit on quit event by Choupom
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/client/client.cpp3
-rw-r--r--src/engine/client/input.cpp8
-rw-r--r--src/engine/client/input.h2
-rw-r--r--src/engine/input.h2
4 files changed, 8 insertions, 7 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index ac15d128..82e79a85 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -1856,7 +1856,8 @@ void CClient::Run()
 		}
 
 		// update input
-		Input()->Update();
+		if(Input()->Update())
+			break;	// SDL_QUIT
 
 		// update sound
 		Sound()->Update();
diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp
index 3bb04448..5cd58342 100644
--- a/src/engine/client/input.cpp
+++ b/src/engine/client/input.cpp
@@ -108,7 +108,7 @@ int CInput::KeyState(int Key)
 	return m_aInputState[m_InputCurrent][Key];
 }
 
-void CInput::Update()
+int CInput::Update()
 {
 	if(m_InputGrabbed && !Graphics()->WindowActive())
 		MouseModeAbsolute();
@@ -185,9 +185,7 @@ void CInput::Update()
 
 				// other messages
 				case SDL_QUIT:
-					// TODO: cleaner exit
-					exit(0); // ignore_convention
-					break;
+					return 1;
 			}
 
 			//
@@ -201,6 +199,8 @@ void CInput::Update()
 
 		}
 	}
+
+	return 0;
 }
 
 
diff --git a/src/engine/client/input.h b/src/engine/client/input.h
index 77fa5447..34f880f7 100644
--- a/src/engine/client/input.h
+++ b/src/engine/client/input.h
@@ -31,7 +31,7 @@ public:
 
 	int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; }
 
-	virtual void Update();
+	virtual int Update();
 };
 
 #endif
diff --git a/src/engine/input.h b/src/engine/input.h
index 7e59669d..aa9be78f 100644
--- a/src/engine/input.h
+++ b/src/engine/input.h
@@ -83,7 +83,7 @@ class IEngineInput : public IInput
 	MACRO_INTERFACE("engineinput", 0)
 public:
 	virtual void Init() = 0;
-	virtual void Update() = 0;
+	virtual int Update() = 0;
 };
 
 extern IEngineInput *CreateEngineInput();