From a26bdf170cc1a9fb27cccc3bc8efb30648d71688 Mon Sep 17 00:00:00 2001
From: nehalmistry <>
Date: Sun, 7 Apr 2002 05:12:36 +0000
Subject: [PATCH] Give an error message if freecraft compiled without CD Audio
 and user tries to enable it through options.

---
 src/include/menus.h |  3 ++-
 src/ui/menus.cpp    | 30 +++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/include/menus.h b/src/include/menus.h
index 18abe938a..9c6654e27 100644
--- a/src/include/menus.h
+++ b/src/include/menus.h
@@ -225,7 +225,8 @@ typedef struct _menus_ {
 #define MENU_OBJECTIVES 14
 #define MENU_END_SCENARIO 15
 #define MENU_GAME_OPTIONS 16
-#define MENU_MAX 16			/// highest available menu id (for ccl)
+#define MENU_CDROM_DISABLED 17
+#define MENU_MAX 17			/// highest available menu id (for ccl)
 
 /// FIXME: FILL IN THIS TABLE!!!!
 
diff --git a/src/ui/menus.cpp b/src/ui/menus.cpp
index 2dac40b67..43b506464 100644
--- a/src/ui/menus.cpp
+++ b/src/ui/menus.cpp
@@ -78,6 +78,7 @@ local void GameMenuObjectives(void);
 local void GameMenuEndScenario(void);
 local void GameOptions(void);
 local void SetCdMode(Menuitem *mi);
+local void CDRomDisabled(void);
 
 local void EndScenarioRestart(void);
 local void EndScenarioSurrender(void);
@@ -320,6 +321,20 @@ local Menuitem EndScenarioMenuItems[] = {
 #endif
 };
 
+local Menuitem CDRomDisabledMenuItems[] = {
+#ifdef __GNUC__
+    { MI_TYPE_TEXT, 144, 10, 0, LargeFont, NULL, NULL,
+	{ text:{ "Sorry, this version of", MI_TFLAGS_CENTERED} } },
+    { MI_TYPE_TEXT, 144, 30, 0, LargeFont, NULL, NULL,
+	{ text:{ "freecraft was not compiled", MI_TFLAGS_CENTERED} } },
+    { MI_TYPE_TEXT, 144, 50, 0, LargeFont, NULL, NULL,
+	{ text:{ "with CD Audio support", MI_TFLAGS_CENTERED} } },
+    { MI_TYPE_BUTTON, 32, 90, MenuButtonSelected, LargeFont, NULL, NULL,
+	{ button:{ "~!OK", 224, 27, MBUTTON_GM_FULL, EndMenu, 'o'} } },
+#else
+    { 0 }
+#endif
+};
 
 /**
 **	Items for the SelectScen Menu
@@ -959,6 +974,16 @@ global Menu Menus[] = {
 	GameOptionsMenuItems,
 	NULL,
     },
+    {
+    	// CDRom Disabled Message
+	176+(14*TileSizeX-288)/2,
+	16+(14*TileSizeY-128)/2,
+	288, 128,
+	ImagePanel4,
+	0, 4,
+	CDRomDisabledMenuItems,
+	NULL,
+    },
 };
 
 /*----------------------------------------------------------------------------
@@ -1488,7 +1513,7 @@ local void GameOptions(void)
 {
     // TODO
 #if !defined(USE_SDLCD) && !defined(USE_LIBCDA)
-    GameOptionsMenuItems[1].d.gem.state = 1;
+    GameOptionsMenuItems[1].d.gem.state = 0;
 #else
     if (strcmp(":off", CDMode))
 	GameOptionsMenuItems[1].d.gem.state = 4;
@@ -1515,6 +1540,9 @@ local void SetCdMode(Menuitem *mi)
 
 	CDMode = ":off";
     }
+#else
+    ProcessMenu(MENU_CDROM_DISABLED, 1);
+    GameOptionsMenuItems[1].d.gem.state = 0;
 #endif
 }