home · contact · privacy
Removed library dependencies made obsolete by last commit.
[plomrogue] / src / roguelike.c
index 021bfe71e4abb51283c5823fb26136604f5a5b1d..d21238852ce7b189b725b4d24a25873830e70b92 100644 (file)
@@ -1,3 +1,4 @@
+#include "roguelike.h"
 #include <stdlib.h>
 #include <stdint.h>
 #include <ncurses.h>
@@ -6,7 +7,6 @@
 #include <unistd.h>
 #include "windows.h"
 #include "draw_wins.h"
-#include "roguelike.h"
 #include "keybindings.h"
 #include "readwrite.h"
 #include "actors.h"
@@ -110,17 +110,12 @@ void scroll_pad (struct WinMeta * win_meta, char dir) {
 void growshrink_active_window (struct WinMeta * win_meta, char change) {
 // Grow or shrink active window horizontally or vertically by one cell size.
   if (0 != win_meta->active) {
-    uint16_t height = win_meta->active->frame.size.y;
-    uint16_t width = win_meta->active->frame.size.x;
-    if      (change == '-')
-      height--;
-    else if (change == '+')
-      height++;
-    else if (change == '_')
-      width--;
-    else if (change == '*')
-      width++;
-    resize_active_win (win_meta, height, width); } }
+    struct yx_uint16 size = win_meta->active->frame.size;
+    if      (change == '-') size.y--;
+    else if (change == '+') size.y++;
+    else if (change == '_') size.x--;
+    else if (change == '*') size.x++;
+    resize_active_win (win_meta, size); } }
 
 unsigned char meta_keys(int key, struct World * world, struct WinMeta * win_meta, struct Win * win_keys,
                         struct Win * win_map, struct Win * win_info, struct Win * win_log) {
@@ -242,12 +237,12 @@ int main (int argc, char *argv[]) {
   struct Map map = init_map();
   world.map = &map;
   if (1 == world.turn) {
-    for (player.pos.y = player.pos.x = 0; 0 == is_passable(&map, player.pos.y, player.pos.x);) {
+    for (player.pos.y = player.pos.x = 0; 0 == is_passable(&map, player.pos);) {
       player.pos.y = rrand(0, 0) % map.size.y;
       player.pos.x = rrand(0, 0) % map.size.x; }
     struct Monster * monster;
     for (monster = world.monster; monster != 0; monster = monster->next)
-      for (monster->pos.y = monster->pos.x = 0; 0 == is_passable(&map, monster->pos.y, monster->pos.x);) {
+      for (monster->pos.y = monster->pos.x = 0; 0 == is_passable(&map, monster->pos);) {
         monster->pos.y = rrand(0, 0) % map.size.y;
         monster->pos.x = rrand(0, 0) % map.size.x; } }