oops, here is the patch

-- 
Jindrich Makovicka
diff -ur openttd-1.0.0-RC1.orig/src/driver.h openttd-1.0.0~rc1/src/driver.h
--- openttd-1.0.0-RC1.orig/src/driver.h	2010-01-15 17:41:15.000000000 +0100
+++ openttd-1.0.0~rc1/src/driver.h	2010-02-20 09:44:59.344586485 +0100
@@ -30,8 +30,8 @@
 
 	enum Type {
 		DT_BEGIN = 0,
-		DT_SOUND = 0,
-		DT_MUSIC,
+		DT_MUSIC = 0,
+		DT_SOUND,
 		DT_VIDEO,
 		DT_END,
 	};
@@ -64,7 +64,7 @@
 
 	static const char *GetDriverTypeName(Driver::Type type)
 	{
-		static const char * const driver_type_name[] = { "sound", "music", "video" };
+		static const char * const driver_type_name[] = { "music", "sound", "video" };
 		return driver_type_name[type];
 	}
 
diff -ur openttd-1.0.0-RC1.orig/src/music/extmidi.cpp openttd-1.0.0~rc1/src/music/extmidi.cpp
--- openttd-1.0.0-RC1.orig/src/music/extmidi.cpp	2010-01-15 17:41:15.000000000 +0100
+++ openttd-1.0.0~rc1/src/music/extmidi.cpp	2010-02-20 02:00:52.000000000 +0100
@@ -50,7 +50,20 @@
 {
 	free(command);
 	this->song[0] = '\0';
-	this->DoStop();
+	if (this->pid > 0) {
+		int i;
+		for (i = 0; i < 5; i++) {
+			kill(this->pid, SIGTERM);
+			if (waitpid(this->pid, NULL, WNOHANG) == this->pid) {
+				this->pid = -1;
+				return;
+			}
+			sleep(1);
+		}
+		kill(this->pid, SIGKILL);
+		waitpid(this->pid, NULL, 0);
+		this->pid = -1;
+	}
 }
 
 void MusicDriver_ExtMidi::PlaySong(const char *filename)

Reply via email to