home · contact · privacy
Make resize_active_win use yx_uint16 for coordinates instead of two separate ints.
[plomrogue] / src / roguelike.c
index 021bfe71e4abb51283c5823fb26136604f5a5b1d..0d1e96b60966338f4b5e7bba283cd4e64d49334d 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) {