refactor lobby_connect code + return! + set appid via env var (not needed but just in case)

This commit is contained in:
otavepto 2024-04-23 02:03:57 +02:00
parent 3dc17a8bc4
commit 425baa4e2a

View File

@ -34,7 +34,14 @@
#endif #endif
int main() { int main() {
if (SteamAPI_Init()) { std::string appid_str(std::to_string(LOBBY_CONNECT_APPID));
set_env_variable("SteamAppId", appid_str);
set_env_variable("SteamGameId", appid_str);
if (!SteamAPI_Init()) {
return 1;
}
//Set appid to: LOBBY_CONNECT_APPID //Set appid to: LOBBY_CONNECT_APPID
SteamAPI_RestartAppIfNecessary(LOBBY_CONNECT_APPID); SteamAPI_RestartAppIfNecessary(LOBBY_CONNECT_APPID);
std::cout << "This is a program to find lobbies and run the game with lobby connect parameters" << std::endl; std::cout << "This is a program to find lobbies and run the game with lobby connect parameters" << std::endl;
@ -161,5 +168,6 @@ top:
#else #else
std::cout << "Please launch the game with these arguments: " << connect << std::endl; std::cout << "Please launch the game with these arguments: " << connect << std::endl;
#endif #endif
}
return 0;
} }