summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-11-17 23:16:41 +0000
committerrubidium <rubidium@openttd.org>2007-11-17 23:16:41 +0000
commitccf610e13c825814bed33cbc8e9e39a425a8c2dc (patch)
tree6875b2043f6f455b0745dccacf6c5c4897db8dfb /src/town_cmd.cpp
parent76d9c20f01d027a758c2ae115e2017fe6d32b7e1 (diff)
downloadopenttd-ccf610e13c825814bed33cbc8e9e39a425a8c2dc.tar.xz
(svn r11454) -Fix: the CHANCE16 functions were biased; a 32768 in 65536 chance was really a 32769 in 65536 chance.
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index fa8e3ee82..867379205 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -731,16 +731,14 @@ no_slope:
* maybe terraform some. */
desired_slope = (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? SLOPE_NW : SLOPE_NE;
if (desired_slope != cur_slope && ComplementSlope(desired_slope) != cur_slope) {
- uint32 r = Random();
-
- if (CHANCE16I(1, 8, r)) {
+ if (CHANCE16(1, 8)) {
CommandCost res = CMD_ERROR;
- if (!_generating_world && CHANCE16I(1, 10, r >> 4)) {
+ if (!_generating_world && CHANCE16(1, 10)) {
/* Note: Do not replace " ^ 0xF" with ComplementSlope(). The slope might be steep. */
- res = DoCommand(tile, CHANCE16I(1, 16, r >> 8) ? cur_slope : cur_slope ^ 0xF, 0,
+ res = DoCommand(tile, CHANCE16(1, 16) ? cur_slope : cur_slope ^ 0xF, 0,
DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
}
- if (CmdFailed(res) && CHANCE16I(1, 3, r >> 16)) {
+ if (CmdFailed(res) && CHANCE16(1, 3)) {
/* We can consider building on the slope, though. */
goto no_slope;
}