Changeset - r4945:e7f1f2433fec
[Not reviewed]
master
0 4 0
Darkvater - 18 years ago 2006-10-24 22:26:20
darkvater@openttd.org
(svn r6933) -Feature: Allow spectators to speak to eachother (team)
4 files changed with 12 insertions and 7 deletions:
0 comments (0 inline, 0 general)
lang/english.txt
Show inline comments
 
@@ -1442,12 +1442,13 @@ STR_NETWORK_CHAT_ALL                    
 
STR_NETWORK_NAME_CHANGE                                         :has changed his/her name to
 
STR_NETWORK_SERVER_SHUTDOWN                                     :{WHITE} The server closed the session
 
STR_NETWORK_SERVER_REBOOT                                       :{WHITE} The server is restarting...{}Please wait...
 

	
 
STR_NETWORK_SERVER                                              :Server
 
STR_NETWORK_CLIENT                                              :Client
 
STR_NETWORK_SPECTATORS                                          :Spectators
 

	
 
STR_NETWORK_CLIENTLIST_NONE                                     :(none)
 
STR_NETWORK_CLIENTLIST_KICK                                     :Kick
 
STR_NETWORK_CLIENTLIST_GIVE_MONEY                               :Give money
 
STR_NETWORK_CLIENTLIST_SPEAK_TO_ALL                             :Speak to all
 
STR_NETWORK_CLIENTLIST_SPEAK_TO_COMPANY                         :Speak to company
network_client.c
Show inline comments
 
@@ -620,20 +620,23 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER
 
		switch (action) {
 
			case NETWORK_ACTION_CHAT_CLIENT:
 
				/* For speak to client we need the client-name */
 
				snprintf(name, sizeof(name), "%s", ci_to->client_name);
 
				ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
 
				break;
 
			case NETWORK_ACTION_CHAT_COMPANY:
 

	
 
			/* For speaking to company or giving money, we need the player-name */
 
			case NETWORK_ACTION_GIVE_MONEY:
 
				/* For speaking to player or give money, we need the player-name */
 
				if (!IsValidPlayer(ci_to->client_playas)) return NETWORK_RECV_STATUS_OKAY; // This should never happen
 
				if (!IsValidPlayer(ci_to->client_playas)) return NETWORK_RECV_STATUS_OKAY;
 
				/* fallthrough */
 
			case NETWORK_ACTION_CHAT_COMPANY: {
 
				StringID str = IsValidPlayer(ci_to->client_playas) ? GetPlayer(ci_to->client_playas)->name_1 : STR_NETWORK_SPECTATORS;
 

	
 
				GetString(name, GetPlayer(ci_to->client_playas)->name_1, lastof(name));
 
				GetString(name, str, lastof(name));
 
				ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
 
				break;
 
			} break;
 
			default:
 
				/* This should never happen */
 
				NOT_REACHED();
 
				break;
 
		}
 
	} else {
network_gui.c
Show inline comments
 
@@ -1182,13 +1182,13 @@ static Window *PopupClientList(Window *w
 
	i = 0;
 
	if (_network_own_client_index != ci->client_index) {
 
		GetString(_clientlist_action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_CLIENT, lastof(_clientlist_action[i]));
 
		_clientlist_proc[i++] = &ClientList_SpeakToClient;
 
	}
 

	
 
	if (IsValidPlayer(ci->client_playas)) {
 
	if (IsValidPlayer(ci->client_playas) || ci->client_playas == PLAYER_SPECTATOR) {
 
		GetString(_clientlist_action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_COMPANY, lastof(_clientlist_action[i]));
 
		_clientlist_proc[i++] = &ClientList_SpeakToCompany;
 
	}
 
	GetString(_clientlist_action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_ALL, lastof(_clientlist_action[i]));
 
	_clientlist_proc[i++] = &ClientList_SpeakToAll;
 

	
network_server.c
Show inline comments
 
@@ -1041,13 +1041,14 @@ void NetworkServer_HandleChat(NetworkAct
 
		if (ci_to == NULL) break;
 

	
 
		// Display the message locally (so you know you have sent it)
 
		if (ci != NULL && show_local) {
 
			if (from_index == NETWORK_SERVER_INDEX) {
 
				char name[NETWORK_NAME_LENGTH];
 
				GetString(name, GetPlayer(ci_to->client_playas)->name_1, lastof(name));
 
				StringID str = IsValidPlayer(ci_to->client_playas) ? GetPlayer(ci_to->client_playas)->name_1 : STR_NETWORK_SPECTATORS;
 
				GetString(name, str, lastof(name));
 
				NetworkTextMessage(action, GetDrawStringPlayerColor(ci_own->client_playas), true, name, "%s", msg);
 
			} else {
 
				FOR_ALL_CLIENTS(cs) {
 
					if (cs->index == from_index) {
 
						SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, ci_to->client_index, true, msg);
 
					}
0 comments (0 inline, 0 general)