mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r1622) -Fix: variables can't be defined after a statement.. (Igor2Code)
This commit is contained in:
parent
8edff76765
commit
24a34936db
12
misc.c
12
misc.c
@ -34,6 +34,10 @@ uint32 DoRandom(int line, const char *file)
|
|||||||
uint32 Random(void)
|
uint32 Random(void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
uint32 s;
|
||||||
|
uint32 t;
|
||||||
|
|
||||||
#ifdef RANDOM_DEBUG
|
#ifdef RANDOM_DEBUG
|
||||||
if (_networking && (DEREF_CLIENT(0)->status != STATUS_INACTIVE || !_network_server))
|
if (_networking && (DEREF_CLIENT(0)->status != STATUS_INACTIVE || !_network_server))
|
||||||
printf("Random [%d/%d] %s:%d\n",_frame_counter, _current_player, file, line);
|
printf("Random [%d/%d] %s:%d\n",_frame_counter, _current_player, file, line);
|
||||||
@ -41,8 +45,8 @@ uint32 Random(void)
|
|||||||
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
#ifdef PLAYER_SEED_RANDOM
|
||||||
if (_current_player>=MAX_PLAYERS || !_networking) {
|
if (_current_player>=MAX_PLAYERS || !_networking) {
|
||||||
uint32 s = _random_seeds[0][0];
|
s = _random_seeds[0][0];
|
||||||
uint32 t = _random_seeds[0][1];
|
t = _random_seeds[0][1];
|
||||||
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7);
|
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7);
|
||||||
return _random_seeds[0][1] = ROR(s, 3);
|
return _random_seeds[0][1] = ROR(s, 3);
|
||||||
} else {
|
} else {
|
||||||
@ -53,8 +57,8 @@ uint32 Random(void)
|
|||||||
return _player_seeds[_current_player][1] = ROR(s, 3);
|
return _player_seeds[_current_player][1] = ROR(s, 3);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uint32 s = _random_seeds[0][0];
|
s = _random_seeds[0][0];
|
||||||
uint32 t = _random_seeds[0][1];
|
t = _random_seeds[0][1];
|
||||||
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7);
|
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7);
|
||||||
return _random_seeds[0][1] = ROR(s, 3);
|
return _random_seeds[0][1] = ROR(s, 3);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user