diff options
author | truebrain <truebrain@openttd.org> | 2011-12-19 20:50:44 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-19 20:50:44 +0000 |
commit | 5cda1d7c90f7ac2a1d8a851edbe426f07a032946 (patch) | |
tree | 49cf84b2640c39bca5b7dad70f3e19c481f7025f /src/network | |
parent | 577fe0238e7f4681fdf96b8aed241908a9f72de9 (diff) | |
download | openttd-5cda1d7c90f7ac2a1d8a851edbe426f07a032946.tar.xz |
(svn r23603) -Add: support for control commands in strings, in both network and safe/load (Rubidium)
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_command.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp index 070e810d8..02ee6acf8 100644 --- a/src/network/network_command.cpp +++ b/src/network/network_command.cpp @@ -294,16 +294,16 @@ const char *NetworkGameSocketHandler::ReceiveCommand(Packet *p, CommandPacket *c { cp->company = (CompanyID)p->Recv_uint8(); cp->cmd = p->Recv_uint32(); + if (!IsValidCommand(cp->cmd)) return "invalid command"; + if (GetCommandFlags(cp->cmd) & CMD_OFFLINE) return "offline only command"; + if ((cp->cmd & CMD_FLAGS_MASK) != 0) return "invalid command flag"; + cp->p1 = p->Recv_uint32(); cp->p2 = p->Recv_uint32(); cp->tile = p->Recv_uint32(); - p->Recv_string(cp->text, lengthof(cp->text)); + p->Recv_string(cp->text, lengthof(cp->text), (!_network_server && GetCommandFlags(cp->cmd) & CMD_STR_CTRL) != 0 ? SVS_ALLOW_CONTROL_CODE | SVS_REPLACE_WITH_QUESTION_MARK : SVS_REPLACE_WITH_QUESTION_MARK); byte callback = p->Recv_uint8(); - - if (!IsValidCommand(cp->cmd)) return "invalid command"; - if (GetCommandFlags(cp->cmd) & CMD_OFFLINE) return "offline only command"; - if ((cp->cmd & CMD_FLAGS_MASK) != 0) return "invalid command flag"; if (callback >= lengthof(_callback_table)) return "invalid callback"; cp->callback = _callback_table[callback]; |