From 51415895a4352885224e3783c9166d4386393ec6 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 6 May 2020 13:27:50 +0200 Subject: [PATCH] Fixes GetEffectiveness in type library using integer instead of float. --- src/Library/TypeLibrary.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Library/TypeLibrary.cpp b/src/Library/TypeLibrary.cpp index b4ee41c..220a16b 100644 --- a/src/Library/TypeLibrary.cpp +++ b/src/Library/TypeLibrary.cpp @@ -1,14 +1,11 @@ #include "TypeLibrary.hpp" #include +#include using namespace CreatureLib::Library; float TypeLibrary::GetEffectiveness(uint8_t attacking, const List& defensive) const { - auto eff = 1; - for (auto def : defensive) { - eff *= GetSingleEffectiveness(attacking, def); - } - return eff; + return std::accumulate(defensive.begin(), defensive.end(), (float)1, std::multiplies()); } float TypeLibrary::GetSingleEffectiveness(uint8_t attacking, uint8_t defensive) const {