From cc2a967969c77ee091c3d98f5e0710b9b9ffdad5 Mon Sep 17 00:00:00 2001 From: hilnius Date: Thu, 25 Jul 2013 01:14:22 +0000 Subject: [PATCH] adding back some things in uni's code that i had removed for debugging git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13342 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/online/current_user.cpp | 6 +++++- src/online/current_user.hpp | 2 +- src/online/servers_manager.cpp | 4 +++- src/online/servers_manager.hpp | 2 +- src/states_screens/online_screen.cpp | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/online/current_user.cpp b/src/online/current_user.cpp index 72fc682b9..22bed2e67 100644 --- a/src/online/current_user.cpp +++ b/src/online/current_user.cpp @@ -213,7 +213,9 @@ namespace Online{ // ============================================================================ - CurrentUser::ServerJoinRequest * CurrentUser::requestServerJoin(uint32_t server_id){ + CurrentUser::ServerJoinRequest * CurrentUser::requestServerJoin(uint32_t server_id, + bool request_now) + { assert(m_state == US_SIGNED_IN || m_state == US_GUEST); ServerJoinRequest * request = new ServerJoinRequest(); request->setURL((std::string)UserConfigParams::m_server_multiplayer + "address-management.php"); @@ -221,6 +223,8 @@ namespace Online{ request->setParameter("token", m_token); request->setParameter("id", m_id); request->setParameter("server_id", server_id); + if (request_now) + HTTPManager::get()->addRequest(request); return request; } diff --git a/src/online/current_user.hpp b/src/online/current_user.hpp index afdb3b70a..6efd48002 100644 --- a/src/online/current_user.hpp +++ b/src/online/current_user.hpp @@ -109,7 +109,7 @@ namespace Online{ bool request_now = true); SignOutRequest * requestSignOut(); ServerCreationRequest * requestServerCreation( const irr::core::stringw &name, int max_players); - ServerJoinRequest * requestServerJoin( uint32_t server_id); + ServerJoinRequest * requestServerJoin( uint32_t server_id, bool request_now = true); // Register diff --git a/src/online/servers_manager.cpp b/src/online/servers_manager.cpp index d6d30eab5..4a51d7e3c 100644 --- a/src/online/servers_manager.cpp +++ b/src/online/servers_manager.cpp @@ -80,7 +80,7 @@ namespace Online{ } // ============================================================================ - ServersManager::RefreshRequest * ServersManager::refreshRequest() + ServersManager::RefreshRequest * ServersManager::refreshRequest(bool request_now) { RefreshRequest * request = NULL; if(Time::getRealTime() - m_last_load_time > SERVER_REFRESH_INTERVAL) @@ -88,6 +88,8 @@ namespace Online{ request = new RefreshRequest(); request->setURL((std::string)UserConfigParams::m_server_multiplayer + "client-user.php"); request->setParameter("action",std::string("get_server_list")); + if (request_now) + HTTPManager::get()->addRequest(request); } return request; } diff --git a/src/online/servers_manager.hpp b/src/online/servers_manager.hpp index af2d175e7..769052dbd 100644 --- a/src/online/servers_manager.hpp +++ b/src/online/servers_manager.hpp @@ -69,7 +69,7 @@ namespace Online { static void release(); static void deallocate(); - RefreshRequest * refreshRequest(); + RefreshRequest * refreshRequest(bool request_now = true); void setJoinedServer(uint32_t server_id); void unsetJoinedServer(); void addServer(Server * server); diff --git a/src/states_screens/online_screen.cpp b/src/states_screens/online_screen.cpp index 114db84a3..a1259b518 100644 --- a/src/states_screens/online_screen.cpp +++ b/src/states_screens/online_screen.cpp @@ -238,7 +238,7 @@ void OnlineScreen::eventCallback(Widget* widget, const std::string& name, const Server * server = ServersManager::acquire()->getQuickPlay(); ServersManager::release(); - Online::CurrentUser::ServerJoinRequest* request2 = Online::CurrentUser::acquire()->requestServerJoin( server->getServerId()); + Online::CurrentUser::ServerJoinRequest* request2 = Online::CurrentUser::acquire()->requestServerJoin( server->getServerId(), false); Online::CurrentUser::release(); if (request2) {