summaryrefslogtreecommitdiff
path: root/misc_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-28 09:24:02 +0000
committertruelight <truelight@openttd.org>2004-12-28 09:24:02 +0000
commit15d188d7f83e3d090ccd8f24807d55dd4dc56946 (patch)
tree390251afe63fa4a46d59dd7366ef7aa9b3aa9f03 /misc_cmd.c
parent8dcbf2675b784ac3a060c046c10dc393c52f2772 (diff)
downloadopenttd-15d188d7f83e3d090ccd8f24807d55dd4dc56946.tar.xz
(svn r1284) -Fix: Fixed 'money-cheat' (read: bug which could give people a lot of money)
Diffstat (limited to 'misc_cmd.c')
-rw-r--r--misc_cmd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/misc_cmd.c b/misc_cmd.c
index defba53ea..1ea3ffeef 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -285,6 +285,11 @@ int32 CmdGiveMoney(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
SET_EXPENSES_TYPE(EXPENSES_OTHER);
+ p1 = clamp(p1, 0, 0xFFFFFFFF); // Clamp between 4 billion and 0
+
+ if (p1 == 0)
+ return CMD_ERROR;
+
if (flags & DC_EXEC) {
// Add money to player
byte old_cp = _current_player;