(svn r10085) -Fix [FS#839]: message that you had given money appeared even when an error occured.
authorrubidium
Sun, 10 Jun 2007 20:49:11 +0000
changeset 6845 0c64af3ae68f
parent 6844 ee73775d49d2
child 6846 175bf19b9def
(svn r10085) -Fix [FS#839]: message that you had given money appeared even when an error occured.
src/main_gui.cpp
--- a/src/main_gui.cpp	Sun Jun 10 20:27:28 2007 +0000
+++ b/src/main_gui.cpp	Sun Jun 10 20:49:11 2007 +0000
@@ -80,7 +80,8 @@
 		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);