mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
use uniform_int_distribution instead of rand()
This commit is contained in:
parent
ee2f3db9a8
commit
ab66034ed1
2 changed files with 5 additions and 2 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "character.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
|
||||
#include <components/misc/rng.hpp>
|
||||
|
||||
|
@ -254,8 +255,11 @@ void CharacterController::refreshHitRecoilAnims()
|
|||
|| mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0)
|
||||
&& mAnimation->hasAnimation("knockout"))
|
||||
{
|
||||
std::random_device r;
|
||||
std::mt19937 gen(r());
|
||||
std::uniform_int_distribution<int> dist(1, 3);
|
||||
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"))
|
||||
{
|
||||
mHitState = CharState_SwimKnockOut;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/timestamp.hpp"
|
||||
|
||||
#include "../mwrender/animation.hpp"
|
||||
|
||||
|
|
Loading…
Reference in a new issue