implemented custom max(), because std::vector::size() returns different types on msvc vs. gcc

This commit is contained in:
Joseph Aquino 2025-09-25 08:05:36 -04:00
parent d7dcb2425e
commit daa6f236be
3 changed files with 12 additions and 2 deletions

9
include/Math.h Normal file
View File

@ -0,0 +1,9 @@
namespace Math
{
template<typename T, typename U, typename V>
inline T max(U first, V second)
{
return static_cast<T>(first >= second ? first : second);
}
}

View File

@ -2,4 +2,5 @@
#include <Physics.h>
#include <Random.h>
#include <Color.h>
#include <Color.h>
#include <Math.h>

View File

@ -607,7 +607,7 @@ void Game::soundSystem()
void Game::scoreSystem()
{
player.mult = (int)std::max(balls.size(), 1ull);
player.mult = Math::max<int>(balls.size(), 1);
for (auto& brick : bricks)
{
if (!brick.alive)