From 460772b31f09fd9f45345d419f2d6f6475b0d61a Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Mon, 11 Dec 2023 16:10:09 -0500 Subject: [PATCH] Enforce player limit on Direct Connection --- lang/Czech.ini | 1 - lang/Dutch.ini | 1 - lang/English.ini | 7 +++---- lang/French.ini | 1 - lang/German.ini | 1 - lang/Italian.ini | 1 - lang/Polish.ini | 1 - lang/Portuguese.ini | 1 - lang/Russian.ini | 1 - lang/SpanishES.ini | 1 - lang/SpanishUS.ini | 1 - src/pc/network/coopnet/coopnet.c | 2 +- src/pc/network/packets/packet_join.c | 2 +- 13 files changed, 5 insertions(+), 16 deletions(-) diff --git a/lang/Czech.ini b/lang/Czech.ini index 57bdf12c..c9124d06 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Nelze importovat mod, protože jste ve hře" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Nezdařilo se připojit na CoopNet!" COOPNET_DISCONNECTED = "\\#ffa0a0\\Ztratilo se připojení na CoopNet!" LOBBY_NOT_FOUND = "\\#ffa0a0\\Lobby už neexistuje!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\Lobby je plné!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\Nezdařilo se připojit na lobby!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Zadali jste špatné heslo!" COOPNET_VERSION = "\\#ffa0a0\\Vaše verze není kompatibilní s CoopNet. Aktualizujte si verzi!" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 062c4327..498fc84d 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Kan niet importen in een spel." COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Kon niet met CoopNet verbinden." COOPNET_DISCONNECTED = "\\#ffa0a0\\Connectie met CoopNet verloren." LOBBY_NOT_FOUND = "\\#ffa0a0\\Deze lobby bestaat niet meer." -LOBBY_JOIN_FULL = "\\#ffa0a0\\Deze lobby is vol." LOBBY_JOIN_FAILED = "\\#ffa0a0\\Gevaalt om met lobby te verbinden." LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Verkeerde lobby wachtwoord." COOPNET_VERSION = "\\#ffa0a0\\Jou versie kan niet meer met CoopNet verbinden. Update je game!" diff --git a/lang/English.ini b/lang/English.ini index 1a1c17f9..af59d0e0 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -7,9 +7,9 @@ ENTERED = "@ entered\n#" SERVER_CLOSED = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ Server closed" DISCORD_ERROR = "Discord threw an error.\nTo fix, try: \n1. Close the game.\n2. Restart Discord.\n3. Start the game." DISCORD_DETECT = "\\#ffa0a0\\Error:\\#dcdcdc\\ Could not detect Discord.\n\\#a0a0a0\\Try closing the game, restarting Discord, and opening the game again." -DISCONNECT_FULL = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ The party is full." -DISCONNECT_KICK = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ The server kicked you." -DISCONNECT_BAN = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ The server banned you." +DISCONNECT_FULL = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ The server is full." +DISCONNECT_KICK = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ You have been kicked." +DISCONNECT_BAN = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ You have been banned." DISCONNECT_REJOIN = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ Rejoining..." DISCONNECT_CLOSED = "\\#ffa0a0\\Disconnected:\\#dcdcdc\\ Host closed the connection." DISCONNECT_BIG_MOD = "Server had too large of a mod.\nQuitting." @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Can not import while in-game" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Could not connect to CoopNet!" COOPNET_DISCONNECTED = "\\#ffa0a0\\Lost connection to CoopNet!" LOBBY_NOT_FOUND = "\\#ffa0a0\\Error:\\#dcdcdc\\ Lobby no longer exists!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\The lobby is full!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\Failed to join the lobby!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Entered the wrong lobby password!" COOPNET_VERSION = "\\#ffa0a0\\Your version is no longer compatible with CoopNet. Update the game!" diff --git a/lang/French.ini b/lang/French.ini index d7103e2c..4b0704d2 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\L'importation ne peut pas se faire pendant la p COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\La connexion à CoopNet a échouée!" COOPNET_DISCONNECTED = "\\#ffa0a0\\Connexion à CoopNet perdue!" LOBBY_NOT_FOUND = "\\#ffa0a0\\Cette partie n'existe pas!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\Cette partie est complète!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\La connexion à la partie a échouée!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Mot de passe incorrect!" COOPNET_VERSION = "\\#ffa0a0\\Votre version n'est plus compatible avec CoopNet. Mettez à jour votre jeu!" diff --git a/lang/German.ini b/lang/German.ini index 78fa25cc..3edc5109 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Kann nicht im Spiel importieren." COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Verbindung zu CoopNet fehlgeschlagen!" COOPNET_DISCONNECTED = "\\#ffa0a0\\Verbindung zu CoopNet verloren!" LOBBY_NOT_FOUND = "\\#ffa0a0\\Diese Lobby existiert nicht mehr." -LOBBY_JOIN_FULL = "\\#ffa0a0\\Diese Lobby ist voll." LOBBY_JOIN_FAILED = "\\#ffa0a0\\Konnte der Lobby nicht beitreten!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Falsches Lobby-Passwort!" COOPNET_VERSION = "\\#ffa0a0\\Deine Version ist nicht kompatibel mit CoopNet. Bitte lade die neueste Version des Spiels herunter!" diff --git a/lang/Italian.ini b/lang/Italian.ini index f7d72ebf..b2ccc608 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Impossibile importare durante la partita" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Could not connect to CoopNet!" COOPNET_DISCONNECTED = "\\#ffa0a0\\Lost connection to CoopNet!" LOBBY_NOT_FOUND = "\\#ffa0a0\\The lobby no longer exists!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\The lobby is full!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\Failed to join the lobby!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Entered the wrong lobby password!" COOPNET_VERSION = "\\#ffa0a0\\Your version is no longer compatible with CoopNet. Update the game!" diff --git a/lang/Polish.ini b/lang/Polish.ini index 93140fcd..c52e631a 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Nie mozna importowac podczas gry" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Nie udalo sie polaczyc z CoopNetem!" COOPNET_DISCONNECTED = "\\#ffa0a0\\Utracono polaczenie z CoopNetem!" LOBBY_NOT_FOUND = "\\#ffa0a0\\Lobby juz nie istnieje!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\Lobby jest pelne!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\Nie udalo sie polaczyc z lobby!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Wprowadzono nieprawidlowe haslo!" COOPNET_VERSION = "\\#ffa0a0\\Twoja wersja gre nie jest juz kompatybilna z CoopNetem. Zaktualizuj gre!" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index 17d954cb..aa8745c3 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Falha ao importar durante o jogo" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Não foi possível se conectar ao CoopNet!" COOPNET_DISCONNECTED = "\\#ffa0a0\\A conexão ao CoopNet foi perdida!" LOBBY_NOT_FOUND = "\\#ffa0a0\\Essa partida não está mais ativa!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\A partida está cheia!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\Falha ao entrar na partida!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Senha incorreta!" COOPNET_VERSION = "\\#ffa0a0\\A sua versão não é mais compatível com o CoopNet. Atualize o jogo!" diff --git a/lang/Russian.ini b/lang/Russian.ini index 339c55c2..6c0f6189 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\Невозможно импортировать COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Не удалось установить соединение с CoopNet!" COOPNET_DISCONNECTED = "\\#ffa0a0\\Потеря соединения с CoopNet!" LOBBY_NOT_FOUND = "\\#ffa0a0\\Группа больше не существует!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\Группа заполнена!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\Не удалось присоединиться к Группе!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\Введен неверный пароль группы!" COOPNET_VERSION = "\\#ffa0a0\\Ваша версия больше не совместима с CoopNet. Обновите игру!" diff --git a/lang/SpanishES.ini b/lang/SpanishES.ini index 545b6775..ff0798a7 100644 --- a/lang/SpanishES.ini +++ b/lang/SpanishES.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\No se pueden importar archivos\nen medio de una COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\¡No se ha podido conectar a CoopNet!" COOPNET_DISCONNECTED = "\\#ffa0a0\\¡Se ha perdido la conexión a CoopNet!" LOBBY_NOT_FOUND = "\\#ffa0a0\\¡La partida ya no existe!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\¡La partida está llena!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\¡Error al unirse a la partida!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\¡Contraseña de partida incorrecta!" COOPNET_VERSION = "\\#ffa0a0\\Tu versión ya no es compatible con CoopNet. ¡Actualiza el juego!" diff --git a/lang/SpanishUS.ini b/lang/SpanishUS.ini index 12546242..476d1979 100644 --- a/lang/SpanishUS.ini +++ b/lang/SpanishUS.ini @@ -22,7 +22,6 @@ IMPORT_FAIL_INGAME = "\\#ffa0a0\\No se pueden importar archivos\nen medio de una COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\¡No se pudo conectar a CoopNet!" COOPNET_DISCONNECTED = "\\#ffa0a0\\¡Se perdió la conexión a CoopNet!" LOBBY_NOT_FOUND = "\\#ffa0a0\\¡La partida ya no existe!" -LOBBY_JOIN_FULL = "\\#ffa0a0\\¡La partida está llena!" LOBBY_JOIN_FAILED = "\\#ffa0a0\\¡Error al unirse a la partida!" LOBBY_PASSWORD_INCORRECT = "\\#ffa0a0\\¡Contraseña de partida incorrecta!" COOPNET_VERSION = "\\#ffa0a0\\Tu versión ya no es compatible con CoopNet. ¡Actualiza el juego!" diff --git a/src/pc/network/coopnet/coopnet.c b/src/pc/network/coopnet/coopnet.c index e831a2f3..9a5845f7 100644 --- a/src/pc/network/coopnet/coopnet.c +++ b/src/pc/network/coopnet/coopnet.c @@ -123,7 +123,7 @@ static void coopnet_on_error(enum MPacketErrorNumber error, uint64_t tag) { network_shutdown(false, false, false, false); break; case MERR_LOBBY_JOIN_FULL: - djui_popup_create(DLANG(NOTIF, LOBBY_JOIN_FULL), 2); + djui_popup_create(DLANG(NOTIF, DISCONNECT_FULL), 2); network_shutdown(false, false, false, false); break; case MERR_LOBBY_JOIN_FAILED: diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index 5525b4b2..d2f2c65e 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -86,7 +86,7 @@ void network_send_join(struct Packet* joinRequestPacket) { break; } } - if (globalIndex == UNKNOWN_LOCAL_INDEX) { + if (globalIndex == UNKNOWN_LOCAL_INDEX || globalIndex >= network_player_connected_count()) { network_send_kick(0, EKT_FULL_PARTY); return; }