Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
NetPlay: Allow building a server without a game
This isn't hooked up in the UI yet, but it will allow us to
basically start the server and chat system without choosing
a game.
  • Loading branch information
magcius committed Jul 22, 2013
1 parent 2631ec3 commit 6d463d1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/NetPlay.h
Expand Up @@ -183,7 +183,7 @@ class NetPlayServer : public NetPlay
public:
void ThreadFunc();

NetPlayServer(const u16 port, const std::string& name, NetPlayUI* dialog, const std::string& game = "");
NetPlayServer(const u16 port, const std::string& name, NetPlayUI* dialog);
~NetPlayServer();

void GetPlayerList(std::string& list, std::vector<int>& pid_list);
Expand Down
16 changes: 8 additions & 8 deletions Source/Core/Core/Src/NetPlayServer.cpp
Expand Up @@ -22,10 +22,8 @@ NetPlayServer::~NetPlayServer()
}

// called from ---GUI--- thread
NetPlayServer::NetPlayServer(const u16 port, const std::string& name, NetPlayUI* dialog, const std::string& game) : NetPlay(dialog)
NetPlayServer::NetPlayServer(const u16 port, const std::string& name, NetPlayUI* dialog) : NetPlay(dialog)
{
m_selected_game = game;

m_update_pings = true;

if (m_socket.Listen(port))
Expand Down Expand Up @@ -229,10 +227,13 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
socket.Send(spac);

// send new client the selected game
spac.Clear();
spac << (MessageId)NP_MSG_CHANGE_GAME;
spac << m_selected_game;
socket.Send(spac);
if (m_selected_game != "")
{
spac.Clear();
spac << (MessageId)NP_MSG_CHANGE_GAME;
spac << m_selected_game;
socket.Send(spac);
}

// sync values with new client
for (i = m_players.begin(); i!=e; ++i)
Expand Down Expand Up @@ -801,4 +802,3 @@ bool NetPlayServer::UPnPUnmapPort(const u16 port)
return true;
}
#endif

4 changes: 2 additions & 2 deletions Source/Core/DolphinWX/Src/NetWindow.cpp
Expand Up @@ -220,8 +220,8 @@ void NetPlaySetupDiag::OnHost(wxCommandEvent&)
npd = new NetPlayDiag(m_parent, m_game_list, game, true);
unsigned long port = 0;
m_host_port_text->GetValue().ToULong(&port);
netplay_ptr = new NetPlayServer(u16(port)
, WxStrToStr(m_nickname_text->GetValue()), npd, game);
netplay_ptr = new NetPlayServer(u16(port), WxStrToStr(m_nickname_text->GetValue()), npd);
netplay_ptr->ChangeGame(game);
if (netplay_ptr->is_connected)
{
#ifdef USE_UPNP
Expand Down

0 comments on commit 6d463d1

Please sign in to comment.