From: Christian Heller Date: Fri, 7 Jun 2013 22:30:50 +0000 (+0200) Subject: Corrected what valgrind complains about. X-Git-Tag: tce~1241 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/process?a=commitdiff_plain;h=018565cc4592702368c948c579bcca3f35d5ca04;p=plomrogue Corrected what valgrind complains about. --- 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;