From 018565cc4592702368c948c579bcca3f35d5ca04 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 8 Jun 2013 00:30:50 +0200
Subject: [PATCH] Corrected what valgrind complains about.

---
 roguelike.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/roguelike.c b/roguelike.c
index 894fa59..6ae5243 100644
--- a/roguelike.c
+++ b/roguelike.c
@@ -109,9 +109,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 +348,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;
-- 
2.30.2