small fixes to let server joining work. (temporary version though.)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/uni@13315 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
unitraxx 2013-07-22 00:23:42 +00:00
parent 20e6fe74b2
commit bf2d907ccf
2 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,7 @@
#include "config/user_config.hpp"
#include "utils/translation.hpp"
#include "utils/log.hpp"
#include "online/servers_manager.hpp"
namespace Online{
static Synchronised<CurrentUser*> user_singleton(NULL);
@ -209,6 +210,7 @@ namespace Online{
request->setParameter("token", m_token);
request->setParameter("id", m_id);
request->setParameter("server_id", server_id);
HTTPManager::get()->addRequest(request);
return request;
}

View File

@ -64,7 +64,8 @@ ServerInfoDialog::ServerInfoDialog(Server * server, bool join) :
m_cancel_widget = getWidget<IconButtonWidget>("cancel");
assert(m_cancel_widget != NULL);
m_options_widget->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
requestJoin();
if (join)
requestJoin();
}
// -----------------------------------------------------------------------------
@ -75,7 +76,7 @@ ServerInfoDialog::~ServerInfoDialog()
// -----------------------------------------------------------------------------
void ServerInfoDialog::requestJoin()
{
Online::CurrentUser::acquire()->requestServerJoin(m_server->getServerId());
m_server_join_request = Online::CurrentUser::acquire()->requestServerJoin(m_server->getServerId());
Online::CurrentUser::release();
}
@ -122,6 +123,8 @@ void ServerInfoDialog::onUpdate(float dt)
{
if(m_server_join_request->isSuccess())
{
ServersManager::acquire()->setJoinedServer(m_server);
ServersManager::release();
m_enter_lobby = true;
}
else
@ -148,7 +151,9 @@ void ServerInfoDialog::onUpdate(float dt)
{
ModalDialog::dismiss();
if (m_enter_lobby)
{
StateManager::get()->pushScreen(NetworkingLobby::getInstance());
}
return;
}
}