diff --git a/CMakeLists.txt b/CMakeLists.txt index a8bb79c..afa0e42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.0) find_package(GDAL CONFIG REQUIRED) add_executable(${PROJECT_NAME} - src/HeightMap.cpp src/main.cpp + src/HeightMap.cpp src/CaseMap.cpp src/main.cpp ) diff --git a/src/casemap.cpp b/src/CaseMap.cpp similarity index 75% rename from src/casemap.cpp rename to src/CaseMap.cpp index 35d5f70..ea72701 100644 --- a/src/casemap.cpp +++ b/src/CaseMap.cpp @@ -1,11 +1,4 @@ -#include -#include "gdal/gdal_priv.h" -#include - -#include - #include "CaseMap.hh" -#include "HeightMap.hh" CaseMap::CaseMap(int width, int height, int* cases) { diff --git a/src/casemap.hh b/src/CaseMap.hh similarity index 79% rename from src/casemap.hh rename to src/CaseMap.hh index 5b4cce8..abf7b4d 100644 --- a/src/casemap.hh +++ b/src/CaseMap.hh @@ -4,10 +4,10 @@ class CaseMap { public: - float* data; + int* cases; int width; //!< width of image in cases int height; //!< height of image in cases CaseMap(int width, int height, int* cases); - float get_case(int x,int y); + int get_case(int x,int y); }; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 617c683..4f51a52 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,14 +4,17 @@ #include #include #include +#include "gdal/gdal_priv.h" +#include std::vector produce_casemap(HeightMap* heightmap) { std::vector output; int* test = (int *) CPLMalloc(sizeof(int)*heightmap->width*heightmap->height); + *(test + 4) = 13; CaseMap casemap1(heightmap->width-1, heightmap->height-1, test); output.push_back(casemap1); - return output + return output; } //(int a, int b, ) @@ -23,7 +26,7 @@ int main(int argc, const char* argv[]) std::cout << "x: " << map.width << " y: " << map.height << "\n"; std::cout << "max: " << map.max << " min: " << map.min << "\n"; - + /* for (int y = 0; y < map.height; y++) { for (int x = 0; x < map.width; x++) @@ -32,7 +35,8 @@ int main(int argc, const char* argv[]) } std::cout << "\n"; } + */ std::cout << "\nend🤡\n"; - casemap = produce_casemap(map); - std::cout << casemap.get_case( 2, 2) + auto casemap = produce_casemap(&map); + std::cout << casemap[0].get_case( 4, 0); } \ No newline at end of file