diff --git a/cmake/version.cmake b/cmake/version.cmake index 707818e..2a9933c 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -23,11 +23,17 @@ else() COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE GIT_BRANCH) + execute_process( + COMMAND git describe --tags --abbrev=0 + OUTPUT_VARIABLE GIT_LAST_TAG + ) + string(STRIP "${GIT_REV}" GIT_REV) string(SUBSTRING "${GIT_REV}" 1 7 GIT_REV) string(STRIP "${GIT_DIFF}" GIT_DIFF) string(STRIP "${GIT_TAG}" GIT_TAG) string(STRIP "${GIT_BRANCH}" GIT_BRANCH) + string(STRIP "${GIT_LAST_TAG}" GIT_LAST_TAG) endif() set(VERSION "#include \"version.h\" @@ -35,6 +41,7 @@ set(VERSION "#include \"version.h\" const std::string GRAD_MEH_GIT_REV = \"${GIT_REV}${GIT_DIFF}\"; const std::string GRAD_MEH_GIT_TAG = \"${GIT_TAG}\"; const std::string GRAD_MEH_GIT_BRANCH = \"${GIT_BRANCH}\"; +const std::string GRAD_MEH_GIT_LAST_TAG = \"${GIT_LAST_TAG}\"; ") if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp) diff --git a/src/main.cpp b/src/main.cpp index c4e8c97..89fa820 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,8 +63,8 @@ void writeMeta(const std::string& worldName, const int32_t& worldSize, fs::path& client::invoker_lock threadLock; auto mapConfig = sqf::config_entry(sqf::config_file()) >> "CfgWorlds" >> worldName; nl::json meta; - meta["version"] = GRAD_MEH_FORMAT_VERSION; - meta["worldName"] = boost::algorithm::to_lower_copy(worldName); + meta["version"] = GRAD_MEH_GIT_LAST_TAG; + meta["worldName"] = ba::to_lower_copy(worldName); meta["worldSize"] = worldSize; meta["author"] = sqf::get_text(mapConfig >> "author"); meta["displayName"] = sqf::get_text(mapConfig >> "description"); @@ -74,6 +74,11 @@ void writeMeta(const std::string& worldName, const int32_t& worldSize, fs::path& meta["gridOffsetX"] = sqf::get_number(mapConfig >> "Grid" >> "offsetX"); meta["gridOffsetY"] = sqf::get_number(mapConfig >> "Grid" >> "offsetY"); + auto colorArray = sqf::get_array(mapConfig >> "OutsideTerrain" >> "colorOutside").to_array(); + if (!colorArray.empty()) { + meta["colorOutside"] = std::vector(colorArray.begin(), colorArray.end()); + } + auto gridArray = nl::json::array(); for (auto& grid : sqf::config_classes("true", (mapConfig >> "Grid"))) { diff --git a/src/version.h b/src/version.h index 50e39c3..63ff9fd 100644 --- a/src/version.h +++ b/src/version.h @@ -5,3 +5,4 @@ extern const std::string GRAD_MEH_GIT_REV; extern const std::string GRAD_MEH_GIT_TAG; extern const std::string GRAD_MEH_GIT_BRANCH; +extern const std::string GRAD_MEH_GIT_LAST_TAG;