-#include <stdint.h> /* for uint8_t */
-#include "windows.h" /* for suspend_win(), append_win(), reset_pad_offset(),
- * resize_active_win(), struct Win, struct WinMeta
- */
-#include "readwrite.h" /* for [read/write]_uint[8/16/32][_bigendian]() */
-#include "map_objects.h" /* for struct Monster, write_map_objects(), */
-#include "map_object_actions.h" /* for is_passable(), move_monster() */
-#include "map.h" /* for Map struct */
-#include "main.h" /* for World struct */
-#include "yx_uint16.h" /* for yx_uint16 */
-#include "rrand.h" /* for rrand(), rrand_seed() */
-#include "rexit.h" /* for exit_err() */
-
-
-extern void textfile_sizes(FILE * file, uint16_t * linemax_p,
- uint16_t * n_lines_p)
+#include <stdint.h> /* for uint8_t, uint16_t, uint32_t */
+#include "readwrite.h" /* for [read/write]_uint[8/16/32][_bigendian](),
+ * try_fopen(), try_fclose(), get_linemax()
+ */
+#include "map_objects.h" /* for struct MapObj, get_player(), read_map_objects(),
+ * write_map_objects()
+ */
+#include "map_object_actions.h" /* for struct MapObjAct */
+#include "ai.h" /* for pretty_dumb_ai() */
+#include "map.h" /* for Map struct, is_passable() */
+#include "main.h" /* for world global */
+#include "yx_uint16.h" /* for yx_uint16 struct */
+#include "rexit.h" /* for exit_err(), exit_trouble() */
+#include "wincontrol.h" /* for init_winconfs(), init_wins(), free_winconfs(),
+ * sorted_wintoggle_and_activate()
+ */
+#include "windows.h" /* for suspend_win() */
+#include "command_db.h" /* for is_command_id_shortdsc() */
+
+
+
+extern uint16_t rrand()
+{
+ /* Constants as recommended by POSIX.1-2001 (see man page rand(3)). */
+ world.seed = ((world.seed * 1103515245) + 12345) % 4294967296;
+ return (world.seed >> 16); /* Ignore less random least significant bits. */
+}
+
+
+
+extern void * try_malloc(size_t size, char * f)
+{
+ void * p = malloc(size);
+ exit_trouble(NULL == p, f, "malloc()");
+ return p;
+}
+
+
+
+extern void * try_calloc(size_t size1, size_t size2, char * f)