1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Multiple changes to RNG usage to both client and server

Server should never use RNG from CGameState directly.
Instead server get's own RNG that's state is secret for client.
This commit is contained in:
Arseniy Shestakov
2016-09-08 00:54:26 +03:00
parent 960d93ff5f
commit 2ba3b20928
9 changed files with 61 additions and 49 deletions

View File

@ -158,7 +158,7 @@ void CRewardableObject::onHeroVisit(const CGHeroInstance *h) const
grantRewardWithMessage(rewards[0]);
break;
case SELECT_RANDOM: // select one randomly //TODO: use weights
grantRewardWithMessage(rewards[cb->gameState()->getRandomGenerator().nextInt(rewards.size()-1)]);
grantRewardWithMessage(rewards[cb->getRandomGenerator().nextInt(rewards.size()-1)]);
break;
}
return;