equal
deleted
inserted
replaced
85 INVALID_STRING_ID |
85 INVALID_STRING_ID |
86 }; |
86 }; |
87 |
87 |
88 static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL}; |
88 static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL}; |
89 |
89 |
90 void SortNetworkLanguages() { |
90 void SortNetworkLanguages() |
|
91 { |
91 /* Init the strings */ |
92 /* Init the strings */ |
92 if (_language_dropdown[0] == STR_NULL) { |
93 if (_language_dropdown[0] == STR_NULL) { |
93 for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i; |
94 for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i; |
94 _language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID; |
95 _language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID; |
95 } |
96 } |
1131 } |
1132 } |
1132 |
1133 |
1133 |
1134 |
1134 |
1135 |
1135 // Help, a action is clicked! What do we do? |
1136 // Help, a action is clicked! What do we do? |
1136 static void HandleClientListPopupClick(byte index, byte clientno) { |
1137 static void HandleClientListPopupClick(byte index, byte clientno) |
|
1138 { |
1137 // A click on the Popup of the ClientList.. handle the command |
1139 // A click on the Popup of the ClientList.. handle the command |
1138 if (index < MAX_CLIENTLIST_ACTION && _clientlist_proc[index] != NULL) { |
1140 if (index < MAX_CLIENTLIST_ACTION && _clientlist_proc[index] != NULL) { |
1139 _clientlist_proc[index](clientno); |
1141 _clientlist_proc[index](clientno); |
1140 } |
1142 } |
1141 } |
1143 } |
1164 } |
1166 } |
1165 return true; |
1167 return true; |
1166 } |
1168 } |
1167 |
1169 |
1168 // Finds the amount of actions in the popup and set the height correct |
1170 // Finds the amount of actions in the popup and set the height correct |
1169 static uint ClientListPopupHeigth() { |
1171 static uint ClientListPopupHeight() |
|
1172 { |
1170 int i, num = 0; |
1173 int i, num = 0; |
1171 |
1174 |
1172 // Find the amount of actions |
1175 // Find the amount of actions |
1173 for (i = 0; i < MAX_CLIENTLIST_ACTION; i++) { |
1176 for (i = 0; i < MAX_CLIENTLIST_ACTION; i++) { |
1174 if (_clientlist_action[i][0] == '\0') continue; |
1177 if (_clientlist_action[i][0] == '\0') continue; |
1234 GetString(_clientlist_action[i], STR_NETWORK_CLIENTLIST_NONE, lastof(_clientlist_action[i])); |
1237 GetString(_clientlist_action[i], STR_NETWORK_CLIENTLIST_NONE, lastof(_clientlist_action[i])); |
1235 _clientlist_proc[i++] = &ClientList_None; |
1238 _clientlist_proc[i++] = &ClientList_None; |
1236 } |
1239 } |
1237 |
1240 |
1238 /* Calculate the height */ |
1241 /* Calculate the height */ |
1239 h = ClientListPopupHeigth(); |
1242 h = ClientListPopupHeight(); |
1240 |
1243 |
1241 // Allocate the popup |
1244 // Allocate the popup |
1242 w = AllocateWindow(x, y, 150, h + 1, ClientListPopupWndProc, WC_TOOLBAR_MENU, _client_list_popup_widgets); |
1245 w = AllocateWindow(x, y, 150, h + 1, ClientListPopupWndProc, WC_TOOLBAR_MENU, _client_list_popup_widgets); |
1243 w->widget[0].bottom = w->widget[0].top + h; |
1246 w->widget[0].bottom = w->widget[0].top + h; |
1244 w->widget[0].right = w->widget[0].left + 150; |
1247 w->widget[0].right = w->widget[0].left + 150; |
1484 if (w != NULL) w->parent = FindWindowById(WC_NETWORK_WINDOW, 0); |
1487 if (w != NULL) w->parent = FindWindowById(WC_NETWORK_WINDOW, 0); |
1485 } |
1488 } |
1486 |
1489 |
1487 static void SendChat(const char *buf, DestType type, int dest) |
1490 static void SendChat(const char *buf, DestType type, int dest) |
1488 { |
1491 { |
1489 if (buf[0] == '\0') return; |
1492 if (StrEmpty(buf)) return; |
1490 if (!_network_server) { |
1493 if (!_network_server) { |
1491 SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf); |
1494 SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf); |
1492 } else { |
1495 } else { |
1493 NetworkServer_HandleChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX); |
1496 NetworkServer_HandleChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX); |
1494 } |
1497 } |