From 752b7f859c7e66d824a98ce45224b477a0d689c2 Mon Sep 17 00:00:00 2001
From: nehalmistry <>
Date: Sat, 15 Feb 2003 17:58:46 +0000
Subject: [PATCH] write correct cdmode to preferences

---
 src/stratagus/script.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/stratagus/script.cpp b/src/stratagus/script.cpp
index 9879ee649..578d2c137 100644
--- a/src/stratagus/script.cpp
+++ b/src/stratagus/script.cpp
@@ -904,7 +904,23 @@ global void SavePreferences(void)
     }
     fprintf(fd,"(set-music-volume! %d)\n", MusicVolume);
 #if defined(USE_SDLCD) || defined(USE_LIBCDA) || defined(USE_CDDA)
-    fprintf(fd,"(set-cd-mode! \"%d\")\n", CDMode);
+    buf[0] = '\0';
+    switch (CDMode) {
+	case CDModeAll:
+	    strcpy(buf, "all");
+	    break;
+	case CDModeRandom:
+	    strcpy(buf, "random");
+	    break;
+	case CDModeDefined:
+	    strcpy(buf, "defined");
+	    break;
+	default:
+	    break;
+    }
+    if (buf[0]) {
+	fprintf(fd,"(set-cd-mode! \"%s\")\n", buf);
+    }
 #endif
 #endif