diff srogue/mdport.c @ 121:e6c8652473fe

srogue: more compatibility improvements. Randomness now uses mdport, and xcrypt.c has been replaced with the rogue5 version. Super-Rogue now builds on MinGW.
author John "Elwin" Edwards
date Sat, 03 May 2014 10:31:30 -0700
parents d6b7c3fb37ea
children 600873555ec0
line wrap: on
line diff
--- a/srogue/mdport.c	Fri May 02 15:06:23 2014 -0700
+++ b/srogue/mdport.c	Sat May 03 10:31:30 2014 -0700
@@ -1567,3 +1567,27 @@
 	setgid(playgid);
 #endif
 }
+
+int
+md_random(void)
+{
+#if defined (HAVE_LRAND48)
+	return lrand48();
+#elif defined (HAVE_RANDOM)
+	return random();
+#else
+	return rand();
+#endif
+}
+
+void
+md_srandom(unsigned int seed)
+{
+#if defined (HAVE_SRAND48)
+	srand48(seed);
+#elif defined (HAVE_SRANDOM)
+	srandom(seed);
+#else
+	srand(seed);
+#endif
+}