equal
deleted
inserted
replaced
383 DrawStringCentered(425, y, STR_NETWORK_PASSWORD, 0); // password warning |
383 DrawStringCentered(425, y, STR_NETWORK_PASSWORD, 0); // password warning |
384 } |
384 } |
385 |
385 |
386 y += 10; |
386 y += 10; |
387 } |
387 } |
388 } break; |
388 } break; |
389 |
389 |
390 case WE_CLICK: |
390 case WE_CLICK: |
391 nd->field = e->we.click.widget; |
391 nd->field = e->we.click.widget; |
392 switch (e->we.click.widget) { |
392 switch (e->we.click.widget) { |
393 case 0: case 14: /* Close 'X' | Cancel button */ |
393 case 0: case 14: /* Close 'X' | Cancel button */ |
450 break; |
450 break; |
451 case 18: // NewGRF Settings |
451 case 18: // NewGRF Settings |
452 if (nd->server != NULL) ShowNewGRFSettings(false, false, false, &nd->server->info.grfconfig); |
452 if (nd->server != NULL) ShowNewGRFSettings(false, false, false, &nd->server->info.grfconfig); |
453 break; |
453 break; |
454 |
454 |
455 } break; |
455 } break; |
456 |
456 |
457 case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
457 case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
458 switch (e->we.dropdown.button) { |
458 switch (e->we.dropdown.button) { |
459 case 5: |
459 case 5: |
460 _network_lan_internet = e->we.dropdown.index; |
460 _network_lan_internet = e->we.dropdown.index; |
642 pos++; |
642 pos++; |
643 y += NSSWND_ROWSIZE; |
643 y += NSSWND_ROWSIZE; |
644 |
644 |
645 if (y >= w->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break; |
645 if (y >= w->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break; |
646 } |
646 } |
647 } break; |
647 } break; |
648 |
648 |
649 case WE_CLICK: |
649 case WE_CLICK: |
650 nd->field = e->we.click.widget; |
650 nd->field = e->we.click.widget; |
651 switch (e->we.click.widget) { |
651 switch (e->we.click.widget) { |
652 case 0: /* Close 'X' */ |
652 case 0: /* Close 'X' */ |
787 ttd_strlcpy(_edit_str_buf, _network_server_name, lengthof(_edit_str_buf)); |
787 ttd_strlcpy(_edit_str_buf, _network_server_name, lengthof(_edit_str_buf)); |
788 |
788 |
789 _saveload_mode = SLD_NEW_GAME; |
789 _saveload_mode = SLD_NEW_GAME; |
790 BuildFileList(); |
790 BuildFileList(); |
791 w->vscroll.cap = 12; |
791 w->vscroll.cap = 12; |
792 w->vscroll.count = _fios_num+1; |
792 w->vscroll.count = _fios_num + 1; |
793 |
793 |
794 WP(w, network_ql_d).q.afilter = CS_ALPHANUMERAL; |
794 WP(w, network_ql_d).q.afilter = CS_ALPHANUMERAL; |
795 InitializeTextBuffer(&WP(w, network_ql_d).q.text, _edit_str_buf, lengthof(_edit_str_buf), 160); |
795 InitializeTextBuffer(&WP(w, network_ql_d).q.text, _edit_str_buf, lengthof(_edit_str_buf), 160); |
796 } |
796 } |
797 |
797 |
912 y += 10; |
912 y += 10; |
913 |
913 |
914 SetDParamStr(0, _network_player_info[nd->company].players); |
914 SetDParamStr(0, _network_player_info[nd->company].players); |
915 DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, 2, trunc_width); // players |
915 DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, 2, trunc_width); // players |
916 } |
916 } |
917 } break; |
917 } break; |
918 |
918 |
919 case WE_CLICK: |
919 case WE_CLICK: |
920 switch (e->we.click.widget) { |
920 switch (e->we.click.widget) { |
921 case 0: case 11: /* Close 'X' | Cancel button */ |
921 case 0: case 11: /* Close 'X' | Cancel button */ |
922 ShowNetworkGameWindow(); |
922 ShowNetworkGameWindow(); |
927 if (id_v >= w->vscroll.cap) return; |
927 if (id_v >= w->vscroll.cap) return; |
928 |
928 |
929 id_v += w->vscroll.pos; |
929 id_v += w->vscroll.pos; |
930 nd->company = (id_v >= nd->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v); |
930 nd->company = (id_v >= nd->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v); |
931 SetWindowDirty(w); |
931 SetWindowDirty(w); |
932 } break; |
932 } break; |
933 case 7: /* Join company */ |
933 case 7: /* Join company */ |
934 if (nd->company != (byte)-1) { |
934 if (nd->company != (byte)-1) { |
935 _network_playas = nd->company; |
935 _network_playas = nd->company; |
936 NetworkClientConnectGame(_network_last_host, _network_last_port); |
936 NetworkClientConnectGame(_network_last_host, _network_last_port); |
937 } |
937 } |
946 break; |
946 break; |
947 case 10: /* Refresh */ |
947 case 10: /* Refresh */ |
948 NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info |
948 NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info |
949 NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data |
949 NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data |
950 break; |
950 break; |
951 } break; |
951 } break; |
952 |
952 |
953 case WE_MESSAGE: |
953 case WE_MESSAGE: |
954 SetWindowDirty(w); |
954 SetWindowDirty(w); |
955 break; |
955 break; |
956 } |
956 } |
1263 colour = 0x10; |
1263 colour = 0x10; |
1264 } |
1264 } |
1265 |
1265 |
1266 DoDrawString(_clientlist_action[i], 4, y, colour); |
1266 DoDrawString(_clientlist_action[i], 4, y, colour); |
1267 } |
1267 } |
1268 } break; |
1268 } break; |
1269 |
1269 |
1270 case WE_POPUPMENU_SELECT: { |
1270 case WE_POPUPMENU_SELECT: { |
1271 // We selected an action |
1271 // We selected an action |
1272 int index = (e->we.popupmenu.pt.y - w->top) / CLNWND_ROWSIZE; |
1272 int index = (e->we.popupmenu.pt.y - w->top) / CLNWND_ROWSIZE; |
1273 |
1273 |
1274 if (index >= 0 && e->we.popupmenu.pt.y >= w->top) |
1274 if (index >= 0 && e->we.popupmenu.pt.y >= w->top) |
1275 HandleClientListPopupClick(index, WP(w,menu_d).main_button); |
1275 HandleClientListPopupClick(index, WP(w,menu_d).main_button); |
1276 |
1276 |
1277 DeleteWindowById(WC_TOOLBAR_MENU, 0); |
1277 DeleteWindowById(WC_TOOLBAR_MENU, 0); |
1278 } break; |
1278 } break; |
1279 |
1279 |
1280 case WE_POPUPMENU_OVER: { |
1280 case WE_POPUPMENU_OVER: { |
1281 // Our mouse hoovers over an action? Select it! |
1281 // Our mouse hoovers over an action? Select it! |
1282 int index = (e->we.popupmenu.pt.y - w->top) / CLNWND_ROWSIZE; |
1282 int index = (e->we.popupmenu.pt.y - w->top) / CLNWND_ROWSIZE; |
1283 |
1283 |
1325 |
1325 |
1326 DoDrawString(ci->client_name, 81, y, colour); |
1326 DoDrawString(ci->client_name, 81, y, colour); |
1327 |
1327 |
1328 y += CLNWND_ROWSIZE; |
1328 y += CLNWND_ROWSIZE; |
1329 } |
1329 } |
1330 } break; |
1330 } break; |
1331 |
1331 |
1332 case WE_CLICK: |
1332 case WE_CLICK: |
1333 // Show the popup with option |
1333 // Show the popup with option |
1334 if (_selected_clientlist_item != 255) { |
1334 if (_selected_clientlist_item != 255) { |
1335 PopupClientList(w, _selected_clientlist_item, e->we.click.pt.x + w->left, e->we.click.pt.y + w->top); |
1335 PopupClientList(w, _selected_clientlist_item, e->we.click.pt.x + w->left, e->we.click.pt.y + w->top); |
1418 progress = 15 + _network_join_kbytes * (100 - 15) / _network_join_kbytes_total; |
1418 progress = 15 + _network_join_kbytes * (100 - 15) / _network_join_kbytes_total; |
1419 } |
1419 } |
1420 |
1420 |
1421 /* Draw nice progress bar :) */ |
1421 /* Draw nice progress bar :) */ |
1422 DrawFrameRect(20, 18, (int)((w->width - 20) * progress / 100), 28, 10, FR_NONE); |
1422 DrawFrameRect(20, 18, (int)((w->width - 20) * progress / 100), 28, 10, FR_NONE); |
1423 } break; |
1423 } break; |
1424 |
1424 |
1425 case WE_CLICK: |
1425 case WE_CLICK: |
1426 switch (e->we.click.widget) { |
1426 switch (e->we.click.widget) { |
1427 case 2: /* Disconnect button */ |
1427 case 2: /* Disconnect button */ |
1428 NetworkDisconnect(); |
1428 NetworkDisconnect(); |