Method CBonusSystemNode::getAllBonuses have 'root' parameter which is never
set to anythig else than nullptr. This patch removes the parameter and all
code that depends on it as preparatory work for further bonus system
optimization.
- Replaced BattleSide namespace-enum with enum class
- Merged two different BattleSide enum's into one
- Merged BattlePerspective enum into BattleSide enum
- Changed all places that use integers to represent battle side to use
BattleSide enum
- Added BattleSideArray convenience wrapper for std::array that is
always 2-elements in size and allows access to its elements using
BattleSide enum
Fixes the following warning, occurring during the linux-clang-test CI builds:
[824/832] Building CXX object test/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /home/runner/work/vcmi/vcmi/test/googletest/googletest/src/gtest-all.cc:38:
In file included from /home/runner/work/vcmi/vcmi/test/googletest/googletest/include/gtest/gtest.h:65:
In file included from /home/runner/work/vcmi/vcmi/test/googletest/googletest/include/gtest/gtest-death-test.h:43:
In file included from /home/runner/work/vcmi/vcmi/test/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h:47:
In file included from /home/runner/work/vcmi/vcmi/test/googletest/googletest/include/gtest/gtest-matchers.h:48:
/home/runner/work/vcmi/vcmi/test/googletest/googletest/include/gtest/gtest-printers.h:532:9: warning: implicit conversion from 'int32_t' (aka 'int') to 'float' may lose precision [-Wimplicit-int-float-conversion]
532 | if (static_cast<int32_t>(val * mulfor6 + 0.5) / mulfor6 == val) return 6;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
/home/runner/work/vcmi/vcmi/test/googletest/googletest/include/gtest/gtest-printers.h:551:17: note: in instantiation of function template specialization 'testing::internal::AppropriateResolution<float>' requested here
551 | os->precision(AppropriateResolution(f));
| ^
/home/runner/work/vcmi/vcmi/test/googletest/googletest/include/gtest/gtest-printers.h:544:9: warning: implicit conversion from 'int32_t' (aka 'int') to 'float' may lose precision [-Wimplicit-int-float-conversion]
544 | if (static_cast<int32_t>(val / divfor6 + 0.5) * divfor6 == val) return 6;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
2 warnings generated.
All text processing code is now located in lib/texts.
No changes other than code being moved around and adjustment of includes
Moved without changes:
Languages.h -> texts/Languages.h
MetaString.* -> texts/MetaString.*
TextOperations.* -> texts/TextOperations.*
Split into parts:
CGeneralTextHandler.* -> texts/CGeneralTextHandler.*
-> texts/CLegacyConfigParser.*
-> texts/TextLocalizationContainer.*
-> texts/TextIdentifier.h
/home/runner/work/vcmi/vcmi/test/../Global.h:700:36: error: no matching function for call to 'max'
const Floating relativeEpsilon = std::max(std::abs(left), std::abs(right)) * epsilon;
^~~~~~~~
/home/runner/work/vcmi/vcmi/test/JsonComparer.cpp:48:16: note: in instantiation of function template specialization 'vstd::isAlmostEqual<double, int>' requested here
return vstd::isAlmostEqual(value.Float(), 0);
^