Remove --online and clarify global networking

This commit is contained in:
Benau 2018-08-21 09:52:54 +08:00
parent 1610158405
commit d984409c6b
6 changed files with 40 additions and 53 deletions

View File

@ -559,7 +559,14 @@ void cmdLineHelp()
" --aiNP=a,b,... Use the karts a, b, ... for the AI, no additional player kart.\n"
" --laps=N Define number of laps to N.\n"
" --mode=N N=1 Beginner, N=2 Intermediate, N=3 Expert, N=4 SuperTux.\n"
" --type=N N=0 Normal, N=1 Time trial, N=2 Follow The Leader\n"
" --type=N N=0 Normal, N=1 Time trial, N=2 Battle, N=3 Soccer,\n"
" N=4 Follow The Leader. In configure server use --battle-mode=n\n"
" for battle server and --soccer-timed / goals for soccer server\n"
" to control verbosely, see below:\n"
" --battle-mode=n Specify battle mode in netowrk, 0 is Free-For-All and\n"
" 1 is Capture The Flag.\n"
" --soccer-timed Use time limit mode in network soccer game.\n"
" --soccer-goals Use goals limit mode in network soccer game.\n"
" --reverse Play track in reverse (if allowed)\n"
" -f, --fullscreen Use fullscreen display.\n"
" -w, --windowed Use windowed display (default).\n"
@ -610,10 +617,6 @@ void cmdLineHelp()
" --team-choosing Allow choosing team in lobby, implicitly allowed in lan or\n"
" password protected server. This function cannot be used in\n"
" owner-less server.\n"
" --soccer-timed Use time limit mode in network soccer game.\n"
" --soccer-goals Use goals limit mode in network soccer game.\n"
" --battle-mode=n Specify battle mode in netowrk, 0 is Free For All and\n"
" 1 is Capture The Flag.\n"
" --network-gp=n Specify number of tracks used in network grand prix.\n"
" --no-validation Allow non validated and unencrypted connection in wan.\n"
" --ranked Server will submit ranking to stk addons server.\n"
@ -737,7 +740,7 @@ int handleCmdLinePreliminary()
if(CommandLine::has("--debug=all") )
UserConfigParams::m_verbosity |= UserConfigParams::LOG_ALL;
if(CommandLine::has("--online"))
MainMenuScreen::m_enable_online=true;
History::m_online_history_replay = true;
#if !(defined(SERVER_ONLY) || defined(ANDROID))
if(CommandLine::has("--apitrace"))
{
@ -1553,7 +1556,7 @@ int handleCmdLine()
history->setReplayHistory(true);
// Force the no-start screen flag, since this initialises
// the player structures correctly.
if(!MainMenuScreen::m_enable_online)
if (!History::m_online_history_replay)
UserConfigParams::m_no_start_screen = true;
} // --history
@ -2100,7 +2103,7 @@ int main(int argc, char *argv[] )
{
// This will setup the race manager etc.
history->Load();
if (!MainMenuScreen::m_enable_online)
if (!History::m_online_history_replay)
{
race_manager->setupPlayerKartInfo();
race_manager->startNew(false);

View File

@ -28,12 +28,11 @@
#include "network/rewind_manager.hpp"
#include "physics/physics.hpp"
#include "race/race_manager.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "tracks/track.hpp"
#include "utils/constants.hpp"
History* history = 0;
bool History::m_online_history_replay = false;
//-----------------------------------------------------------------------------
/** Initialises the history object and sets the mode to none.
*/
@ -272,7 +271,7 @@ void History::Load()
if(sscanf(s, "model %d: %1023s",&n, s1) != 2)
Log::fatal("History", "No model information for kart %d found.", i);
m_kart_ident.push_back(s1);
if(i<race_manager->getNumPlayers() && !MainMenuScreen::m_enable_online)
if(i<race_manager->getNumPlayers() && !m_online_history_replay)
{
race_manager->setPlayerKart(i, s1);
}

View File

@ -62,6 +62,7 @@ private:
void allocateMemory(int size=-1);
public:
static bool m_online_history_replay;
History ();
void initRecording ();
void Save ();

View File

@ -68,8 +68,6 @@
using namespace GUIEngine;
using namespace Online;
bool MainMenuScreen::m_enable_online = false;
// ----------------------------------------------------------------------------
MainMenuScreen::MainMenuScreen() : Screen("main_menu.stkgui")
@ -497,25 +495,8 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
"\"Connect to the Internet\"."));
return;
}
// Define this to require a login to the stk server (default behaviour)
// Undefine for testing LAN only.
if (MainMenuScreen::m_enable_online)
{
OnlineScreen::getInstance()->push();
}
else
{
if (PlayerManager::getCurrentOnlineId())
{
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
TabOnlineProfileAchievements::getInstance()->push();
}
else
{
UserScreen::getInstance()->push();
}
}
}
else if (selection == "addons")
{
// Don't go to addons if there is no internet, unless some addons are

View File

@ -38,9 +38,6 @@ private:
MainMenuScreen();
public:
/** Temporary disable the online menu while it is being worked at. */
static bool m_enable_online;
virtual void onUpdate(float delta) OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */

View File

@ -73,6 +73,23 @@ void OnlineScreen::loadedFromFile()
void OnlineScreen::beforeAddingWidget()
{
} // beforeAddingWidget
// ----------------------------------------------------------------------------
//
void OnlineScreen::init()
{
Screen::init();
m_online = getWidget<IconButtonWidget>("online");
assert(m_online);
m_user_id = getWidget<ButtonWidget>("user-id");
assert(m_user_id);
RibbonWidget* r = getWidget<RibbonWidget>("menu_toprow");
r->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
bool is_logged_in = false;
if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST ||
PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN)
@ -84,26 +101,15 @@ void OnlineScreen::beforeAddingWidget()
if (wan)
{
wan->setActive(is_logged_in);
wan->setVisible(is_logged_in);
}
} // beforeAddingWidget
// ----------------------------------------------------------------------------
//
void OnlineScreen::init()
if (!is_logged_in)
{
Screen::init();
m_online = getWidget<IconButtonWidget>("online");
if (!MainMenuScreen::m_enable_online)
m_online->setActive(false);
m_user_id = getWidget<ButtonWidget>("user-id");
assert(m_user_id);
RibbonWidget* r = getWidget<RibbonWidget>("menu_toprow");
r->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
//I18N: Shown to players when he is not is not logged in
wan->setTooltip(_("You must be logged in to play Global "
"networking. Click your username above."));
}
else
wan->setTooltip("");
}
// Pre-add a default single player profile in network
if (!m_enable_splitscreen->getState() &&