mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-18 05:42:40 +00:00
use uniform_int_distribution instead of rand()
This commit is contained in:
parent
ee2f3db9a8
commit
ab66034ed1
@ -20,6 +20,7 @@
|
|||||||
#include "character.hpp"
|
#include "character.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
@ -254,8 +255,11 @@ void CharacterController::refreshHitRecoilAnims()
|
|||||||
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
|
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
|
||||||
&& mAnimation->hasAnimation("knockout"))
|
&& mAnimation->hasAnimation("knockout"))
|
||||||
{
|
{
|
||||||
|
std::random_device r;
|
||||||
|
std::mt19937 gen(r());
|
||||||
|
std::uniform_int_distribution<int> dist(1, 3);
|
||||||
mTimeToWake = time(NULL);
|
mTimeToWake = time(NULL);
|
||||||
mTimeToWake += (int)( (float)rand() / (float)RAND_MAX * 2) + 1; // Wake up after 1 to 3 seconds
|
mTimeToWake += dist(gen); // Wake up after 1 to 3 seconds
|
||||||
if (isSwimming && mAnimation->hasAnimation("swimknockout"))
|
if (isSwimming && mAnimation->hasAnimation("swimknockout"))
|
||||||
{
|
{
|
||||||
mHitState = CharState_SwimKnockOut;
|
mHitState = CharState_SwimKnockOut;
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/timestamp.hpp"
|
|
||||||
|
|
||||||
#include "../mwrender/animation.hpp"
|
#include "../mwrender/animation.hpp"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user