Update lobby info on rehost

This commit is contained in:
MysterD 2023-04-16 19:36:27 -07:00
parent 0cf453f347
commit 5337f206f0
3 changed files with 5 additions and 3 deletions

View file

@ -50,6 +50,7 @@ CoopNetRc coopnet_begin(const char* aHost, uint32_t aPort);
CoopNetRc coopnet_shutdown(void);
CoopNetRc coopnet_update(void);
CoopNetRc coopnet_lobby_create(const char* aGame, const char* aVersion, const char* aHostName, const char* aMode, uint16_t aMaxConnections, const char* aPassword);
CoopNetRc coopnet_lobby_update(uint64_t aLobbyId, const char* aGame, const char* aVersion, const char* aHostName, const char* aMode);
CoopNetRc coopnet_lobby_join(uint64_t aLobbyId, const char* aPassword);
CoopNetRc coopnet_lobby_leave(uint64_t aLobbyId);
CoopNetRc coopnet_lobby_list_get(const char* aGame, const char* aPassword);

Binary file not shown.

View file

@ -145,12 +145,13 @@ void ns_coopnet_update(void) {
coopnet_update();
if (gNetworkType != NT_NONE && sNetworkType != NT_NONE) {
if (sNetworkType == NT_SERVER) {
if (sReconnecting) {
// TODO: send lobby update packet
} else {
LOG_INFO("Create lobby");
char mode[64] = "";
mods_get_main_mod_name(mode, 64);
if (sReconnecting) {
LOG_INFO("Update lobby");
coopnet_lobby_update(sLocalLobbyId, CN_GAME_STR, get_version(), configPlayerName, mode);
} else {
LOG_INFO("Create lobby");
snprintf(gCoopNetPassword, 64, "%s", configPassword);
coopnet_lobby_create(CN_GAME_STR, get_version(), configPlayerName, mode, (uint16_t)configAmountofPlayers, gCoopNetPassword);
}