summaryrefslogtreecommitdiff
path: root/misc_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-04 17:54:56 +0000
committertruelight <truelight@openttd.org>2004-12-04 17:54:56 +0000
commitd6a1f3e412834c52b09e297cffc36d0776cb7a92 (patch)
tree68d3e795694a875138c369707ed74b5b4b022d49 /misc_cmd.c
parentc90bba35a23204c47151cf0ab97b16d8a124dabe (diff)
downloadopenttd-d6a1f3e412834c52b09e297cffc36d0776cb7a92.tar.xz
(svn r942) -Merged branch/network back into the trunk
Diffstat (limited to 'misc_cmd.c')
-rw-r--r--misc_cmd.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/misc_cmd.c b/misc_cmd.c
index e62a98741..defba53ea 100644
--- a/misc_cmd.c
+++ b/misc_cmd.c
@@ -8,6 +8,7 @@
#include "window.h"
#include "saveload.h"
#include "economy.h"
+#include "network.h"
/* p1 = player
p2 = face
@@ -124,7 +125,7 @@ int32 CmdChangeCompanyName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str,old_str;
Player *p;
- str = AllocateName((byte*)_decode_parameters, 4);
+ str = AllocateNameUnique((byte*)_decode_parameters, 4);
if (str == 0)
return CMD_ERROR;
@@ -146,7 +147,7 @@ int32 CmdChangePresidentName(int x, int y, uint32 flags, uint32 p1, uint32 p2)
StringID str,old_str;
Player *p;
- str = AllocateName((byte*)_decode_parameters, 4);
+ str = AllocateNameUnique((byte*)_decode_parameters, 4);
if (str == 0)
return CMD_ERROR;
@@ -228,7 +229,7 @@ int32 CmdRenameSign(int x, int y, uint32 flags, uint32 p1, uint32 p2)
SignStruct *ss;
if (_decode_parameters[0] != 0 && !p2) {
- str = AllocateName((byte*)_decode_parameters, 0);
+ str = AllocateNameUnique((byte*)_decode_parameters, 0);
if (str == 0)
return CMD_ERROR;
@@ -280,6 +281,22 @@ int32 CmdMoneyCheat(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return (int32)p1;
}
+int32 CmdGiveMoney(int x, int y, uint32 flags, uint32 p1, uint32 p2)
+{
+ SET_EXPENSES_TYPE(EXPENSES_OTHER);
+
+ if (flags & DC_EXEC) {
+ // Add money to player
+ byte old_cp = _current_player;
+ _current_player = p2;
+ SubtractMoneyFromPlayer(-(int32)p1);
+ _current_player = old_cp;
+ }
+
+ // Subtract money from local-player
+ return (int32)p1;
+}
+
int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{
if (flags & DC_EXEC) {
@@ -289,6 +306,9 @@ int32 CmdChangeDifficultyLevel(int x, int y, uint32 flags, uint32 p1, uint32 p2)
} else {
_opt_mod_ptr->diff_level = p2;
}
+ // If we are a network-client, update the difficult setting (if it is open)
+ if (_networking && !_network_server && FindWindowById(WC_GAME_OPTIONS, 0) != NULL)
+ memcpy(&_opt_mod_temp, _opt_mod_ptr, sizeof(GameOptions));
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
return 0;