1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 04:29:09 +00:00

(svn r12004) -Codechange: refactor the random functions to reduce code duplication.

This commit is contained in:
rubidium
2008-01-29 00:27:25 +00:00
parent fde33b5547
commit 3b2145aafe
6 changed files with 61 additions and 40 deletions

View File

@@ -1235,9 +1235,9 @@ static bool NetworkDoClientLoop()
if (_sync_frame != 0) {
if (_sync_frame == _frame_counter) {
#ifdef NETWORK_SEND_DOUBLE_SEED
if (_sync_seed_1 != _random_seeds[0][0] || _sync_seed_2 != _random_seeds[0][1]) {
if (_sync_seed_1 != _random.state[0] || _sync_seed_2 != _random.state[1]) {
#else
if (_sync_seed_1 != _random_seeds[0][0]) {
if (_sync_seed_1 != _random.state[0]) {
#endif
NetworkError(STR_NETWORK_ERR_DESYNC);
DebugDumpCommands("ddc:serr:%d;%d\n", _date, _date_fract);
@@ -1332,9 +1332,9 @@ void NetworkGameLoop()
// Then we make the frame
StateGameLoop();
_sync_seed_1 = _random_seeds[0][0];
_sync_seed_1 = _random.state[0];
#ifdef NETWORK_SEND_DOUBLE_SEED
_sync_seed_2 = _random_seeds[0][1];
_sync_seed_2 = _random.state[1];
#endif
NetworkServer_Tick(send_frame);