(svn r261) -Workaround: unplayeable network-game on busy maps because of wrong setup of _current_player. This is only a workaround that can cause desyncs too but not that often
--- a/misc.c Tue Sep 14 20:56:57 2004 +0000
+++ b/misc.c Tue Sep 14 22:51:37 2004 +0000
@@ -15,9 +15,14 @@
return (x >> n) + (x << ((sizeof(x)*8)-n));
}
-
+/* Fuck bitch code, most probably one of the loops (tileloop, vehicleloop, etc.)
+ * doesn't set up/reset _current_player so the normal random below fails #$%@$#!
+ * The old code below is prune to desyncs because randoms interfere.
+ * SO FIND THE OFFENDING LOOP AND FIX IT ONCE AND FOR ALL */
+#undef NORMAL_RANDOM // unuseable game, desyncs way too fast
uint32 Random()
{
+#ifdef NORMAL_RANDOM
if (_current_player>=MAX_PLAYERS) {
uint32 s = _random_seeds[0][0];
uint32 t = _random_seeds[0][1];
@@ -29,6 +34,12 @@
_player_seeds[_current_player][0] = s + ROR(t ^ 0x1234567F, 7);
return _player_seeds[_current_player][1] = ROR(s, 3);
}
+#else
+ uint32 s = _random_seeds[0][0];
+ uint32 t = _random_seeds[0][1];
+ _random_seeds[0][0] = s + ROR(t ^ 0x1234567F, 7);
+ return _random_seeds[0][1] = ROR(s, 3);
+#endif
}
uint RandomRange(uint max)
--- a/network.c Tue Sep 14 20:56:57 2004 +0000
+++ b/network.c Tue Sep 14 22:51:37 2004 +0000
@@ -353,7 +353,7 @@
{
uint32 newframe;
if (_frame_fsync_last == 0) return -5;
- newframe = (_frame_fsync_last + 16);
+ newframe = (_frame_fsync_last + 10); // do not use a multiple of 4 since that screws up sync-packets
if ( (newframe + 4) > _frame_counter_max) return -5;
return (_frame_counter_max - newframe);