summaryrefslogtreecommitdiff
path: root/src/landscape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/landscape.cpp')
-rw-r--r--src/landscape.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index a4b12f857..e39693f6e 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -722,11 +722,18 @@ void RunTileLoop()
* shift register (LFSR). This allows a deterministic pseudorandom ordering, but
* still with minimal state and fast iteration. */
- /* Maximal length LFSR feedback terms, from 12-bit (for 64x64 maps) to 22-bit (for 2048x2048 maps).
+ /* Maximal length LFSR feedback terms, from 12-bit (for 64x64 maps) over 22-bit (for 2048x2048 maps) to 32-bit.
* Extracted from http://www.ece.cmu.edu/~koopman/lfsr/ */
static const uint32 feedbacks[] = {
- 0xD8F, 0x1296, 0x2496, 0x4357, 0x8679, 0x1030E, 0x206CD, 0x403FE, 0x807B8, 0x1004B2, 0x2006A8
+ // 12 - 22
+ 0xD8F, 0x1296, 0x2496, 0x4357, 0x8679, 0x1030E, 0x206CD, 0x403FE, 0x807B8, 0x1004B2, 0x2006A8,
+ // 23 - 30
+ 0x4004B2, 0x800B87, 0x10004F3, 0x200072D, 0x40006AE, 0x80009E3, 0x10000583, 0x20000C92,
+ // 31 - 32
+ 0x400005B6, 0x80000EA6
};
+
+ assert(MapLogX() + MapLogY() <= 32);
const uint32 feedback = feedbacks[MapLogX() + MapLogY() - 12];
/* We update every tile every 256 ticks, so divide the map size by 2^8 = 256 */