From a72882a743aa929883ee9264229b97f946c1f620 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 26 Nov 2011 22:00:16 +0100 Subject: [PATCH] Fix map addressing --- main.cc | 2 +- map.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.cc b/main.cc index 0673c3f..b654c35 100644 --- a/main.cc +++ b/main.cc @@ -8,7 +8,7 @@ int main(int argc, char *argv[]) { - class map map(10, 10); + class map map(40, 20); srandom(time(NULL)); diff --git a/map.h b/map.h index 9dddd0b..3ed7095 100644 --- a/map.h +++ b/map.h @@ -44,14 +44,14 @@ public: for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { - tiles[y * h + x] = new tile_ground(x, y, *this); + tiles[y * w + x] = new tile_ground(x, y, *this); } } }; class tile &tile_at(int x, int y) { - return *tiles[y * h + x]; + return *tiles[y * w + x]; }; void print_map(void);