git repos / saland

commit a70ee992

Poul Sander · 2019-08-14 15:23
a70ee992a632f31d6c39eb206db6099a101ed269 patch · browse files
parent 5cc3e502d8d14cc12eb54b6babd2e73fe7da3f1b

Restored Windows support

Changed files

M CMakeLists.txt before
M src/sagotmx/tmx_struct.h before
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0503114..e2d485c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -7,6 +7,14 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${saland_SOURCE_DIR}/src/cmake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wsuggest-override -Wno-deprecated-declarations -std=c++11 -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -g")
+if (WIN32)
+ SET(GUI_TYPE WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
+ if(NOT _WIN32_WINNT AND NOT WINVER)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0601 -DWINVER=0x0601")
+ endif()
+endif()
+
find_package(Boost COMPONENTS program_options REQUIRED)
#Setup SDL2
@@ -20,7 +28,7 @@ pkg_search_module(SDL2IMAGE REQUIRED SDL2_image)
pkg_search_module(SDL2TTF REQUIRED SDL2_ttf)
pkg_search_module(SDL2GFX REQUIRED SDL2_gfx)
-include_directories("src/Libs/include")
+include_directories(SYSTEM "src/Libs/include")
file(GLOB SOURCES "src/*.cpp" "src/*/*.cpp" "src/*/*/*.cpp" "src/Libs/*.c")
diff --git a/src/sagotmx/tmx_struct.h b/src/sagotmx/tmx_struct.h index df785bc..6fc3af3 100644 --- a/src/sagotmx/tmx_struct.h +++ b/src/sagotmx/tmx_struct.h
@@ -626,7 +626,7 @@ inline uint32_t getTileFromLayer(const TileMap& m, const TileLayer& l, int x, in
size_t tile_index = (m.height*y+x)*sizeof(uint32_t);
if (tile_index > l.data.payload.size()-sizeof(uint32_t) ) {
throw SagoTiledException("ERROR: getTileFromLayer called with coordinates out-of-bound. Called with (%d, %d). Limit (%d, %d). Or the layer is corrupt. "
- "Reported number of tiles in layer: %ld", x, y, m.width-1, m.height-1, l.data.payload.size()/sizeof(uint32_t));
+ "Reported number of tiles in layer: %ld", x, y, m.width-1, m.height-1, (long int)l.data.payload.size()/sizeof(uint32_t));
}
const unsigned char *data = reinterpret_cast<const unsigned char*>(l.data.payload.data());
uint32_t global_tile_id = data[tile_index] |
@@ -641,7 +641,7 @@ inline void setTileOnLayerNumber(TileMap& m, int layer_number, int x, int y, uin
TileLayer& l = m.layers.at(layer_number);
if (tile_index > l.data.payload.size()-sizeof(uint32_t) ) {
throw SagoTiledException("ERROR: setTileOnLayerNumber called with coordinates out-of-bound. Called with (%d, %d). Limit (%d, %d). Or the layer is corrupt. "
- "Reported number of tiles in layer: %ld", x, y, m.width-1, m.height-1, l.data.payload.size()/sizeof(uint32_t));
+ "Reported number of tiles in layer: %ld", x, y, m.width-1, m.height-1, (long int)l.data.payload.size()/sizeof(uint32_t));
}
std::string& data = l.data.payload;
uint32_t* dp = reinterpret_cast<uint32_t*> (&data[tile_index]);