Skip to content

Commit 7b627e9

Browse files
committed
Merge branch 'next'
2 parents 894c0f7 + 9cae917 commit 7b627e9

File tree

14 files changed

+64
-126
lines changed

14 files changed

+64
-126
lines changed

Client/ceflauncher_DLL/CCefApp.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ class CCefApp : public CefApp, public CefRenderProcessHandler
5353
}
5454
}
5555

56-
virtual void OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) override
57-
{
58-
// Register custom MTA scheme (has to be called in all proceseses)
59-
registrar->AddCustomScheme("mtalocal", CEF_SCHEME_OPTION_CSP_BYPASSING);
60-
}
61-
6256
// http://magpcss.org/ceforum/apidocs3/projects/(default)/CefRenderProcessHandler.html#OnContextCreated(CefRefPtr%3CCefBrowser%3E,CefRefPtr%3CCefFrame%3E,CefRefPtr%3CCefV8Context%3E)
6357
// //
6458
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) override

Client/cefweb/CWebApp.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ CefRefPtr<CefResourceHandler> CWebApp::HandleError(const SString& strError, unsi
1919
return new CefStreamResourceHandler(uiError, strError, "text/plain", CefResponse::HeaderMap(), stream);
2020
}
2121

22-
void CWebApp::OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar)
23-
{
24-
// Register custom MTA scheme (has to be called in all proceseses)
25-
registrar->AddCustomScheme("mtalocal", CEF_SCHEME_OPTION_CSP_BYPASSING);
26-
}
27-
2822
void CWebApp::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
2923
{
3024
command_line->AppendSwitch("disable-gpu-compositing");
@@ -60,32 +54,6 @@ CefRefPtr<CefResourceHandler> CWebApp::Create(CefRefPtr<CefBrowser> browser, Cef
6054
if (!CefParseURL(request->GetURL(), urlParts))
6155
return nullptr;
6256

63-
if (scheme_name == "mtalocal") // Backward compatibility
64-
{
65-
// Get full path
66-
SString path = UTF16ToMbUTF8(urlParts.path.str).substr(2);
67-
68-
// Check if we're dealing with an external resource
69-
if (path[0] == ':')
70-
{
71-
size_t end = path.find_first_of('/');
72-
if (end != std::string::npos)
73-
{
74-
SString resourceName = path.substr(1, end - 1);
75-
SString resourcePath = path.substr(end);
76-
77-
// Call this function recursively and use the mta scheme instead
78-
request->SetURL("http://mta/local/" + resourceName + resourcePath);
79-
return Create(browser, frame, "http", request);
80-
}
81-
return HandleError("404 - Not found", 404);
82-
}
83-
84-
// Redirect mtalocal://* to http://mta/local/*, call recursively
85-
request->SetURL("http://mta/local/" + path);
86-
return Create(browser, frame, "http", request);
87-
}
88-
8957
SString host = UTF16ToMbUTF8(urlParts.host.str);
9058
if (scheme_name == "http" && host == "mta")
9159
{

Client/cefweb/CWebApp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class CWebApp : public CefApp, public CefSchemeHandlerFactory
1616
// Error Handler
1717
static CefRefPtr<CefResourceHandler> HandleError(const SString& strError, unsigned int uiError);
1818

19-
virtual void OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) override;
2019
virtual void OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line) override;
2120

2221
// CefSchemeHandlerFactory methods

Client/cefweb/CWebCore.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ bool CWebCore::Initialise()
8787
bool state = CefInitialize(mainArgs, settings, app, sandboxInfo);
8888

8989
// Register custom scheme handler factory
90-
CefRegisterSchemeHandlerFactory("mtalocal", "", app);
9190
CefRegisterSchemeHandlerFactory("http", "mta", app);
9291

9392
return state;

Client/cefweb/CWebView.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,6 @@ bool CWebView::OnBeforeBrowse(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame>
819819
else
820820
bResult = false;
821821
}
822-
else if (scheme == L"mtalocal")
823-
bResult = false; // Allow mtalocal:// URLs
824822
else
825823
bResult = true; // Block other schemes
826824

@@ -901,7 +899,7 @@ CefResourceRequestHandler::ReturnValue CWebView::OnBeforeResourceLoad(CefRefPtr<
901899
else
902900
return RV_CONTINUE;
903901
}
904-
else if (scheme == L"mtalocal" || scheme == L"blob")
902+
else if (scheme == L"blob")
905903
{
906904
return RV_CONTINUE;
907905
}

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,10 +2057,6 @@ void CClientPed::SetFrozenWaitingForGroundToLoad(bool bFrozen)
20572057

20582058
CWeapon* CClientPed::GiveWeapon(eWeaponType weaponType, unsigned int uiAmmo, bool bSetAsCurrent)
20592059
{
2060-
// Multiply ammo with 10 if flamethrower to get the numbers correct.
2061-
if (weaponType == WEAPONTYPE_FLAMETHROWER)
2062-
uiAmmo *= 10;
2063-
20642060
CWeapon* pWeapon = NULL;
20652061
if (m_pPlayerPed)
20662062
{

Client/mods/deathmatch/logic/CClientVehicleManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ bool CClientVehicleManager::HasDoors(unsigned long ulModel)
701701
case VT_MOWER:
702702
case VT_RCCAM:
703703
case VT_RCGOBLIN:
704+
case VT_BLOODRA:
704705
break;
705706
default:
706707
bHasDoors = true;

Client/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3619,20 +3619,16 @@ void CPacketHandler::Packet_EntityAdd(NetBitStreamInterface& bitStream)
36193619
if (icon <= RADAR_MARKER_LIMIT)
36203620
pBlip->SetSprite(icon);
36213621

3622-
// Read out size and color if there's no icon
3623-
if (icon == 0)
3624-
{
3625-
// Read out the size
3626-
SIntegerSync<unsigned char, 5> size;
3627-
bitStream.Read(&size);
3622+
// Read out the size
3623+
SIntegerSync<unsigned char, 5> size;
3624+
bitStream.Read(&size);
36283625

3629-
// Read out the color
3630-
SColorSync color;
3631-
bitStream.Read(&color);
3626+
// Read out the color
3627+
SColorSync color;
3628+
bitStream.Read(&color);
36323629

3633-
pBlip->SetScale(size);
3634-
pBlip->SetColor(color);
3635-
}
3630+
pBlip->SetScale(size);
3631+
pBlip->SetColor(color);
36363632

36373633
break;
36383634
}

Client/mods/deathmatch/logic/luadefs/CLuaBrowserDefs.cpp

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -131,39 +131,37 @@ int CLuaBrowserDefs::CreateBrowser(lua_State* luaVM)
131131
}
132132
else if (vecSize.fX == 0 || vecSize.fY == 0)
133133
{
134-
m_pScriptDebugging->LogWarning(luaVM, "A browser must be at least 1x1 in size. This warning may be an error in future versions.");
134+
argStream.SetCustomError("A browser must be at least 1x1 in size.", "Invalid parameter");
135135
}
136136
}
137137

138-
if (!argStream.HasErrors())
138+
if (argStream.HasErrors())
139+
return luaL_error(luaVM, argStream.GetFullErrorMessage());
140+
141+
if (!bIsLocal && !g_pCore->GetWebCore()->GetRemotePagesEnabled())
139142
{
140-
if (!bIsLocal && !g_pCore->GetWebCore()->GetRemotePagesEnabled())
141-
{
142-
lua_pushboolean(luaVM, false);
143-
return 1;
144-
}
143+
lua_pushboolean(luaVM, false);
144+
return 1;
145+
}
145146

146-
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
147-
if (pLuaMain)
148-
{
149-
CResource* pParentResource = pLuaMain->GetResource();
147+
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
148+
if (pLuaMain)
149+
{
150+
CResource* pParentResource = pLuaMain->GetResource();
150151

151-
CClientWebBrowser* pBrowserTexture =
152-
g_pClientGame->GetManager()->GetRenderElementManager()->CreateWebBrowser((int)vecSize.fX, (int)vecSize.fY, bIsLocal, bTransparent);
153-
if (pBrowserTexture)
154-
{
155-
// Make it a child of the resource's file root ** CHECK Should parent be pFileResource, and element added to pParentResource's ElementGroup? **
156-
pBrowserTexture->SetParent(pParentResource->GetResourceDynamicEntity());
152+
CClientWebBrowser* pBrowserTexture =
153+
g_pClientGame->GetManager()->GetRenderElementManager()->CreateWebBrowser((int)vecSize.fX, (int)vecSize.fY, bIsLocal, bTransparent);
154+
if (pBrowserTexture)
155+
{
156+
// Make it a child of the resource's file root ** CHECK Should parent be pFileResource, and element added to pParentResource's ElementGroup? **
157+
pBrowserTexture->SetParent(pParentResource->GetResourceDynamicEntity());
157158

158-
// Set our owner resource
159-
pBrowserTexture->SetResource(pParentResource);
160-
}
161-
lua_pushelement(luaVM, pBrowserTexture);
162-
return 1;
159+
// Set our owner resource
160+
pBrowserTexture->SetResource(pParentResource);
163161
}
162+
lua_pushelement(luaVM, pBrowserTexture);
163+
return 1;
164164
}
165-
else
166-
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
167165

168166
lua_pushboolean(luaVM, false);
169167
return 1;
@@ -255,28 +253,14 @@ int CLuaBrowserDefs::LoadBrowserURL(lua_State* luaVM)
255253
lua_pushboolean(luaVM, pWebBrowser->LoadURL(strURL, !isLocalURL, strPostData, bURLEncoded));
256254
return 1;
257255
}
258-
259-
// Are we dealing with a local website? If so, parse resource path. Otherwise, return false and load nothing
260-
// Todo: Add an ACL right which is necessary to load local websites or websites in general
261-
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
262-
if (pLuaMain)
256+
else
263257
{
264-
SString strAbsPath;
265-
CResource* pResource = pLuaMain->GetResource();
266-
if (CResourceManager::ParseResourcePathInput(strURL, pResource, &strAbsPath) && pWebBrowser->IsLocal())
267-
{
268-
// Output deprecated warning, TODO: Remove this at a later point
269-
m_pScriptDebugging->LogWarning(luaVM,
270-
"This URL scheme is deprecated and may not work in future versions. Please consider using http://mta/* instead. "
271-
"See https://wiki.mtasa.com/wiki/LoadBrowserURL for details");
272-
273-
lua_pushboolean(luaVM, pWebBrowser->LoadURL("mtalocal://" + strURL, false, strPostData, bURLEncoded));
274-
return 1;
275-
}
258+
argStream.SetCustomError("Invalid URL scheme provided. Only http:// and https:// is supported.", "Invalid parameter");
276259
}
277260
}
278-
else
279-
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
261+
262+
if (argStream.HasErrors())
263+
return luaL_error(luaVM, argStream.GetFullErrorMessage());
280264

281265
lua_pushboolean(luaVM, false);
282266
return 1;
@@ -920,7 +904,7 @@ int CLuaBrowserDefs::GUICreateBrowser(lua_State* luaVM)
920904
}
921905
else if (size.fX == 0 || size.fY == 0)
922906
{
923-
m_pScriptDebugging->LogWarning(luaVM, "A browser must be at least 1x1 in size. This warning may be an error in future versions.");
907+
argStream.SetCustomError("A browser must be at least 1x1 in size.", "Invalid parameter");
924908
}
925909
}
926910

@@ -951,7 +935,7 @@ int CLuaBrowserDefs::GUICreateBrowser(lua_State* luaVM)
951935
}
952936

953937
if (argStream.HasErrors())
954-
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
938+
return luaL_error(luaVM, argStream.GetFullErrorMessage());
955939

956940
lua_pushboolean(luaVM, false);
957941
return 1;

Server/mods/deathmatch/logic/CRemoteCalls.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,10 @@ void CRemoteCall::DownloadFinishedCallback(const SHttpDownloadResult& result)
231231
if (result.bSuccess)
232232
{
233233
if (pCall->IsFetch())
234-
{
235234
arguments.PushString(std::string(result.pData, result.dataSize));
236-
arguments.PushNumber(0);
237-
}
238235
else
239236
arguments.ReadFromJSONString(result.pData);
237+
arguments.PushNumber(0);
240238
}
241239
else
242240
{

Server/mods/deathmatch/logic/CResourceChecker.Data.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace
1313
{
1414
//
15-
// Minimum version requirments for functions/events
15+
// Minimum version requirements for functions/events
1616
//
1717

1818
struct SVersionItem
@@ -294,6 +294,7 @@ namespace
294294
{"svgGetSize", "1.5.8-9.20979"},
295295
{"svgSetDocumentXML", "1.5.8-9.20979"},
296296
{"svgSetSize", "1.5.8-9.20979"},
297+
{"generateKeyPair", "1.5.8-9.21055"},
297298
{"getProcessMemoryStats", "1.5.8-9.21389"},
298299
{"isCapsLockEnabled", "1.5.8-9.21313"},
299300
{"isMTAWindowFocused", "1.5.8-9.21313"},
@@ -417,6 +418,7 @@ namespace
417418
{"onResourceLoadStateChange", "1.5.8-9.20809"},
418419
{"onElementInteriorChange", "1.5.8-9.20837"},
419420
{"onPlayerResourceStart", "1.5.8-9.20957"},
421+
{"generateKeyPair", "1.5.8-9.21055"},
420422
{"getProcessMemoryStats", "1.5.8-9.21389"},
421423

422424
// Features added in 1.6.0
@@ -569,9 +571,9 @@ namespace
569571
// Server ped jetpack
570572
{true, "givePlayerJetPack", "Replaced with setPedWearingJetpack. Refer to the wiki for details"},
571573
{true, "removePlayerJetPack", "Replaced with setPedWearingJetpack. Refer to the wiki for details"},
572-
//{true, "givePedJetPack", "Replaced with setPedWearingJetpack. Refer to the wiki for details"},
573-
//{true, "removePedJetPack", "Replaced with setPedWearingJetpack. Refer to the wiki for details"},
574-
//{false, "doesPedHaveJetPack", "isPedWearingJetpack"},
574+
{true, "givePedJetPack", "Replaced with setPedWearingJetpack. Refer to the wiki for details"},
575+
{true, "removePedJetPack", "Replaced with setPedWearingJetpack. Refer to the wiki for details"},
576+
{false, "doesPedHaveJetPack", "isPedWearingJetpack"},
575577

576578
// XML
577579
{false, "xmlNodeGetSubNodes", "xmlNodeGetChildren"},

Server/mods/deathmatch/logic/CVehicleManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ bool CVehicleManager::HasDoors(unsigned short usModel)
575575
case VT_MOWER:
576576
case VT_RCCAM:
577577
case VT_RCGOBLIN:
578+
case VT_BLOODRA:
578579
break;
579580
default:
580581
bHasDoors = true;

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -747,17 +747,15 @@ bool CEntityAddPacket::Write(NetBitStreamInterface& BitStream) const
747747
// Write the icon
748748
SIntegerSync<unsigned char, 6> icon(pBlip->m_ucIcon);
749749
BitStream.Write(&icon);
750-
if (pBlip->m_ucIcon == 0)
751-
{
752-
// Write the size
753-
SIntegerSync<unsigned char, 5> size(pBlip->m_ucSize);
754-
BitStream.Write(&size);
755-
756-
// Write the color
757-
SColorSync color;
758-
color = pBlip->GetColor();
759-
BitStream.Write(&color);
760-
}
750+
751+
// Write the size
752+
SIntegerSync<unsigned char, 5> size(pBlip->m_ucSize);
753+
BitStream.Write(&size);
754+
755+
// Write the color
756+
SColorSync color;
757+
color = pBlip->GetColor();
758+
BitStream.Write(&color);
761759

762760
break;
763761
}

Shared/sdk/CScriptArgReader.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class CScriptArgReader
5959
// The string received may not actually be a number
6060
if (!lua_isnumber(m_luaVM, m_iIndex))
6161
{
62-
SetCustomWarning("Expected number, got non-convertible string. This warning may be an error in future versions.");
62+
SetCustomError("Expected number, got non-convertible string", "Bad argument");
63+
return;
6364
}
6465

6566
// Returns 0 even if the string cannot be parsed as a number
@@ -76,7 +77,8 @@ class CScriptArgReader
7677
{
7778
if (checkSign && number < -FLT_EPSILON)
7879
{
79-
SetCustomWarning("Expected positive value, got negative. This warning may be an error in future versions.");
80+
SetCustomError("Expected positive value, got negative", "Bad argument");
81+
return;
8082
}
8183
outValue = static_cast<T>(static_cast<int64_t>(number));
8284
return;
@@ -103,7 +105,8 @@ class CScriptArgReader
103105
// The string received may not actually be a number
104106
if (!lua_isnumber(m_luaVM, m_iIndex))
105107
{
106-
SetCustomWarning("Expected number, got non-convertible string. This warning may be an error in future versions.");
108+
SetCustomError("Expected number, got non-convertible string", "Bad argument");
109+
return;
107110
}
108111

109112
// Returns 0 even if the string cannot be parsed as a number
@@ -118,7 +121,8 @@ class CScriptArgReader
118121

119122
if (checkSign && std::is_unsigned<T>() && number < -FLT_EPSILON)
120123
{
121-
SetCustomWarning("Expected positive value, got negative. This warning may be an error in future versions.");
124+
SetCustomError("Expected positive value, got negative", "Bad argument");
125+
return;
122126
}
123127

124128
outValue = static_cast<T>(number);

0 commit comments

Comments
 (0)