From fd719833ab0b768cd26bfbf25f91372e8a169ec7 Mon Sep 17 00:00:00 2001 From: Stan Date: Mon, 22 Apr 2019 21:45:23 +0000 Subject: [PATCH] Replace includes uniform_foo with uniform_foo_distribution as it's deprecated in newer versions of boost. It was added in the 1.47 version. Reviewed by: @Angen, @vladislavbelov Differential Revision: https://code.wildfiregames.com/D1823 This was SVN commit r22211. --- source/graphics/ObjectBase.cpp | 6 +++--- source/graphics/ParticleEmitterType.cpp | 6 +++--- source/maths/tests/test_Sqrt.h | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/graphics/ObjectBase.cpp b/source/graphics/ObjectBase.cpp index e1dff41a08..7b55c0d2bc 100644 --- a/source/graphics/ObjectBase.cpp +++ b/source/graphics/ObjectBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -29,7 +29,7 @@ #include "lib/timer.h" #include "maths/MathUtil.h" -#include +#include CObjectBase::CObjectBase(CObjectManager& objectManager) : m_ObjectManager(objectManager) @@ -554,7 +554,7 @@ std::set CObjectBase::CalculateRandomRemainingSelections(rng_t& rng, const if (allZero) totalFreq = (int)grp->size(); // Choose a random number in the interval [0..totalFreq) - int randNum = boost::uniform_int<>(0, totalFreq-1)(rng); + int randNum = boost::random::uniform_int_distribution(0, totalFreq-1)(rng); // and use that to choose one of the variants for (size_t i = 0; i < grp->size(); ++i) diff --git a/source/graphics/ParticleEmitterType.cpp b/source/graphics/ParticleEmitterType.cpp index 1479c2b2aa..46a540d732 100644 --- a/source/graphics/ParticleEmitterType.cpp +++ b/source/graphics/ParticleEmitterType.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -30,7 +30,7 @@ #include "ps/XML/Xeromyces.h" #include "renderer/Renderer.h" -#include +#include /** @@ -120,7 +120,7 @@ public: virtual float Compute(CParticleEmitterType& type, CParticleEmitter& UNUSED(emitter)) { - return boost::uniform_real<>(m_Min, m_Max)(type.m_Manager.m_RNG); + return boost::random::uniform_real_distribution(m_Min, m_Max)(type.m_Manager.m_RNG); } virtual float Min(CParticleEmitterType& UNUSED(type)) diff --git a/source/maths/tests/test_Sqrt.h b/source/maths/tests/test_Sqrt.h index 8c2dd897a4..702244b9cd 100644 --- a/source/maths/tests/test_Sqrt.h +++ b/source/maths/tests/test_Sqrt.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ #include "maths/Sqrt.h" #include -#include +#include #include class TestSqrt : public CxxTest::TestSuite @@ -76,13 +76,13 @@ public: // (TODO: This might be making non-portable assumptions about sqrt(double)) boost::mt19937 rng; - boost::uniform_int ints(0, (u64)-1); - boost::variate_generator > gen(rng, ints); + boost::random::uniform_int_distribution ints(0, (u64)-1); + boost::variate_generator> gen(rng, ints); for (size_t i = 0; i < 1024; ++i) { u64 n = gen(); - s(n, (u64)sqrt((double)n)); + s(n, static_cast(sqrt(static_cast(n)))); } } };