Skip to content

Commit 8b44e2a

Browse files
authored
Merge branch 'master' into client_c20
2 parents 7daf065 + 53deb03 commit 8b44e2a

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

Client/core/CGUI.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ CLocalGUI::~CLocalGUI()
5656

5757
void CLocalGUI::SetSkin(const char* szName)
5858
{
59+
CVector2D consolePos, consoleSize;
60+
5961
bool guiWasLoaded = m_pMainMenu != NULL;
6062
if (guiWasLoaded)
63+
{
64+
consolePos = m_pConsole->GetPosition();
65+
consoleSize = m_pConsole->GetSize();
6166
DestroyWindows();
67+
}
6268

6369
std::string error;
6470

@@ -93,7 +99,11 @@ void CLocalGUI::SetSkin(const char* szName)
9399
m_LastSettingsRevision = cvars->GetRevision();
94100

95101
if (guiWasLoaded)
102+
{
96103
CreateWindows(guiWasLoaded);
104+
m_pConsole->SetPosition(consolePos);
105+
m_pConsole->SetSize(consoleSize);
106+
}
97107

98108
if (CCore::GetSingleton().GetConsole() && !error.empty())
99109
CCore::GetSingleton().GetConsole()->Echo(error.c_str());
@@ -104,8 +114,8 @@ void CLocalGUI::ChangeLocale(const char* szName)
104114
bool guiWasLoaded = m_pMainMenu != NULL;
105115
assert(guiWasLoaded);
106116

107-
CVector2D vPos = m_pConsole->GetPosition();
108-
CVector2D vSize = m_pConsole->GetSize();
117+
CVector2D consolePos = m_pConsole->GetPosition();
118+
CVector2D consoleSize = m_pConsole->GetSize();
109119

110120
if (guiWasLoaded)
111121
DestroyWindows();
@@ -119,12 +129,8 @@ void CLocalGUI::ChangeLocale(const char* szName)
119129
if (guiWasLoaded)
120130
{
121131
CreateWindows(guiWasLoaded);
122-
123-
if (m_pConsole != nullptr)
124-
{
125-
m_pConsole->SetPosition(vPos);
126-
m_pConsole->SetSize(vSize);
127-
}
132+
m_pConsole->SetPosition(consolePos);
133+
m_pConsole->SetSize(consoleSize);
128134
}
129135
}
130136

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#include "version.h"
7272
#include "net/SimHeaders.h"
7373
#include <signal.h>
74+
#include <regex>
7475

7576
#define MAX_BULLETSYNC_DISTANCE 400.0f
7677
#define MAX_EXPLOSION_SYNC_DISTANCE 400.0f
@@ -1783,7 +1784,21 @@ void CGame::Packet_PlayerJoinData(CPlayerJoinDataPacket& Packet)
17831784

17841785
SString strIP = pPlayer->GetSourceIP();
17851786
SString strIPAndSerial("IP: %s Serial: %s Version: %s", strIP.c_str(), strSerial.c_str(), strPlayerVersion.c_str());
1786-
if (!CheckNickProvided(szNick)) // check the nick is valid
1787+
1788+
// Prevent player from connecting if serial is invalid
1789+
const std::regex serialRegex("^[A-F0-9]{32}$");
1790+
if (!std::regex_match(strSerial, serialRegex))
1791+
{
1792+
// Tell the console
1793+
CLogger::LogPrintf("CONNECT: %s failed to connect (Invalid serial) (%s)\n", szNick, strIPAndSerial.c_str());
1794+
1795+
// Tell the player the problem
1796+
DisconnectPlayer(this, *pPlayer, CPlayerDisconnectedPacket::SERIAL_VERIFICATION);
1797+
return;
1798+
}
1799+
1800+
// Check the nick is valid
1801+
if (!CheckNickProvided(szNick))
17871802
{
17881803
// Tell the console
17891804
CLogger::LogPrintf("CONNECT: %s failed to connect (Invalid nickname) (%s)\n", szNick, strIPAndSerial.c_str());

Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: MTA San Andreas 1.x\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2024-10-10 20:57+0000\n"
11+
"POT-Creation-Date: 2024-10-18 20:00+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -298,7 +298,7 @@ msgstr ""
298298
#: Client/loader/MainFunctions.cpp:252 Client/loader/MainFunctions.cpp:267
299299
#: Client/loader/MainFunctions.cpp:269 Client/loader/MainFunctions.cpp:846
300300
#: Client/loader/CInstallManager.cpp:552 Client/loader/CInstallManager.cpp:561
301-
#: Client/core/CGUI.cpp:87 Client/core/CCore.cpp:1275
301+
#: Client/core/CGUI.cpp:93 Client/core/CCore.cpp:1275
302302
#: Client/core/CCore.cpp:1288 Client/core/CSettings.cpp:2941
303303
#: Client/core/CSettings.cpp:4166 Client/core/CSettings.cpp:4194
304304
#: Client/core/CSettings.cpp:4764 Client/core/CConnectManager.cpp:80
@@ -1818,7 +1818,7 @@ msgid "English"
18181818
msgstr ""
18191819

18201820
#. Even the default skin doesn't work, so give up
1821-
#: Client/core/CGUI.cpp:86
1821+
#: Client/core/CGUI.cpp:92
18221822
msgid ""
18231823
"The skin you selected could not be loaded, and the default skin also could "
18241824
"not be loaded, please reinstall MTA."

0 commit comments

Comments
 (0)