Merge branch 'master' into jgrpp-beta
# Conflicts: # src/command.cpp # src/console_cmds.cpp # src/group_gui.cpp # src/lang/catalan.txt # src/lang/czech.txt # src/lang/danish.txt # src/lang/greek.txt # src/lang/hungarian.txt # src/lang/irish.txt # src/lang/japanese.txt # src/lang/luxembourgish.txt # src/lang/norwegian_bokmal.txt # src/lang/romanian.txt # src/lang/russian.txt # src/lang/serbian.txt # src/lang/simplified_chinese.txt # src/lang/slovak.txt # src/lang/spanish_MX.txt # src/lang/swedish.txt # src/lang/tamil.txt # src/lang/traditional_chinese.txt # src/lang/turkish.txt # src/lang/ukrainian.txt # src/lang/vietnamese.txt # src/network/network.cpp # src/network/network_client.cpp # src/network/network_func.h # src/network/network_internal.h # src/network/network_server.cpp # src/network/network_server.h # src/saveload/afterload.cpp # src/saveload/newgrf_sl.cpp # src/saveload/saveload.h # src/script/script_instance.cpp # src/toolbar_gui.cpp # src/toolbar_gui.h # src/vehicle_gui.cpp # src/widgets/rail_widget.h # src/widgets/vehicle_widget.h # src/window.cpp
This commit is contained in:
@@ -280,7 +280,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
|
||||
}
|
||||
|
||||
NetworkAdminClientError(this->client_id, NETWORK_ERROR_CONNECTION_LOST);
|
||||
DEBUG(net, 3, "Closed client connection %d", this->client_id);
|
||||
DEBUG(net, 3, "[%s] Client #%u closed connection", ServerNetworkGameSocketHandler::GetName(), this->client_id);
|
||||
|
||||
/* We just lost one client :( */
|
||||
if (this->status >= STATUS_AUTHORIZED) _network_game_info.clients_on--;
|
||||
@@ -712,6 +712,28 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat(NetworkAction action,
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a chat message from external source.
|
||||
* @param source Name of the source this message came from.
|
||||
* @param colour TextColour to use for the message.
|
||||
* @param user Name of the user who sent the messsage.
|
||||
* @param msg The actual message.
|
||||
*/
|
||||
NetworkRecvStatus ServerNetworkGameSocketHandler::SendExternalChat(const std::string &source, TextColour colour, const std::string &user, const std::string &msg)
|
||||
{
|
||||
if (this->status < STATUS_PRE_ACTIVE) return NETWORK_RECV_STATUS_OKAY;
|
||||
|
||||
Packet *p = new Packet(PACKET_SERVER_EXTERNAL_CHAT);
|
||||
|
||||
p->Send_string(source);
|
||||
p->Send_uint16(colour);
|
||||
p->Send_string(user);
|
||||
p->Send_string(msg);
|
||||
|
||||
this->SendPacket(p);
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the client another client quit with an error.
|
||||
* @param client_id The client that quit.
|
||||
@@ -1036,6 +1058,8 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *
|
||||
NetworkTextMessage(NETWORK_ACTION_JOIN, CC_DEFAULT, false, client_name, "", this->client_id);
|
||||
InvalidateWindowData(WC_CLIENT_LIST, 0);
|
||||
|
||||
DEBUG(net, 3, "[%s] Client #%u (%s) joined as %s", ServerNetworkGameSocketHandler::GetName(), this->client_id, this->GetClientIP(), client_name);
|
||||
|
||||
/* Mark the client as pre-active, and wait for an ACK
|
||||
* so we know it is done loading and in sync with us */
|
||||
this->status = STATUS_PRE_ACTIVE;
|
||||
@@ -1407,6 +1431,21 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a chat message from external source.
|
||||
* @param source Name of the source this message came from.
|
||||
* @param colour TextColour to use for the message.
|
||||
* @param user Name of the user who sent the messsage.
|
||||
* @param msg The actual message.
|
||||
*/
|
||||
void NetworkServerSendExternalChat(const std::string &source, TextColour colour, const std::string &user, const std::string &msg)
|
||||
{
|
||||
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
|
||||
cs->SendExternalChat(source, colour, user, msg);
|
||||
}
|
||||
NetworkTextMessage(NETWORK_ACTION_EXTERNAL_CHAT, colour, false, user, msg, {}, source.c_str());
|
||||
}
|
||||
|
||||
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet *p)
|
||||
{
|
||||
if (this->status < STATUS_PRE_ACTIVE) {
|
||||
|
Reference in New Issue
Block a user