Commit 58a39fa2 authored by fallenstardust's avatar fallenstardust

remove rand(), random_shuffle()

parent 21a70572
......@@ -47,6 +47,7 @@ ClientField::ClientField() {
mzone[p].resize(7, 0);
szone[p].resize(8, 0);
}
rnd.reset(std::random_device()());
}
void ClientField::Clear() {
for(int i = 0; i < 2; ++i) {
......@@ -426,7 +427,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
}
}
if(has_card_in_grave) {
std::random_shuffle(selectable_cards.begin(), selectable_cards.end());
rnd.shuffle_vector(selectable_cards);
}
}
int startpos;
......
......@@ -2,6 +2,7 @@
#define CLIENT_FIELD_H
#include "config.h"
#include "../ocgcore/mtrandom.h"
#include <vector>
#include <set>
#include <map>
......@@ -87,6 +88,7 @@ public:
bool deck_reversed;
bool conti_selecting;
bool cant_check_grave;
mt19937 rnd;
ClientField();
void Clear();
......
......@@ -2180,7 +2180,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE);
for (int i = 0; i < 5; ++i) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
(*cit)->dPos = irr::core::vector3df(rand() * 0.4f / RAND_MAX - 0.2f, 0, 0);
(*cit)->dPos = irr::core::vector3df(rnd.rand() * 0.4f / rnd.rand_max - 0.2f, 0, 0);
(*cit)->dRot = irr::core::vector3df(0, 0, 0);
(*cit)->is_moving = true;
(*cit)->aniFrame = 3;
......@@ -2252,7 +2252,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for (int i = 0; i < 5; ++i) {
for (auto cit = mainGame->dField.extra[player].begin(); cit != mainGame->dField.extra[player].end(); ++cit) {
if(!((*cit)->position & POS_FACEUP)) {
(*cit)->dPos = irr::core::vector3df(rand() * 0.4f / RAND_MAX - 0.2f, 0, 0);
(*cit)->dPos = irr::core::vector3df(rnd.rand() * 0.4f / rnd.rand_max - 0.2f, 0, 0);
(*cit)->dRot = irr::core::vector3df(0, 0, 0);
(*cit)->is_moving = true;
(*cit)->aniFrame = 3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment