diff options
author | belugas <belugas@openttd.org> | 2008-06-30 16:59:35 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2008-06-30 16:59:35 +0000 |
commit | ac3896feaf31a6155f648c401b1b84c5c8a6aadf (patch) | |
tree | 84950285274c3c5970cc24ceb6020c526177ca19 /src | |
parent | f06daceb164842557f861b253b35d51e4d3664e9 (diff) | |
download | openttd-ac3896feaf31a6155f648c401b1b84c5c8a6aadf.tar.xz |
(svn r13665) -Fix[FS#2119]: Wrong PlayerID used for sending a message to.Patch by Yexo
Diffstat (limited to 'src')
-rw-r--r-- | src/console_cmds.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 4589dd579..38d765ef4 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1184,15 +1184,16 @@ DEF_CONSOLE_CMD(ConSayPlayer) if (argc != 3) return false; - if (atoi(argv[1]) < 1 || atoi(argv[1]) > MAX_PLAYERS) { + PlayerID player_id = (PlayerID)(atoi(argv[1]) - 1); + if (!IsValidPlayer(player_id) || !GetPlayer(player_id)->is_active) { IConsolePrintF(CC_DEFAULT, "Unknown player. Player range is between 1 and %d.", MAX_PLAYERS); return true; } if (!_network_server) { - NetworkClientSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2]); + NetworkClientSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, player_id, argv[2]); } else { - NetworkServerSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX); + NetworkServerSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, player_id, argv[2], NETWORK_SERVER_INDEX); } return true; |