Commit 64a6b8ee authored by nanahira's avatar nanahira

refa server host thing

parent 7789a96d
......@@ -37,7 +37,7 @@ std::uniform_real_distribution<float> DuelClient::real_dist;
bool DuelClient::is_refreshing = false;
int DuelClient::match_kill = 0;
std::vector<HostPacket> DuelClient::hosts;
std::vector<std::wstring> DuelClient::hosts;
std::vector<std::wstring> DuelClient::hosts_srvpro;
std::set<std::pair<unsigned int, unsigned short>> DuelClient::remotes;
event* DuelClient::resp_event = 0;
......@@ -4395,7 +4395,14 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
mainGame->gMutex.lock();
remotes.insert(remote);
pHP->ipaddr = ipaddr;
hosts.push_back(*pHP);
wchar_t host_fulladdr[100];
myswprintf(host_fulladdr, L"%d.%d.%d.%d:%d",
ipaddr & 0xff,
(ipaddr >> 8) & 0xff,
(ipaddr >> 16) & 0xff,
(ipaddr >> 24) & 0xff,
pHP->port);
hosts.push_back(std::wstring(host_fulladdr));
std::wstring hoststr;
hoststr.append(L"[");
hoststr.append(deckManager.GetLFListName(pHP->host.lflist));
......
......@@ -128,7 +128,7 @@ public:
bufferevent_write(client_bev, duel_client_write, len + 3);
}
static std::vector<HostPacket> hosts;
static std::vector<std::wstring> hosts;
static std::vector<std::wstring> hosts_srvpro;
static bool is_srvpro;
static void BeginRefreshHost();
......
......@@ -497,11 +497,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->ebJoinPass->setText(DuelClient::hosts_srvpro[sel].c_str());
break;
}
int addr = DuelClient::hosts[sel].ipaddr;
int port = DuelClient::hosts[sel].port;
wchar_t buf[22];
myswprintf(buf, L"%d.%d.%d.%d:%d", addr & 0xff, (addr >> 8) & 0xff, (addr >> 16) & 0xff, (addr >> 24) & 0xff, port);
mainGame->ebJoinHost->setText(buf);
mainGame->ebJoinHost->setText(DuelClient::hosts[sel].c_str());
break;
}
case LISTBOX_REPLAY_LIST: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment