home · contact · privacy
In shift_active_win() slightly improved formatting and solved a "why is this needed...
[plomrogue] / src / misc.c
index a8918a9ccdfdc76a1899226298823b4fbacbfd43..6ac01c7a5b499b977a6f20e604ac2b5adb28aeea 100644 (file)
@@ -4,17 +4,20 @@
 #include <stdlib.h> /* for exit(), EXIT_SUCCESS define, calloc(), free() */
 #include <string.h> /* for strlen(), strcmp(), memcpy() */
 #include <ncurses.h> /* for endwin() */
-#include "windows.h" /* for suspend_win(), append_win(), reset_pad_offset(), */
-                     /* resize_active_win(), cycle_active_win(),             */
-                     /* shift_active_win(), struct Win, struct WinMeta       */
-#include "keybindings.h" /* for get_action_key(), save_keybindings(),  */
-                         /* keyswin_move_selection(), keyswin_mod_key() */
-#include "readwrite.h" /* for write_uint16_bigendian() */
-                       /* write_uint32_bigendian()     */
-#include "map_objects.h" /* for struct Monster, write_map_objects(), */
-                         /* write_map_objects_monsterdata()          */
+#include "windows.h" /* for suspend_win(), append_win(), reset_pad_offset(),
+                      * resize_active_win(), cycle_active_win(),
+                      * shift_active_win(), struct Win, struct WinMeta
+                      */
+#include "keybindings.h" /* for get_action_key(), save_keybindings(),
+                          * keyswin_move_selection(), keyswin_mod_key()
+                          */
+#include "readwrite.h" /* for write_uint16_bigendian(), write_uint32_bigendian()
+                        */
+#include "map_objects.h" /* for struct Monster, write_map_objects(),
+                          * write_map_objects_monsterdata()
+                          */
 #include "map_object_actions.h" /* for is_passable(), move_monster() */
-#include "map.h" /* for map_scroll()/map_center_player(), Map struct, dir enum */
+#include "map.h" /* for map_scroll(),map_center_player(), Map struct,dir enum */
 #include "main.h" /* for World struct */
 #include "yx_uint16.h" /* for yx_uint16 */
 
@@ -82,9 +85,8 @@ extern uint16_t rrand(char use_seed, uint32_t new_seed)
     /* Constants as recommended by POSIX.1-2001 (see man page rand(3)). */
     seed = ((seed * 1103515245) + 12345) % 2147483648;
 
-    return (seed / 65536);    /* TODO: Use bit-shifting for ignoring the less */
-}                             /* random least significant 16 bits.            */
-
+    return (seed >> 16);     /* Ignore less random least significant 16 bits. */
+}
 
 
 extern void update_log(struct World * world, char * text)