home · contact · privacy
Removed redundancy between record_control() and player_control() by re-writing their...
[plomrogue] / src / map.c
index 16b2782bd3bff63d941bb03e2cc159eb9e4663a9..629e813a1d2089621d5d525330d824bbe201469a 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -5,18 +5,17 @@
 #include "yx_uint16.h"   /* for yx_uint16 and dir enums */
 #include "rrand.h"       /* for rrand() */
 #include "windows.h"     /* for struct Win */
-struct World;
 
 
 
-struct Map init_map(struct World * world)
+extern struct Map init_map()
 {
     char * f_name = "init_map()";
     struct Map map;
     map.size.x = 64;
     map.size.y = 64;
     uint32_t size = map.size.x * map.size.y;
-    map.cells = try_malloc(size, world, f_name);
+    map.cells = try_malloc(size, f_name);
     uint16_t y, x;
     for (y = 0; y < map.size.y; y++)
     {
@@ -54,13 +53,13 @@ struct Map init_map(struct World * world)
 
 
 
-void map_scroll(struct Win * win, struct yx_uint16 map_size, enum dir d)
+extern void map_scroll(struct Win * win, struct yx_uint16 map_size, enum dir d)
 {
     uint16_t offset;
-    if ((NORTH == d || SOUTH == d) && map_size.y > win->frame.size.y)
+    if ((NORTH == d || SOUTH == d) && map_size.y > win->framesize.y)
     {
-        offset = center_offset(win->center.y, map_size.y, win->frame.size.y);
-        win->center.y = offset + (win->frame.size.y / 2);
+        offset = center_offset(win->center.y, map_size.y, win->framesize.y);
+        win->center.y = offset + (win->framesize.y / 2);
         if      (NORTH == d && win->center.y > 0)
         {
             win->center.y--;
@@ -70,10 +69,10 @@ void map_scroll(struct Win * win, struct yx_uint16 map_size, enum dir d)
             win->center.y++;
         }
     }
-    else if ((WEST == d || EAST == d) && map_size.x > win->frame.size.x)
+    else if ((WEST == d || EAST == d) && map_size.x > win->framesize.x)
     {
-        offset = center_offset(win->center.x, map_size.x, win->frame.size.x);
-        win->center.x = offset + (win->frame.size.x / 2);
+        offset = center_offset(win->center.x, map_size.x, win->framesize.x);
+        win->center.x = offset + (win->framesize.x / 2);
         if      (WEST == d && win->center.x > 0)
         {
             win->center.x--;