home · contact · privacy
Use new startx attribute of Win struct instead of getbegx on respective curses window.
[plomrogue] / roguelike.c
index 894fa59095a6c071c6b2b08ccb17b5f0763dffed..f648e00cd769369adf21cb35aaaca107f1ca1596 100644 (file)
@@ -72,6 +72,13 @@ void toggle_window (struct WinMeta * win_meta, struct Win * win) {
   else
     append_window(win_meta, win); }
 
+void scroll_pad (struct WinMeta * win_meta, char dir) {
+// Try to scroll pad left or right.
+  if      ('+' == dir)
+    reset_pad_offset(win_meta, win_meta->pad_offset + 1);
+  else if ('-' == dir)
+    reset_pad_offset(win_meta, win_meta->pad_offset - 1); }
+
 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) {
@@ -109,9 +116,9 @@ struct Map init_map () {
     curpos = y * map.width + x;
     if ('~' == map.cells[curpos] &&
         (   (curpos >= map.width && '.' == map.cells[curpos - map.width])
-         || (curpos < map.width * (map.height - 1) && '.' == map.cells[curpos + map.width])
-         || (curpos > 0 && '.' == map.cells[curpos - 1] && curpos % map.width != 0)
-         || (curpos < (map.width * map.height) && '.' == map.cells[curpos + 1] && (curpos + 1) % map.width != 0)))
+         || (curpos < map.width * (map.height-1) && '.' == map.cells[curpos + map.width])
+         || (curpos > 0 && curpos % map.width != 0 && '.' == map.cells[curpos-1])
+         || (curpos < (map.width * map.height) && (curpos+1) % map.width != 0 && '.' == map.cells[curpos+1])))
       map.cells[y * map.width + x] = '.'; }
   return map; }
 
@@ -348,7 +355,7 @@ int main (int argc, char *argv[]) {
   toggle_window(&win_meta, &win_log);
 
   int key;
-  unsigned char quit_called;
+  unsigned char quit_called = 0;
   if (0 == world.interactive) {
     unsigned char still_reading_file = 1;
     int action;