Skip to content

Commit 70bd41d

Browse files
Synchronize changes from 1.6 master branch [ci skip]
7e6b4d0 Fix #3635 meta.xml file path patterns don't work on html files (#3780) 1fcd732 Fix #3026 Changing vehicle model can cause network trouble (#3784)
2 parents c13acc4 + 7e6b4d0 commit 70bd41d

File tree

3 files changed

+46
-26
lines changed

3 files changed

+46
-26
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,10 @@ void CClientPed::WarpIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat)
13941394
}
13951395
}
13961396

1397+
// Wrong seat or undefined passengers count?
1398+
if ((uiSeat > 0 && uiSeat > pVehicle->m_ucMaxPassengers) || (uiSeat > 0 && pVehicle->m_ucMaxPassengers == 255))
1399+
return;
1400+
13971401
// Transfer WaitingForGroundToLoad state to vehicle
13981402
if (m_bIsLocalPlayer)
13991403
{

Client/mods/deathmatch/logic/CClientVehicle.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,12 @@ void CClientVehicle::Create()
26562656
{
26572657
if (m_pPassengers[i])
26582658
{
2659-
m_pPassengers[i]->WarpIntoVehicle(this, i + 1);
2659+
// Undefined passengers count?
2660+
if (m_ucMaxPassengers != 255)
2661+
m_pPassengers[i]->WarpIntoVehicle(this, i + 1);
2662+
else
2663+
m_pPassengers[i]->SetWarpInToVehicleRequired(false);
2664+
26602665
if (m_pPassengers[i])
26612666
m_pPassengers[i]->StreamIn(true);
26622667
}

Server/mods/deathmatch/logic/CResource.cpp

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,44 +1465,55 @@ bool CResource::ReadIncludedHTML(CXMLNode* pRoot)
14651465

14661466
if (!strFilename.empty())
14671467
{
1468-
std::string strFullFilename;
14691468
ReplaceSlashes(strFilename);
14701469

1471-
if (IsFilenameUsed(strFilename, false))
1470+
if (!IsValidFilePath(strFilename.c_str()))
14721471
{
1473-
CLogger::LogPrintf("WARNING: Duplicate html file in resource '%s': '%s'\n", m_strResourceName.c_str(), strFilename.c_str());
1472+
m_strFailureReason = SString("Couldn't find html %s for resource %s\n", strFilename.c_str(), m_strResourceName.c_str());
1473+
CLogger::ErrorPrintf(m_strFailureReason);
1474+
return false;
14741475
}
14751476

1476-
// Try to find the file
1477-
if (IsValidFilePath(strFilename.c_str()) && GetFilePath(strFilename.c_str(), strFullFilename))
1477+
std::vector<std::string> vecFiles = GetFilePaths(strFilename.c_str());
1478+
if (vecFiles.empty())
14781479
{
1479-
// This one is supposed to be default, but there's already a default page
1480-
if (bFoundDefault && bIsDefault)
1480+
if (glob::has_magic(strFilename))
14811481
{
1482-
CLogger::LogPrintf("Only one html item can be default per resource, ignoring %s in %s\n", strFilename.c_str(),
1483-
m_strResourceName.c_str());
1484-
bIsDefault = false;
1482+
m_ResourceFilesCountPerDir[strFilename] = vecFiles.size();
1483+
continue;
14851484
}
14861485

1487-
// If this is supposed to be default, we've now found our default page
1488-
if (bIsDefault)
1489-
bFoundDefault = true;
1490-
1491-
// Create a new resource HTML file and add it to the list
1492-
auto pResourceFile = new CResourceHTMLItem(this, strFilename.c_str(), strFullFilename.c_str(), &Attributes, bIsDefault, bIsRaw,
1493-
bIsRestricted, m_bOOPEnabledInMetaXml);
1494-
m_ResourceFiles.push_back(pResourceFile);
1495-
1496-
// This is the first HTML file? Remember it
1497-
if (!pFirstHTML)
1498-
pFirstHTML = pResourceFile;
1499-
}
1500-
else
1501-
{
15021486
m_strFailureReason = SString("Couldn't find html %s for resource %s\n", strFilename.c_str(), m_strResourceName.c_str());
15031487
CLogger::ErrorPrintf(m_strFailureReason);
15041488
return false;
15051489
}
1490+
1491+
for (const std::string& strFilePath : vecFiles)
1492+
{
1493+
std::string strFullFilename;
1494+
1495+
if (GetFilePath(strFilePath.c_str(), strFullFilename))
1496+
{
1497+
// This one is supposed to be default, but there's already a default page
1498+
if (bFoundDefault && bIsDefault)
1499+
{
1500+
CLogger::LogPrintf("Only one html item can be default per resource, ignoring %s in %s\n", strFilename.c_str(), m_strResourceName.c_str());
1501+
bIsDefault = false;
1502+
}
1503+
1504+
// If this is supposed to be default, we've now found our default page
1505+
if (bIsDefault)
1506+
bFoundDefault = true;
1507+
1508+
// Create a new resource HTML file and add it to the list
1509+
auto pResourceFile = new CResourceHTMLItem(this, strFilename.c_str(), strFullFilename.c_str(), &Attributes, bIsDefault, bIsRaw, bIsRestricted, m_bOOPEnabledInMetaXml);
1510+
m_ResourceFiles.push_back(pResourceFile);
1511+
1512+
// This is the first HTML file? Remember it
1513+
if (!pFirstHTML)
1514+
pFirstHTML = pResourceFile;
1515+
}
1516+
}
15061517
}
15071518
else
15081519
{

0 commit comments

Comments
 (0)