rnd-19981120-1
[rocksndiamonds.git] / src / misc.c
index 8c88fe2930ff054b8a7721df85b53bdc9eddcd53..2c01f36401e0e7eed881a71f23b5e1f4ab2baa3e 100644 (file)
@@ -18,6 +18,7 @@
 #include <sys/param.h>
 #include <sys/types.h>
 #include <stdarg.h>
+#include <ctype.h>
 
 #include "misc.h"
 #include "init.h"
@@ -158,9 +159,22 @@ unsigned int SimpleRND(unsigned int max)
   return (root % max);
 }
 
+#ifdef DEBUG
+static unsigned int last_RND_value = 0;
+
+unsigned int last_RND()
+{
+  return last_RND_value;
+}
+#endif
+
 unsigned int RND(unsigned int max)
 {
+#ifdef DEBUG
+  return (last_RND_value = random_linux_libc() % max);
+#else
   return (random_linux_libc() % max);
+#endif
 }
 
 unsigned int InitRND(long seed)
@@ -226,6 +240,17 @@ char *getStringCopy(char *s)
   return s_copy;
 }
 
+char *getStringToLower(char *s)
+{
+  char *s_copy = checked_malloc(strlen(s) + 1);
+  char *s_ptr = s_copy;
+
+  while (*s)
+    *s_ptr++ = tolower(*s++);
+
+  return s_copy;
+}
+
 void MarkTileDirty(int x, int y)
 {
   int xx = redraw_x1 + x;