foxygit / doom Log in
commit 939bb4cf3e586643919d606620bf298f2351d735
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Tue Oct 24 19:23:16 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Tue Oct 24 19:23:16 2006 +0000

    Detect failures to initialise textscreen library and bomb out with an
    error mess
    age.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 727
---
 setup/mainmenu.c                 | 7 ++++++-
 src/net_gui.c                    | 7 ++++++-
 textscreen/examples/calculator.c | 7 ++++++-
 textscreen/examples/guitest.c    | 6 +++++-
 4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/setup/mainmenu.c b/setup/mainmenu.c
index 2b484418..612c649d 100644
--- a/setup/mainmenu.c
+++ b/setup/mainmenu.c
@@ -145,7 +145,12 @@ static void InitConfig(void)

 static void RunGUI(void)
 {
-    TXT_Init();
+    if (!TXT_Init())
+    {
+        fprintf(stderr, "Failed to initialise GUI\n");
+        exit(-1);
+    }
+
     TXT_SetDesktopTitle(PACKAGE_NAME " Setup ver " PACKAGE_VERSION);

     MainMenu();
diff --git a/src/net_gui.c b/src/net_gui.c
index 51ceb1f8..f322da15 100644
--- a/src/net_gui.c
+++ b/src/net_gui.c
@@ -223,7 +223,12 @@ static void CheckMD5Sums(void)

 void NET_WaitForStart(void)
 {
-    TXT_Init();
+    if (!TXT_Init())
+    {
+        fprintf(stderr, "Failed to initialise GUI\n");
+        exit(-1);
+    }
+
     I_SetWindowCaption();
     I_SetWindowIcon();

diff --git a/textscreen/examples/calculator.c b/textscreen/examples/calculator.c
index 968d3ef4..b8fefaa3 100644
--- a/textscreen/examples/calculator.c
+++ b/textscreen/examples/calculator.c
@@ -144,7 +144,12 @@ void BuildGUI()

 int main(int argc, char *argv[])
 {
-    TXT_Init();
+    if (!TXT_Init())
+    {
+        fprintf(stderr, "Failed to initialise GUI\n");
+        exit(-1);
+    }
+
     TXT_SetDesktopTitle("Calculator demo");

     BuildGUI();
diff --git a/textscreen/examples/guitest.c b/textscreen/examples/guitest.c
index e385ca84..94483236 100644
--- a/textscreen/examples/guitest.c
+++ b/textscreen/examples/guitest.c
@@ -159,7 +159,11 @@ void Window2(void)

 int main(int argc, char *argv[])
 {
-    TXT_Init();
+    if (!TXT_Init())
+    {
+        fprintf(stderr, "Failed to initialise GUI\n");
+        exit(-1);
+    }

     TXT_SetDesktopTitle("Not Chocolate Doom Setup");