From a131964cc0fa5544100dd06c934eb1c38aa98ba9 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 26 Nov 2011 19:40:39 +0100 Subject: [PATCH] position() constructor: Take map ref, not ptr --- map.cc | 4 ++-- map.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/map.cc b/map.cc index 563a20c..a4fc0c5 100644 --- a/map.cc +++ b/map.cc @@ -43,7 +43,7 @@ position::next_in(int dir_x, int dir_y) { int x2 = (map->w + x + dir_x) % map->w; int y2 = (map->h + y + dir_y) % map->h; - return new position(x2, y2, map); + return new position(x2, y2, *map); } @@ -52,7 +52,7 @@ map::print_map(void) { for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { - class position p = position(x, y, this); + class position p = position(x, y, *this); std::cout << tile_at(p).symbol(); } std::cout << '\n'; diff --git a/map.h b/map.h index ea5f4d5..e9fc62e 100644 --- a/map.h +++ b/map.h @@ -26,11 +26,11 @@ public: int x, y; class map *map; - position(int x_, int y_, class map *map_) + position(int x_, int y_, class map &map_) { x = x_; y = y_; - map = map_; + map = &map_; }; class position *next_in(int dir_x, int dir_y);