summaryrefslogtreecommitdiff
path: root/misc_cmd.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-05-30 14:45:36 +0000
committerDarkvater <Darkvater@openttd.org>2005-05-30 14:45:36 +0000
commit9c552d16317a7fe1ff4516c5021ebd0e7c82b906 (patch)
treea5b5323b899dcbd198167576e63285356aead5e3 /misc_cmd.c
parent3d9ff47f93cf3205912f8655725351e860d92af2 (diff)
downloadopenttd-9c552d16317a7fe1ff4516c5021ebd0e7c82b906.tar.xz
(svn r2383) - Fix: Monkey-testing turned up some command crashes.
Diffstat (limited to 'misc_cmd.c')
-rw-r--r--misc_cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/misc_cmd.c b/misc_cmd.c
index e26b4b346..eeae8e0c1 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -256,7 +256,7 @@ int32 CmdGiveMoney(int x, int y, uint32 flags, uint32 p1, uint32 p2)
*/
int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
- if ((int32)p1 >= GAME_DIFFICULTY_NUM && p1 != (uint32)-1L) return CMD_ERROR;
+ if (p1 != (uint32)-1L && ((int32)p1 >= GAME_DIFFICULTY_NUM || (int32)p1 < 0)) return CMD_ERROR;
if (flags & DC_EXEC) {
if (p1 != (uint32)-1L) {
@@ -267,7 +267,7 @@ int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
/* If we are a network-client, update the difficult setting (if it is open).
* Use this instead of just dirtying the window because we need to load in
- * the new difficulty settings */
+ * the new difficulty settings */
if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL)
ShowGameDifficulty();
}