diff --git a/desktop_version/src/CustomLevels.cpp b/desktop_version/src/CustomLevels.cpp index b76ad961..465279a5 100644 --- a/desktop_version/src/CustomLevels.cpp +++ b/desktop_version/src/CustomLevels.cpp @@ -1483,15 +1483,12 @@ bool customlevelclass::save(const std::string& _path) void customlevelclass::generatecustomminimap(void) { - map.customwidth = mapwidth; - map.customheight = mapheight; - map.customzoom = 1; - if (map.customwidth <= 10 && map.customheight <= 10) + if (mapwidth <= 10 && mapheight <= 10) { map.customzoom = 2; } - if (map.customwidth <= 5 && map.customheight <= 5) + if (mapwidth <= 5 && mapheight <= 5) { map.customzoom = 4; } @@ -1500,16 +1497,16 @@ void customlevelclass::generatecustomminimap(void) switch (map.customzoom) { case 4: - map.custommmxoff = 24 * (5 - map.customwidth); - map.custommmyoff = 18 * (5 - map.customheight); + map.custommmxoff = 24 * (5 - mapwidth); + map.custommmyoff = 18 * (5 - mapheight); break; case 2: - map.custommmxoff = 12 * (10 - map.customwidth); - map.custommmyoff = 9 * (10 - map.customheight); + map.custommmxoff = 12 * (10 - mapwidth); + map.custommmyoff = 9 * (10 - mapheight); break; default: - map.custommmxoff = 6 * (20 - map.customwidth); - map.custommmyoff = int(4.5 * (20 - map.customheight)); + map.custommmxoff = 6 * (20 - mapwidth); + map.custommmyoff = int(4.5 * (20 - mapheight)); break; } diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 74d6a943..78a4cd72 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -48,7 +48,6 @@ mapclass::mapclass(void) custommode=false; custommodeforreal=false; - customwidth=20; customheight=20; custommmxoff=0; custommmyoff=0; custommmxsize=0; custommmysize=0; customzoom=0; customshowmm=true; @@ -109,6 +108,30 @@ const int mapclass::areamap[] = { 2,2,2,2,2,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0, }; +int mapclass::getwidth(void) +{ +#ifndef NO_CUSTOM_LEVELS + if (custommode) + { + return cl.mapwidth; + } +#endif + + return 20; +} + +int mapclass::getheight(void) +{ +#ifndef NO_CUSTOM_LEVELS + if (custommode) + { + return cl.mapheight; + } +#endif + + return 20; +} + int mapclass::intpol(int a, int b, float c) { return static_cast(a + ((b - a) * c)); diff --git a/desktop_version/src/Map.h b/desktop_version/src/Map.h index dcd2e2df..3a439f3e 100644 --- a/desktop_version/src/Map.h +++ b/desktop_version/src/Map.h @@ -23,6 +23,10 @@ class mapclass public: mapclass(void); + int getwidth(void); + + int getheight(void); + int intpol(int a, int b, float c); void setteleporter(int x, int y); @@ -129,7 +133,6 @@ public: //Variables for playing custom levels bool custommode; bool custommodeforreal; - int customwidth, customheight; int custommmxoff, custommmyoff, custommmxsize, custommmysize; int customzoom; bool customshowmm; diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 33fb5b95..bda5fdbb 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -26,8 +26,6 @@ static int tb; struct MapRenderData { - int width; - int height; int zoom; int xoff; int yoff; @@ -2055,8 +2053,6 @@ static MapRenderData getmaprenderdata() { MapRenderData data; - data.width = map.custommode ? map.customwidth : 20; - data.height = map.custommode ? map.customheight : 20; data.zoom = map.custommode ? map.customzoom : 1; data.xoff = map.custommode ? map.custommmxoff : 0; data.yoff = map.custommode ? map.custommmyoff : 0; @@ -2102,9 +2098,9 @@ static void rendermapfog(void) { const MapRenderData data = getmaprenderdata(); - for (int j = 0; j < data.height; j++) + for (int j = 0; j < map.getheight(); j++) { - for (int i = 0; i < data.width; i++) + for (int i = 0; i < map.getwidth(); i++) { if (!map.isexplored(i, j)) {