32 #include "statusbar_gui.h" |
32 #include "statusbar_gui.h" |
33 #include "variables.h" |
33 #include "variables.h" |
34 #include "tilehighlight_func.h" |
34 #include "tilehighlight_func.h" |
35 |
35 |
36 #include "network/network.h" |
36 #include "network/network.h" |
37 #include "network/network_data.h" |
37 #include "network/network_func.h" |
38 #include "network/network_client.h" |
|
39 #include "network/network_server.h" |
|
40 #include "network/network_gui.h" |
38 #include "network/network_gui.h" |
41 |
39 |
42 #include "table/sprites.h" |
40 #include "table/sprites.h" |
43 #include "table/strings.h" |
41 #include "table/strings.h" |
44 |
42 |
46 static int _rename_what = -1; |
44 static int _rename_what = -1; |
47 |
45 |
48 void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2) |
46 void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2) |
49 { |
47 { |
50 #ifdef ENABLE_NETWORK |
48 #ifdef ENABLE_NETWORK |
51 if (!success || !_settings.economy.give_money) return; |
49 if (!success || !_settings_game.economy.give_money) return; |
52 |
50 |
53 char msg[20]; |
51 char msg[20]; |
54 /* Inform the player of this action */ |
52 /* Inform the player of this action */ |
55 snprintf(msg, sizeof(msg), "%d", p1); |
53 snprintf(msg, sizeof(msg), "%d", p1); |
56 |
54 |
57 if (!_network_server) { |
55 if (!_network_server) { |
58 SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg); |
56 NetworkClientSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg); |
59 } else { |
57 } else { |
60 NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, NETWORK_SERVER_INDEX); |
58 NetworkServerSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, NETWORK_SERVER_INDEX); |
61 } |
59 } |
62 #endif /* ENABLE_NETWORK */ |
60 #endif /* ENABLE_NETWORK */ |
63 } |
61 } |
64 |
62 |
65 void HandleOnEditText(const char *str) |
63 void HandleOnEditText(const char *str) |
342 bool teamchat = false; |
340 bool teamchat = false; |
343 |
341 |
344 if (cio == NULL) break; |
342 if (cio == NULL) break; |
345 |
343 |
346 /* Only players actually playing can speak to team. Eg spectators cannot */ |
344 /* Only players actually playing can speak to team. Eg spectators cannot */ |
347 if (_settings.gui.prefer_teamchat && IsValidPlayer(cio->client_playas)) { |
345 if (_settings_client.gui.prefer_teamchat && IsValidPlayer(cio->client_playas)) { |
348 const NetworkClientInfo *ci; |
346 const NetworkClientInfo *ci; |
349 FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
347 FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { |
350 if (ci->client_playas == cio->client_playas && ci != cio) { |
348 if (ci->client_playas == cio->client_playas && ci != cio) { |
351 teamchat = true; |
349 teamchat = true; |
352 break; |
350 break; |