From a1d4523177742a3a81548c3293c3fbb263cd6bd3 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 2 Jul 2020 21:13:23 -0700 Subject: [PATCH] Turn areamap into plain array For this one, I had to make it a static data member and then initialize it in a certain way in Map.cpp. It's pretty cool that you're able to do this. --- desktop_version/src/Map.cpp | 17 ++++++++--------- desktop_version/src/Map.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 3950ed8a..8c30383c 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -74,8 +74,13 @@ mapclass::mapclass() specialnames.resize(8); resetnames(); - //Areamap starts at 100,100 and extends 20x20 - const int tmap[] = { + ypos = 0; + oldypos = 0; + bypos = 0; +} + +//Areamap starts at 100,100 and extends 20x20 +const int mapclass::areamap[] = { 1,2,2,2,2,2,2,2,0,3,0,0,0,4,4,4,4,4,4,4, 1,2,2,2,2,2,2,0,0,3,0,0,0,0,4,4,4,4,4,4, 0,1,0,0,2,0,0,0,0,3,0,0,0,0,4,4,4,4,4,4, @@ -96,13 +101,7 @@ mapclass::mapclass() 0,2,2,2,2,2,2,2,0,3,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,2,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,2,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0, - }; - areamap.insert(areamap.end(), tmap, tmap+400); - - ypos = 0; - oldypos = 0; - bypos = 0; -} +}; int mapclass::RGB(int red,int green,int blue) { diff --git a/desktop_version/src/Map.h b/desktop_version/src/Map.h index 26c9ac8d..581f70bb 100644 --- a/desktop_version/src/Map.h +++ b/desktop_version/src/Map.h @@ -81,7 +81,7 @@ public: int roomdeaths[20 * 20]; int roomdeathsfinal[20 * 20]; - std::vector areamap; + static const int areamap[20 * 20]; std::vector contents; bool explored[20 * 20]; std::vector vmult;