summaryrefslogtreecommitdiff
path: root/src/players.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-04-20 21:36:41 +0000
committerglx <glx@openttd.org>2008-04-20 21:36:41 +0000
commitf7d3d879c56c1eb0aa8b8eebf4f8086cf42253c8 (patch)
tree068081c9a858e2f2dce3969640801876b14b97db /src/players.cpp
parentfccfcd093b2b4e38ac08d9acb0930e9d57f36c82 (diff)
downloadopenttd-f7d3d879c56c1eb0aa8b8eebf4f8086cf42253c8.tar.xz
(svn r12808) -Fix: enforce autorenew values range in command
-Fix: typo in english.txt
Diffstat (limited to 'src/players.cpp')
-rw-r--r--src/players.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/players.cpp b/src/players.cpp
index fc696c5b2..7c8af009b 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -670,6 +670,7 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
}
break;
case 1:
+ if (Clamp((int16)p2, -12, 12) != (int16)p2) return CMD_ERROR;
if (p->engine_renew_months == (int16)p2)
return CMD_ERROR;
@@ -682,6 +683,7 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
}
break;
case 2:
+ if (ClampU(p2, 0, 2000000) != p2) return CMD_ERROR;
if (p->engine_renew_money == (uint32)p2)
return CMD_ERROR;
@@ -730,6 +732,8 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
}
case 4:
+ if (Clamp((int16)GB(p1, 16, 16), -12, 12) != (int16)GB(p1, 16, 16)) return CMD_ERROR;
+ if (ClampU(p2, 0, 2000000) != p2) return CMD_ERROR;
if (flags & DC_EXEC) {
p->engine_renew = HasBit(p1, 15);
p->engine_renew_months = (int16)GB(p1, 16, 16);