summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-10 20:49:11 +0000
committerrubidium <rubidium@openttd.org>2007-06-10 20:49:11 +0000
commita0ffa793cc99116e5f8b12b29c42f2bef4233c34 (patch)
tree60372137a776cee49919327b0a08e0a656a63408
parent77b06e922fcb9d8a23e8fab3f07fc377c3c2a275 (diff)
downloadopenttd-a0ffa793cc99116e5f8b12b29c42f2bef4233c34.tar.xz
(svn r10085) -Fix [FS#839]: message that you had given money appeared even when an error occured.
-rw-r--r--src/main_gui.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 84540598d..ddf394318 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -80,7 +80,8 @@ void HandleOnEditText(const char *str)
money = clamp(money, 0, 20000000); // Clamp between 20 million and 0
/* Give 'id' the money, and substract it from ourself */
- if (!DoCommandP(0, money, id, NULL, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS))) break;
+ int32 ret = DoCommandP(0, money, id, NULL, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS));
+ if (CmdFailed(ret) || ret == 0) break; // We either did something wrong, or we don't have any money anymore
/* Inform the player of this action */
snprintf(msg, sizeof(msg), "%d", money);