Re-add different level sizes in Defines.
continuous-integration/drone/push Build is passing Details

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2020-09-27 11:25:32 +02:00
parent 4f972bcb28
commit dd8847a441
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 22 additions and 1 deletions

View File

@ -40,6 +40,16 @@ endif ()
if (LEVEL_SIZE STREQUAL "8")
add_definitions(-DLEVEL_U8)
message(STATUS "Using level size of 8")
elseif (LEVEL_SIZE STREQUAL "16")
add_definitions(-DLEVEL_U16)
message(STATUS "Using level size of 16")
elseif (LEVEL_SIZE STREQUAL "32")
add_definitions(-DLEVEL_U32)
message(STATUS "Using level size of 32")
elseif (LEVEL_SIZE STREQUAL "64")
add_definitions(-DLEVEL_U64)
message(STATUS "Using level size of 64")
else ()
message(FATAL_ERROR, "Invalid level size was given.")
endif ()

View File

@ -1,6 +1,17 @@
#ifndef CREATURELIB_DEFINES_HPP
#define CREATURELIB_DEFINES_HPP
using level_int_t = int;
#if LEVEL_U8
using level_int_t = uint8_t;
#elif LEVEL_U16
using level_int_t = uint16_t;
#elif LEVEL_U32
using level_int_t = uint32_t;
#elif LEVEL_U64
using level_int_t = uint64_t;
#else
#warning Level size was not specified, falling back to uint8_t
using level_int_t = uint8_t;
#endif
#endif // CREATURELIB_DEFINES_HPP