summaryrefslogtreecommitdiffstats
path: root/games/monster-masher/files/patch-src::arena.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'games/monster-masher/files/patch-src::arena.cpp')
-rw-r--r--games/monster-masher/files/patch-src::arena.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/games/monster-masher/files/patch-src::arena.cpp b/games/monster-masher/files/patch-src::arena.cpp
new file mode 100644
index 000000000..aaf23107e
--- /dev/null
+++ b/games/monster-masher/files/patch-src::arena.cpp
@@ -0,0 +1,21 @@
+--- src/arena.cpp.orig Mon Nov 3 06:47:41 2003
++++ src/arena.cpp Wed Nov 5 20:32:03 2003
+@@ -64,11 +64,16 @@
+
+ Vector<int> Arena::random_tile()
+ {
++ const size_t ax = size.x - 2;
++ const size_t ay = size.y - 2;
++ const size_t av = ax * ay;
++
+ Vector<int> t;
+
+ do {
+- t.x = std::rand() % (size.x - 2) + 1;
+- t.y = std::rand() % (size.y - 2) + 1;
++ const int rnd = std::rand() % av;
++ t.x = rnd % ax + 1;
++ t.y = rnd / ax + 1;
+ } while (occupier(t) != 0);
+
+ return t;