From d70c6a224a6cc3ab74bbb48282190b871c730c77 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 7 Mar 2021 09:43:10 +0100 Subject: [PATCH] Fixes for growth rates, forces shared library to be dll on Windows. Signed-off-by: Deukhoofd --- CMakeLists.txt | 5 ++++- src/Library/GrowthRates/GrowthRateLibrary.hpp | 4 ++-- src/Library/GrowthRates/LookupGrowthRate.hpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f1257..ab5e089 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,6 @@ if (IPO_SUPPORTED) set_property(TARGET CreatureLib PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) endif () -# If we are building for Windows we need to set some specific variables. if (WINDOWS) MESSAGE(WARNING, "Using Windows Build.") # Add a definition for the compiler, so we can use it in C++ as well. @@ -76,8 +75,12 @@ if (WINDOWS) # -m64: Build a 64 bit library add_compile_options(-m64) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition") + if (SHARED) + set_target_properties(CreatureLib PROPERTIES SUFFIX ".dll") + endif (SHARED) endif (WINDOWS) + # Set up links to all relevant libraries. SET(_LIBRARYLINKS Arbutils) if (NOT WINDOWS) diff --git a/src/Library/GrowthRates/GrowthRateLibrary.hpp b/src/Library/GrowthRates/GrowthRateLibrary.hpp index 5161566..8e58380 100644 --- a/src/Library/GrowthRates/GrowthRateLibrary.hpp +++ b/src/Library/GrowthRates/GrowthRateLibrary.hpp @@ -14,8 +14,8 @@ namespace CreatureLib::Library { virtual ~GrowthRateLibrary() = default; - [[nodiscard]] uint8_t CalculateLevel(const ArbUt::BasicStringView& growthRate, uint32_t experience) const; - [[nodiscard]] uint8_t CalculateLevel(uint32_t hash, uint32_t experience) const; + [[nodiscard]] level_int_t CalculateLevel(const ArbUt::BasicStringView& growthRate, uint32_t experience) const; + [[nodiscard]] level_int_t CalculateLevel(uint32_t hash, uint32_t experience) const; [[nodiscard]] uint32_t CalculateExperience(const ArbUt::BasicStringView& growthRate, level_int_t level) const; [[nodiscard]] uint32_t CalculateExperience(uint32_t hash, level_int_t level) const; diff --git a/src/Library/GrowthRates/LookupGrowthRate.hpp b/src/Library/GrowthRates/LookupGrowthRate.hpp index e8d8e4c..e4974f1 100644 --- a/src/Library/GrowthRates/LookupGrowthRate.hpp +++ b/src/Library/GrowthRates/LookupGrowthRate.hpp @@ -17,7 +17,7 @@ namespace CreatureLib::Library { return i; } } - return _experience[_experience.Count() - 1]; + return _experience.Count() - 1; } uint32_t CalculateExperience(level_int_t level) const override { return _experience[level - 1]; }