Skip to content

Commit 2fddd18

Browse files
authored
Merge branch 'multitheftauto:master' into attach
2 parents 3895d00 + 92c3de3 commit 2fddd18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+600
-257
lines changed

Client/loader/Install.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,9 @@ static int RunInstall()
765765
// If the first attempt didn't work, check if any process is locking one of the files.
766766
TerminateFileLockingProcesses(file.targetFile.absolutePath, file.relativePath);
767767
TerminateFileLockingProcesses(file.sourceFile.absolutePath, file.relativePath);
768+
769+
// Ensure the checksum of the source file is correct (in case the archive reported checksum is invalid).
770+
file.sourceFile.ComputeChecksum();
768771
}
769772

770773
Sleep(OPERATION_RETRY_DELAY_IN_MS);

Client/mods/deathmatch/logic/CNetAPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,6 +2262,8 @@ void CNetAPI::ReadBulletsync(CClientPlayer* pPlayer, NetBitStreamInterface& BitS
22622262
// Read the bulletsync data
22632263
uchar ucWeapon = 0;
22642264
BitStream.Read(ucWeapon);
2265+
if (!CClientPickupManager::IsValidWeaponID(ucWeapon))
2266+
return;
22652267
eWeaponType weaponType = (eWeaponType)ucWeapon;
22662268

22672269
CVector vecStart, vecEnd;

Server/dbconmy/CDatabaseConnectionMySql.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,16 @@ CDatabaseConnectionMySql::CDatabaseConnectionMySql(CDatabaseType* pManager, cons
8080
const SString& strOptions)
8181
: m_iRefCount(1), m_pManager(pManager)
8282
{
83+
int getServerPublicKey;
84+
8385
// Parse options string
8486
CArgMap optionsMap("=", ";");
8587
optionsMap.SetFromString(strOptions);
8688
optionsMap.Get("autoreconnect", m_bAutomaticReconnect, 1);
8789
optionsMap.Get("batch", m_bAutomaticTransactionsEnabled, 1);
8890
optionsMap.Get("multi_statements", m_bMultipleStatements, 0);
8991
optionsMap.Get("use_ssl", m_bUseSSL, 0);
92+
optionsMap.Get("get_server_public_key", getServerPublicKey, 1);
9093

9194
SString strHostname;
9295
SString strDatabaseName;
@@ -115,6 +118,8 @@ CDatabaseConnectionMySql::CDatabaseConnectionMySql(CDatabaseType* pManager, cons
115118
mysql_options(m_handle, MYSQL_SET_CHARSET_NAME, strCharset);
116119
if (m_bMultipleStatements)
117120
ulClientFlags |= CLIENT_MULTI_STATEMENTS;
121+
bool getServerPublicKeyOpt = (getServerPublicKey != 0);
122+
mysql_options(m_handle, MYSQL_OPT_GET_SERVER_PUBLIC_KEY, &getServerPublicKeyOpt);
118123

119124
if (mysql_real_connect(m_handle, strHostname, strUsername, strPassword, strDatabaseName, iPort, strUnixSocket, ulClientFlags))
120125
m_bOpened = true;

Server/mods/deathmatch/logic/CMainConfig.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,7 @@ const std::vector<SIntSetting>& CMainConfig::GetIntSettingList()
14561456
{true, true, 50, 100, 400, "ped_syncer_distance", &g_TickRateSettings.iPedSyncerDistance, &CMainConfig::OnTickRateChange},
14571457
{true, true, 50, 130, 400, "unoccupied_vehicle_syncer_distance", &g_TickRateSettings.iUnoccupiedVehicleSyncerDistance, &CMainConfig::OnTickRateChange},
14581458
{true, true, 0, 30, 130, "vehicle_contact_sync_radius", &g_TickRateSettings.iVehicleContactSyncRadius, &CMainConfig::OnTickRateChange},
1459+
{true, true, 0, 200, 300, "object_contact_sync_radius", &g_TickRateSettings.iObjectContactSyncRadius, &CMainConfig::OnTickRateChange},
14591460
{false, false, 0, 1, 2, "compact_internal_databases", &m_iCompactInternalDatabases, NULL},
14601461
{true, true, 0, 1, 2, "minclientversion_auto_update", &m_iMinClientVersionAutoUpdate, NULL},
14611462
{true, true, 0, 0, 100, "server_logic_fps_limit", &m_iServerLogicFpsLimit, NULL},

Server/mods/deathmatch/logic/net/CSimBulletsyncPacket.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "StdInc.h"
1111
#include "SimHeaders.h"
12+
#include "CPickupManager.h"
1213

1314
CSimBulletsyncPacket::CSimBulletsyncPacket(ElementID PlayerID) : m_PlayerID(PlayerID)
1415
{
@@ -25,11 +26,9 @@ bool CSimBulletsyncPacket::Read(NetBitStreamInterface& BitStream)
2526
{
2627
char cWeaponType;
2728
BitStream.Read(cWeaponType);
28-
auto weaponType = static_cast<eWeaponType>(cWeaponType);
29-
if (!(weaponType >= WEAPONTYPE_UNARMED && weaponType < WEAPONTYPE_LAST_WEAPONTYPE))
29+
if (!CPickupManager::IsValidWeaponID(cWeaponType))
3030
return false;
31-
32-
m_Cache.weaponType = weaponType;
31+
m_Cache.weaponType = (eWeaponType)cWeaponType;
3332

3433
BitStream.Read((char*)&m_Cache.vecStart, sizeof(CVector));
3534
BitStream.Read((char*)&m_Cache.vecEnd, sizeof(CVector));

Server/mods/deathmatch/logic/net/CSimPlayerManager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,11 @@ bool CSimPlayerManager::HandleBulletSync(const NetServerPlayerID& Socket, NetBit
358358

359359
if (pPacket->Read(*BitStream))
360360
{
361-
// Relay it to nearbyers
362-
Broadcast(*pPacket, pSourceSimPlayer->GetPuresyncSendList());
361+
// Relay it to nearbyers, if the player really has this weapon
362+
if (pSourceSimPlayer->m_pRealPlayer->HasWeaponType(pPacket->m_Cache.weaponType))
363+
{
364+
Broadcast(*pPacket, pSourceSimPlayer->GetPuresyncSendList());
365+
}
363366
}
364367

365368
delete pPacket;

Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,30 @@ bool CPlayerPuresyncPacket::Read(NetBitStreamInterface& BitStream)
7777
if (!BitStream.Read(&position))
7878
return false;
7979

80-
if (pContactElement != nullptr &&
81-
(!IsPointNearPoint3D(pSourcePlayer->GetPosition(), pContactElement->GetPosition(), g_TickRateSettings.iVehicleContactSyncRadius) ||
82-
pSourcePlayer->GetDimension() != pContactElement->GetDimension()))
80+
if (pContactElement != nullptr)
8381
{
84-
pContactElement = nullptr;
85-
// Use current player position. They are not reporting their absolute position so we have to disregard it.
86-
position.data.vecPosition = pSourcePlayer->GetPosition();
82+
int32_t radius = -1;
83+
84+
switch (pContactElement->GetType())
85+
{
86+
case CElement::VEHICLE:
87+
if (((CVehicle*)pContactElement)->GetSyncer() != pSourcePlayer)
88+
radius = g_TickRateSettings.iVehicleContactSyncRadius;
89+
break;
90+
case CElement::OBJECT:
91+
if (((CObject*)pContactElement)->GetSyncer() != pSourcePlayer)
92+
radius = g_TickRateSettings.iObjectContactSyncRadius;
93+
break;
94+
}
95+
96+
if (radius > -1 &&
97+
(!IsPointNearPoint3D(pSourcePlayer->GetPosition(), pContactElement->GetPosition(), radius) ||
98+
pSourcePlayer->GetDimension() != pContactElement->GetDimension()))
99+
{
100+
pContactElement = nullptr;
101+
// Use current player position. They are not reporting their absolute position so we have to disregard it.
102+
position.data.vecPosition = pSourcePlayer->GetPosition();
103+
}
87104
}
88105

89106
CElement* pPreviousContactElement = pSourcePlayer->GetContactElement();

Server/mods/deathmatch/mtaserver.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@
139139
Available range: 0 to 130. Default - 30 -->
140140
<vehicle_contact_sync_radius>30</vehicle_contact_sync_radius>
141141

142+
<!-- This parameter specifies the radius in which any contact with a object will turn the player into its syncer.
143+
Available range: 0 to 300. Default - 200 -->
144+
<object_contact_sync_radius>200</object_contact_sync_radius>
145+
142146
<!-- This parameter sets the amount of extrapolation that clients will apply to remote vehicles. This can reduce
143147
some of the latency induced location disparency by predicting where the remote vehicles will probably be.
144148
Depending on the gamemode, an incorrect prediction may have a negative effect. Therefore this setting

Server/mods/deathmatch/mtaserver.conf.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@
140140
Available range: 0 to 130. Default - 30 -->
141141
<vehicle_contact_sync_radius>30</vehicle_contact_sync_radius>
142142

143+
<!-- This parameter specifies the radius in which any contact with a object will turn the player into its syncer.
144+
Available range: 0 to 300. Default - 200 -->
145+
<object_contact_sync_radius>200</object_contact_sync_radius>
146+
143147
<!-- This parameter sets the amount of extrapolation that clients will apply to remote vehicles. This can reduce
144148
some of the latency induced location disparency by predicting where the remote vehicles will probably be.
145149
Depending on the gamemode, an incorrect prediction may have a negative effect. Therefore this setting

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-05-23 17:55+0000\n"
11+
"POT-Creation-Date: 2024-06-06 17:33+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"
@@ -437,11 +437,11 @@ msgid ""
437437
"I want my PC to lag and be part of a botnet."
438438
msgstr ""
439439

440-
#: Client/loader/Dialogs.cpp:901 Client/loader/Install.cpp:849
440+
#: Client/loader/Dialogs.cpp:901 Client/loader/Install.cpp:852
441441
msgid "Installing update..."
442442
msgstr ""
443443

444-
#: Client/loader/Dialogs.cpp:909 Client/loader/Install.cpp:931
444+
#: Client/loader/Dialogs.cpp:909 Client/loader/Install.cpp:934
445445
msgid "Extracting files..."
446446
msgstr ""
447447

0 commit comments

Comments
 (0)