WX: Somewhat fix lan link. Advance wars won't link properly whereas it is working with mem link.

This commit is contained in:
bgk 2012-09-02 14:26:22 +00:00
parent cf02712b34
commit 00791f6801
1 changed files with 28 additions and 18 deletions

View File

@ -121,19 +121,25 @@ public:
sig->Signal(); sig->Signal();
lock->Unlock(); lock->Unlock();
} }
} sid(&lock, &sig, &connmsg, &pmsg, &done); };
if(!ls.Init(&sid)) {
wxLogError(_("Error occurred.\nPlease try again.")); sid_t* sid = new sid_t(&lock, &sig, &connmsg, &pmsg, &done);
lock.Unlock();
return; if (!ls.Init(sid)) {
wxLogError(_("Error occurred.\nPlease try again."));
lock.Unlock();
delete sid;
return;
} }
wxProgressDialog wxProgressDialog
pdlg(_("Waiting for clients..."), connmsg, pdlg(_("Waiting for clients..."), connmsg,
100, dlg, wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ELAPSED_TIME); 100, dlg, wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ELAPSED_TIME);
while(!done) { while(!done) {
if(!pdlg.Pulse(connmsg + pmsg)) if(!pdlg.Pulse(connmsg + pmsg))
done = true; done = true;
sig.Wait(); sig.Wait();
} }
} else { } else {
class cid_t : public ClientInfoDisplay class cid_t : public ClientInfoDisplay
@ -175,21 +181,25 @@ public:
sig->Signal(); sig->Signal();
lock->Unlock(); lock->Unlock();
} }
} cid(&lock, &sig, &connmsg, &pmsg, &done); };
int err;
if((err = lc.Init(sf::IPAddress(std::string(gopts.link_host.mb_str())), cid_t* cid = new cid_t(&lock, &sig, &connmsg, &pmsg, &done);
&cid))) {
wxLogError(_("Error %d occurred.\nPlease try again."), err); if (!lc.Init(sf::IPAddress(std::string(gopts.link_host.mb_str())), cid)) {
lock.Unlock(); wxLogError(_("Error occurred.\nPlease try again."));
return; lock.Unlock();
delete cid;
return;
} }
wxProgressDialog wxProgressDialog
pdlg(_("Waiting for connection..."), connmsg, pdlg(_("Waiting for connection..."), connmsg,
100, dlg, wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ELAPSED_TIME); 100, dlg, wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ELAPSED_TIME);
while(!done) { while(!done) {
if(!pdlg.Pulse(connmsg + pmsg)) if(!pdlg.Pulse(connmsg + pmsg))
done = true; done = true;
sig.Wait(); sig.Wait();
} }
} }
lock.Unlock(); lock.Unlock();