diff --git a/src/LScreens.c b/src/LScreens.c index cb03278a0..ad987250c 100644 --- a/src/LScreens.c +++ b/src/LScreens.c @@ -508,7 +508,7 @@ static void DirectConnectScreen_StartClient(void* w) { Options_ResumeSaving(); LLabel_SetConst(status, ""); - Launcher_StartGame(user, mppass, &ip, &port, &String_Empty); + Launcher_StartGame(user, mppass, &ip, &port, &String_Empty, 1); } static void DirectConnectScreen_Activated(struct LScreen* s_) { @@ -650,9 +650,7 @@ LAYOUTS sps_btnBack[] = { { ANCHOR_CENTRE, 0 }, { ANCHOR_CENTRE, 170 } }; static void SplitScreen_Start(int players) { static const cc_string user = String_FromConst(DEFAULT_USERNAME); - Game_NumStates = players; - - Launcher_StartGame(&user, &String_Empty, &String_Empty, &String_Empty, &String_Empty); + Launcher_StartGame(&user, &String_Empty, &String_Empty, &String_Empty, &String_Empty, players); } static void SplitScreen_Players2(void* w) { SplitScreen_Start(2); } @@ -794,7 +792,7 @@ static void MainScreen_Resume(void* w) { MainScreen_GetResume(&info, true); if (!info.valid) return; - Launcher_StartGame(&info.user, &info.mppass, &info.ip, &info.port, &info.server); + Launcher_StartGame(&info.user, &info.mppass, &info.ip, &info.port, &info.server, 1); } static void MainScreen_Singleplayer(void* w) { @@ -802,7 +800,7 @@ static void MainScreen_Singleplayer(void* w) { const cc_string* user = &MainScreen.iptUsername.text; if (!user->length) user = &defUser; - Launcher_StartGame(user, &String_Empty, &String_Empty, &String_Empty, &String_Empty); + Launcher_StartGame(user, &String_Empty, &String_Empty, &String_Empty, &String_Empty, 1); } static void MainScreen_ResumeHover(void* w) { diff --git a/src/Launcher.c b/src/Launcher.c index 21641f7bd..1bf43d022 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -78,7 +78,7 @@ void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_s *--------------------------------------------------------Starter/Updater--------------------------------------------------* *#########################################################################################################################*/ static cc_uint64 lastJoin; -cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server) { +cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server, int numStates) { cc_string args[4]; int numArgs; cc_uint64 now; cc_result res; @@ -110,6 +110,10 @@ cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const numArgs = 4; } +#ifdef CC_BUILD_SPLITSCREEN + Game_NumStates = numStates; +#endif + res = Process_StartGame2(args, numArgs); if (res) { Logger_SysWarn(res, "starting game"); return false; } @@ -123,7 +127,7 @@ CC_NOINLINE static void StartFromInfo(struct ServerInfo* info) { String_InitArray(port, portBuffer); String_AppendInt(&port, info->port); - Launcher_StartGame(&Launcher_Username, &info->mppass, &info->ip, &port, &info->name); + Launcher_StartGame(&Launcher_Username, &info->mppass, &info->ip, &port, &info->name, 1); } static void ConnectToServerError(struct HttpRequest* req) { diff --git a/src/Launcher.h b/src/Launcher.h index 86abdf9c8..8b3e0b2af 100644 --- a/src/Launcher.h +++ b/src/Launcher.h @@ -76,7 +76,7 @@ cc_bool Launcher_ConnectToServer(const cc_string* hash); /* Launcher main loop. */ void Launcher_Run(void); /* Starts the game from the given arguments. */ -cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server); +cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server, int numStates); /* Prints information about a http error to dst. (for status widget) */ /* If req->result is non-zero, also displays a dialog box on-screen. */ void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_string* dst);