mirror of https://github.com/OpenTTD/OpenTTD
(svn r2588) Codechange: Remove PLAYER_SEED_RANDOM
parent
19cb5e054a
commit
f12b3a0c18
|
@ -123,12 +123,6 @@ static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
|
||||||
static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
|
static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
void InitPlayerRandoms(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
|
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
|
||||||
uint InteractiveRandomRange(uint max);
|
uint InteractiveRandomRange(uint max);
|
||||||
|
|
||||||
|
|
32
misc.c
32
misc.c
|
@ -24,11 +24,6 @@ static inline uint32 ROR(uint32 x, int n)
|
||||||
return (x >> n) + (x << ((sizeof(x)*8)-n));
|
return (x >> n) + (x << ((sizeof(x)*8)-n));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX - Player-seeds don't seem to be used anymore.. which is a good thing
|
|
||||||
so I just disabled them for now. If there are no problems, we can remove
|
|
||||||
it completely! -- TrueLight */
|
|
||||||
#undef PLAYER_SEED_RANDOM
|
|
||||||
|
|
||||||
#ifndef MERSENNE_TWISTER
|
#ifndef MERSENNE_TWISTER
|
||||||
|
|
||||||
#ifdef RANDOM_DEBUG
|
#ifdef RANDOM_DEBUG
|
||||||
|
@ -47,25 +42,10 @@ uint32 t;
|
||||||
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);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
if (_current_player>=MAX_PLAYERS || !_networking) {
|
|
||||||
s = _random_seeds[0][0];
|
|
||||||
t = _random_seeds[0][1];
|
|
||||||
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7) + 1;
|
|
||||||
return _random_seeds[0][1] = ROR(s, 3) - 1;
|
|
||||||
} else {
|
|
||||||
uint32 s = _player_seeds[_current_player][0];
|
|
||||||
uint32 t = _player_seeds[_current_player][1];
|
|
||||||
_player_seeds[_current_player][0] = s + ROR(t ^ 0x1234567F, 7) + 1;
|
|
||||||
DEBUG(net, 1)("[NET-Seeds] Player seed called!");
|
|
||||||
return _player_seeds[_current_player][1] = ROR(s, 3) - 1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
s = _random_seeds[0][0];
|
s = _random_seeds[0][0];
|
||||||
t = _random_seeds[0][1];
|
t = _random_seeds[0][1];
|
||||||
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7) + 1;
|
_random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7) + 1;
|
||||||
return _random_seeds[0][1] = ROR(s, 3) - 1;
|
return _random_seeds[0][1] = ROR(s, 3) - 1;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif // MERSENNE_TWISTER
|
#endif // MERSENNE_TWISTER
|
||||||
|
|
||||||
|
@ -95,18 +75,6 @@ uint InteractiveRandomRange(uint max)
|
||||||
return (uint16)InteractiveRandom() * max >> 16;
|
return (uint16)InteractiveRandom() * max >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
void InitPlayerRandoms(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i=0; i<MAX_PLAYERS; i++) {
|
|
||||||
_player_seeds[i][0]=InteractiveRandom();
|
|
||||||
_player_seeds[i][1]=InteractiveRandom();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void SetDate(uint date)
|
void SetDate(uint date)
|
||||||
{
|
{
|
||||||
YearMonthDay ymd;
|
YearMonthDay ymd;
|
||||||
|
|
|
@ -773,10 +773,6 @@ static void NetworkInitialize(void)
|
||||||
|
|
||||||
_network_reconnect = 0;
|
_network_reconnect = 0;
|
||||||
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
InitPlayerRandoms();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NetworkUDPInitialize();
|
NetworkUDPInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -487,15 +487,6 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP)
|
||||||
|
|
||||||
// Check if this was the last packet
|
// Check if this was the last packet
|
||||||
if (maptype == MAP_PACKET_END) {
|
if (maptype == MAP_PACKET_END) {
|
||||||
// We also get, very nice, the player_seeds in this packet
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
|
||||||
_player_seeds[i][0] = NetworkRecv_uint32(MY_CLIENT, p);
|
|
||||||
_player_seeds[i][1] = NetworkRecv_uint32(MY_CLIENT, p);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fclose(file_pointer);
|
fclose(file_pointer);
|
||||||
|
|
||||||
_network_join_status = NETWORK_JOIN_STATUS_PROCESSING;
|
_network_join_status = NETWORK_JOIN_STATUS_PROCESSING;
|
||||||
|
|
|
@ -323,9 +323,6 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP)
|
||||||
NetworkSend_Packet(p, cs);
|
NetworkSend_Packet(p, cs);
|
||||||
if (feof(file_pointer)) {
|
if (feof(file_pointer)) {
|
||||||
// Done reading!
|
// Done reading!
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
int i;
|
|
||||||
#endif
|
|
||||||
Packet *p;
|
Packet *p;
|
||||||
|
|
||||||
// XXX - Delete this when patch-settings are saved in-game
|
// XXX - Delete this when patch-settings are saved in-game
|
||||||
|
@ -333,13 +330,6 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MAP)
|
||||||
|
|
||||||
p = NetworkSend_Init(PACKET_SERVER_MAP);
|
p = NetworkSend_Init(PACKET_SERVER_MAP);
|
||||||
NetworkSend_uint8(p, MAP_PACKET_END);
|
NetworkSend_uint8(p, MAP_PACKET_END);
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
// Send the player_seeds in this packet
|
|
||||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
|
||||||
NetworkSend_uint32(p, _player_seeds[i][0]);
|
|
||||||
NetworkSend_uint32(p, _player_seeds[i][1]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
NetworkSend_Packet(p, cs);
|
NetworkSend_Packet(p, cs);
|
||||||
|
|
||||||
// Set the status to DONE_MAP, no we will wait for the client
|
// Set the status to DONE_MAP, no we will wait for the client
|
||||||
|
|
|
@ -676,10 +676,6 @@ int ttd_main(int argc, char* argv[])
|
||||||
InitializeGUI();
|
InitializeGUI();
|
||||||
IConsoleCmdExec("exec scripts/autoexec.scr 0");
|
IConsoleCmdExec("exec scripts/autoexec.scr 0");
|
||||||
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
InitPlayerRandoms();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GenerateWorld(1, 64, 64); // Make the viewport initialization happy
|
GenerateWorld(1, 64, 64); // Make the viewport initialization happy
|
||||||
|
|
||||||
#ifdef ENABLE_NETWORK
|
#ifdef ENABLE_NETWORK
|
||||||
|
|
|
@ -83,10 +83,6 @@ VARDEF uint16 _station_tick_ctr;
|
||||||
|
|
||||||
VARDEF uint32 _random_seeds[2][2];
|
VARDEF uint32 _random_seeds[2][2];
|
||||||
|
|
||||||
#ifdef PLAYER_SEED_RANDOM
|
|
||||||
VARDEF uint32 _player_seeds[MAX_PLAYERS][2];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Iterator through all towns in OnTick_Town
|
// Iterator through all towns in OnTick_Town
|
||||||
VARDEF uint32 _cur_town_ctr;
|
VARDEF uint32 _cur_town_ctr;
|
||||||
// Frequency iterator at the same place
|
// Frequency iterator at the same place
|
||||||
|
|
Loading…
Reference in New Issue