本文整理汇总了C++中CElementGroup类的典型用法代码示例。如果您正苦于以下问题:C++ CElementGroup类的具体用法?C++ CElementGroup怎么用?C++ CElementGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CElementGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: color
int CLuaMarkerDefs::CreateMarker(lua_State* luaVM)
{
CVector vecPosition;
float fSize;
SColorRGBA color(0, 0, 255, 255);
SString strType;
CElement* pVisibleTo;
CScriptArgReader argStream(luaVM);
argStream.ReadVector3D(vecPosition);
argStream.ReadString(strType, "default");
argStream.ReadNumber(fSize, 4.0f);
argStream.ReadNumber(color.R, color.R);
argStream.ReadNumber(color.G, color.G);
argStream.ReadNumber(color.B, color.B);
argStream.ReadNumber(color.A, color.A);
if (argStream.NextIsBool() || argStream.NextIsNil())
{
pVisibleTo = NULL;
}
else
argStream.ReadUserData(pVisibleTo, m_pRootElement);
if (!argStream.HasErrors())
{
CLuaMain* pLuaMain = g_pGame->GetLuaManager()->GetVirtualMachine(luaVM);
if (pLuaMain)
{
CResource* pResource = pLuaMain->GetResource();
if (pResource)
{
// Create it
CMarker* pMarker = CStaticFunctionDefinitions::CreateMarker(pResource, vecPosition, strType, fSize, color, pVisibleTo);
if (pMarker)
{
CElementGroup* pGroup = pResource->GetElementGroup();
if (pGroup)
{
pGroup->Add(pMarker);
}
lua_pushelement(luaVM, pMarker);
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
lua_pushboolean(luaVM, false);
return 1;
}
示例2: argStream
int CLuaFunctionDefs::CreateObject ( lua_State* luaVM )
{
// object createObject ( int modelid, float x, float y, float z, [float rx, float ry, float rz, bool lowLOD] )
ushort usModelID; CVector vecPosition; CVector vecRotation; bool bLowLod;
CScriptArgReader argStream ( luaVM );
argStream.ReadNumber ( usModelID );
argStream.ReadNumber ( vecPosition.fX );
argStream.ReadNumber ( vecPosition.fY );
argStream.ReadNumber ( vecPosition.fZ );
argStream.ReadNumber ( vecRotation.fX, 0 );
argStream.ReadNumber ( vecRotation.fY, 0 );
argStream.ReadNumber ( vecRotation.fZ, 0 );
argStream.ReadBool ( bLowLod, false );
if ( !argStream.HasErrors () )
{
if ( CClientObjectManager::IsValidModel ( usModelID ) )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pResource = pLuaMain->GetResource ();
if ( pResource )
{
CClientObject* pObject = CStaticFunctionDefinitions::CreateObject ( *pResource, usModelID, vecPosition, vecRotation, bLowLod );
if ( pObject )
{
CElementGroup * pGroup = pResource->GetElementGroup();
if ( pGroup )
{
pGroup->Add ( ( CClientEntity* ) pObject );
}
lua_pushelement ( luaVM, pObject );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, SString ( "Bad argument @ '%s' [%s]", "createObject", "Invalid model id" ) );
}
else
m_pScriptDebugging->LogCustom ( luaVM, SString ( "Bad argument @ '%s' [%s]", "createObject", *argStream.GetErrorMessage () ) );
lua_pushboolean ( luaVM, false );
return 1;
}
示例3: argStream
int CLuaRadarAreaDefs::CreateRadarArea(lua_State* luaVM)
{
// radararea createRadarArea ( float startPosX, float startPosY, float sizeX, float sizeY, [ int r = 255, int g = 0, int b = 0, int a = 255, element
// visibleTo = getRootElement() ] )
CVector2D vecPosition;
CVector2D vecSize;
float dRed;
float dGreen;
float dBlue;
float dAlpha;
CElement* pVisibleTo;
CScriptArgReader argStream(luaVM);
argStream.ReadVector2D(vecPosition);
argStream.ReadVector2D(vecSize);
argStream.ReadNumber(dRed, 255);
argStream.ReadNumber(dGreen, 0);
argStream.ReadNumber(dBlue, 0);
argStream.ReadNumber(dAlpha, 255);
argStream.ReadUserData(pVisibleTo, m_pRootElement);
if (!argStream.HasErrors())
{
CLuaMain* pLuaMain = g_pGame->GetLuaManager()->GetVirtualMachine(luaVM);
CResource* pResource = pLuaMain ? pLuaMain->GetResource() : NULL;
if (pResource)
{
SColorRGBA color(dRed, dGreen, dBlue, dAlpha);
// Create it
CRadarArea* pRadarArea = CStaticFunctionDefinitions::CreateRadarArea(pResource, vecPosition, vecSize, color, pVisibleTo);
if (pRadarArea)
{
CElementGroup* pGroup = pResource->GetElementGroup();
if (pGroup)
{
pGroup->Add(pRadarArea);
}
lua_pushelement(luaVM, pRadarArea);
return 1;
}
}
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
lua_pushboolean(luaVM, false);
return 1;
}
示例4: argStream
int CLuaColShapeDefs::CreateColTube ( lua_State* luaVM )
{
CVector vecPosition;
float fRadius = 0.1f, fHeight = 0.1f;
CScriptArgReader argStream ( luaVM );
argStream.ReadVector3D ( vecPosition );
argStream.ReadNumber ( fRadius );
argStream.ReadNumber ( fHeight );
if ( fRadius < 0.0f )
{
fRadius = 0.1f;
}
if ( fHeight < 0.0f )
{
fHeight = 0.1f;
}
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pResource = pLuaMain->GetResource ();
if ( pResource )
{
// Create it and return it
CClientColTube* pShape = CStaticFunctionDefinitions::CreateColTube ( *pResource, vecPosition, fRadius, fHeight );
if ( pShape )
{
CElementGroup * pGroup = pResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( (CClientEntity*) pShape );
}
lua_pushelement ( luaVM, pShape );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogBadType ( luaVM );
lua_pushboolean ( luaVM, false );
return 1;
}
示例5: argStream
int CLuaPointLightDefs::CreateLight ( lua_State* luaVM )
{
// light createLight ( int lightType, float posX, float posY, float posX, [ float radius = 3, int r = 255, int g = 0, int b = 0, float dirX = 0, float dirY = 0, float dirZ = 0, bool createsShadow = false ] )
int iMode;
CVector vecPosition;
float fRadius;
SColor color;
CVector vecDirection;
bool bCreatesShadow;
CScriptArgReader argStream ( luaVM );
argStream.ReadNumber ( iMode );
argStream.ReadVector3D ( vecPosition );
argStream.ReadNumber ( fRadius, 3.0f );
argStream.ReadNumber ( color.R, 255 );
argStream.ReadNumber ( color.G, 0 );
argStream.ReadNumber ( color.B, 0 );
argStream.ReadVector3D ( vecDirection, vecDirection );
argStream.ReadBool ( bCreatesShadow, false );
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
CResource* pResource = pLuaMain ? pLuaMain->GetResource () : NULL;
if ( pResource )
{
// Create it
CClientPointLights* pLight = CStaticFunctionDefinitions::CreateLight ( *pResource, iMode, vecPosition, fRadius, color, vecDirection );
if ( pLight )
{
CElementGroup * pGroup = pResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( (CClientEntity*) pLight );
}
lua_pushelement ( luaVM, pLight );
return 1;
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, SString ( "Bad argument @ '%s' [%s]", lua_tostring ( luaVM, lua_upvalueindex ( 1 ) ), *argStream.GetErrorMessage () ) );
lua_pushboolean ( luaVM, false );
return 1;
}
示例6: argStream
int CLuaColShapeDefs::CreateColTube(lua_State* luaVM)
{
CVector vecPosition;
float fHeight, fRadius;
CScriptArgReader argStream(luaVM);
argStream.ReadVector3D(vecPosition);
argStream.ReadNumber(fRadius);
argStream.ReadNumber(fHeight);
if (!argStream.HasErrors())
{
if (fRadius < 0.0f)
fRadius = 0.1f;
if (fHeight < 0.0f)
fHeight = 0.1f;
CLuaMain* pLuaMain = g_pGame->GetLuaManager()->GetVirtualMachine(luaVM);
if (pLuaMain)
{
CResource* pResource = pLuaMain->GetResource();
if (pResource)
{
// Create it and return it
CColTube* pShape = CStaticFunctionDefinitions::CreateColTube(pResource, vecPosition, fRadius, fHeight);
if (pShape)
{
CElementGroup* pGroup = pResource->GetElementGroup();
if (pGroup)
{
pGroup->Add(pShape);
}
lua_pushelement(luaVM, pShape);
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
lua_pushboolean(luaVM, false);
return 1;
}
示例7: argStream
int CLuaFunctionDefs::CreateTeam ( lua_State* luaVM )
{
SString strName;
unsigned char ucRed;
unsigned char ucGreen;
unsigned char ucBlue;
CScriptArgReader argStream ( luaVM );
argStream.ReadString ( strName );
argStream.ReadNumber ( ucRed, 235 );
argStream.ReadNumber ( ucGreen, 221 );
argStream.ReadNumber ( ucBlue, 178 );
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = g_pGame->GetLuaManager ()->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pResource = pLuaMain->GetResource ();
if ( pResource )
{
CTeam* pTeam = CStaticFunctionDefinitions::CreateTeam ( pResource, strName, ucRed, ucGreen, ucBlue );
if ( pTeam )
{
CElementGroup * pGroup = pResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( pTeam );
}
lua_pushelement ( luaVM, pTeam );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例8: argStream
int CLuaPedDefs::CreatePed ( lua_State* luaVM )
{
unsigned short usModel;
CVector vecPosition;
float fRotation;
bool bSynced;
CScriptArgReader argStream ( luaVM );
argStream.ReadNumber ( usModel );
argStream.ReadVector3D ( vecPosition );
argStream.ReadNumber ( fRotation, 0.0f );
argStream.ReadBool ( bSynced, true );
if ( !argStream.HasErrors () )
{
CLuaMain * pLuaMain = g_pGame->GetLuaManager ()->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource * pResource = pLuaMain->GetResource ();
if ( pResource )
{
// Create the ped and return its handle
CPed* pPed = CStaticFunctionDefinitions::CreatePed ( pResource, usModel, vecPosition, fRotation, bSynced );
if ( pPed )
{
CElementGroup * pGroup = pResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( pPed );
}
lua_pushelement ( luaVM, pPed );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例9: LoadNode
CElement* CMapManager::LoadMapData ( CResource& Loader, CElement& Parent, CXMLNode& Node )
{
// Load the elements
vector < CElement* > ElementsAdded;
CElement* pLoadedRoot = LoadNode ( Loader, Node, &Parent, &ElementsAdded, false );
if ( pLoadedRoot )
{
// Add all the elements that are entities to a sync packet
CEntityAddPacket AddPacket;
vector < CElement* > ::const_iterator iter = ElementsAdded.begin ();
for ( ; iter != ElementsAdded.end (); iter++ )
{
// Is it a per-player entity? Sync it. Otherwize add it to the packet.
if ( IS_PERPLAYER_ENTITY ( *iter ) )
{
static_cast < CPerPlayerEntity* > ( *iter )->Sync ( true );
}
else
{
AddPacket.Add ( *iter );
}
}
// Send it to everyone
m_pPlayerManager->BroadcastOnlyJoined ( AddPacket );
return pLoadedRoot;
}
// If unsuccessfull, destroy the new elements. Remember removing it from our element group.
CElementGroup* pElementGroup = Loader.GetElementGroup ();
vector < CElement* > ::const_iterator iter = ElementsAdded.begin ();
for ( ; iter != ElementsAdded.end (); iter++ )
{
pElementGroup->Remove ( *iter );
delete *iter;
}
// Failed
return NULL;
}
示例10: argStream
int CLuaSearchLightDefs::CreateSearchLight(lua_State* luaVM)
{
// searchlight createSearchLight ( float startX, float startY, float startZ, float endX, float endY, float endZ, float startRadius, float endRadius [, bool
// renderSpot = true ] )
CVector vecStart, vecEnd;
float startRadius, endRadius;
bool renderSpot;
CScriptArgReader argStream(luaVM);
argStream.ReadVector3D(vecStart);
argStream.ReadVector3D(vecEnd);
argStream.ReadNumber(startRadius);
argStream.ReadNumber(endRadius);
argStream.ReadBool(renderSpot, true);
if (!argStream.HasErrors())
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
CResource* pResource = pLuaMain ? pLuaMain->GetResource() : nullptr;
if (pResource)
{
auto pLight = CStaticFunctionDefinitions::CreateSearchLight(*pResource, vecStart, vecEnd, startRadius, endRadius, renderSpot);
if (pLight)
{
CElementGroup* pGroup = pResource->GetElementGroup();
if (pGroup)
pGroup->Add(pLight);
lua_pushelement(luaVM, pLight);
return 1;
}
}
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
lua_pushboolean(luaVM, false);
return 1;
}
示例11: argStream
int CLuaFunctionDefs::CreateWeapon ( lua_State* luaVM )
{
CVector vecPos;
eWeaponType weaponType;
CScriptArgReader argStream ( luaVM );
argStream.ReadEnumStringOrNumber ( weaponType );
argStream.ReadNumber ( vecPos.fX );
argStream.ReadNumber ( vecPos.fY );
argStream.ReadNumber ( vecPos.fZ );
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pResource = pLuaMain->GetResource ();
if ( pResource )
{
CClientWeapon * pWeapon = CStaticFunctionDefinitions::CreateWeapon ( *pResource, weaponType, vecPos );
if ( pWeapon )
{
CElementGroup * pGroup = pResource->GetElementGroup();
if ( pGroup )
{
pGroup->Add ( ( CClientEntity* ) pWeapon );
}
lua_pushelement ( luaVM, pWeapon );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushboolean ( luaVM, false );
return 1;
}
示例12: argStream
int CLuaFileDefs::fileCreate ( lua_State* luaVM )
{
// file fileCreate ( string filePath )
SString filePath;
CScriptArgReader argStream ( luaVM );
argStream.ReadString ( filePath );
if ( !argStream.HasErrors () )
{
// Grab our lua VM
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( !g_pNet->ValidateBinaryFileName ( filePath ) )
{
argStream.SetCustomError ( SString ( "Filename not allowed %s", *filePath ), "File error" );
}
else
if ( pLuaMain )
{
SString strAbsPath;
SString strMetaPath;
CResource* pThisResource = pLuaMain->GetResource ();
CResource* pResource = pThisResource;
if ( CResourceManager::ParseResourcePathInput ( filePath, pResource, strAbsPath, strMetaPath ) )
{
// Inform file verifier
g_pClientGame->GetResourceManager()->FileModifedByScript( strAbsPath );
// Make sure the destination folder exist so we can create the file
MakeSureDirExists ( strAbsPath.c_str () );
// Create the file to create
eAccessType accessType = filePath[0] == '@' ? eAccessType::ACCESS_PRIVATE : eAccessType::ACCESS_PUBLIC;
CScriptFile* pFile = new CScriptFile( pThisResource->GetScriptID( ), strMetaPath.c_str(), DEFAULT_MAX_FILESIZE, accessType);
assert ( pFile );
// Try to load it
if ( pFile->Load ( pResource, CScriptFile::MODE_CREATE ) )
{
// Make it a child of the resource's file root
pFile->SetParent ( pResource->GetResourceDynamicEntity () );
// Add it to the scrpt resource element group
CElementGroup* pGroup = pThisResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( pFile );
}
// Success. Return the file.
lua_pushelement ( luaVM, pFile );
return 1;
}
else
{
// Delete the file again
delete pFile;
// Output error
argStream.SetCustomError ( SString ( "Unable to create %s", *filePath ), "File error" );
}
}
}
}
if ( argStream.HasErrors () )
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
// Failed
lua_pushboolean ( luaVM, false );
return 1;
}
示例13: argStream
int CLuaFileDefs::fileOpen ( lua_State* luaVM )
{
// file fileOpen ( string filePath [, bool readOnly = false ] )
SString strInputPath; bool bReadOnly;
CScriptArgReader argStream ( luaVM );
argStream.ReadString ( strInputPath );
argStream.ReadBool ( bReadOnly, false );
if ( argStream.NextIsUserData () )
m_pScriptDebugging->LogCustom ( luaVM, "fileOpen may be using an outdated syntax. Please check and update." );
if ( !argStream.HasErrors () )
{
// Grab our lua VM
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
SString strAbsPath;
SString strMetaPath;
CResource* pThisResource = pLuaMain->GetResource ();
CResource* pResource = pThisResource;
if ( CResourceManager::ParseResourcePathInput ( strInputPath, pResource, &strAbsPath, &strMetaPath ) )
{
CheckCanModifyOtherResource( argStream, pThisResource, pResource );
CheckCanAccessOtherResourceFile( argStream, pThisResource, pResource, strAbsPath, &bReadOnly );
if ( !argStream.HasErrors() )
{
#ifndef MTA_CLIENT // IF SERVER
// Create the file to create
CScriptFile* pFile = new CScriptFile ( pThisResource->GetScriptID (), strMetaPath, DEFAULT_MAX_FILESIZE );
#else
eAccessType accessType = strInputPath[0] == '@' ? eAccessType::ACCESS_PRIVATE : eAccessType::ACCESS_PUBLIC;
CScriptFile* pFile = new CScriptFile ( pThisResource->GetScriptID (), strMetaPath, DEFAULT_MAX_FILESIZE, accessType );
#endif
// Try to load it
if ( pFile->Load ( pResource, bReadOnly ? CScriptFile::MODE_READ : CScriptFile::MODE_READWRITE ) )
{
#ifdef MTA_CLIENT
// Make it a child of the resource's file root
pFile->SetParent ( pResource->GetResourceDynamicEntity () );
#endif
// Grab its owner resource
CResource* pParentResource = pLuaMain->GetResource ();
if ( pParentResource )
{
// Add it to the scrpt resource element group
CElementGroup* pGroup = pParentResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( pFile );
}
}
// Success. Return the file.
lua_pushelement ( luaVM, pFile );
return 1;
}
else
{
// Delete the file again
delete pFile;
// Output error
argStream.SetCustomError ( SString ( "unable to load file '%s'", *strInputPath ) );
}
}
}
}
}
if ( argStream.HasErrors () )
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
// Failed
lua_pushboolean ( luaVM, false );
return 1;
}
示例14: argStream
int CLuaFileDefs::fileCreate ( lua_State* luaVM )
{
// file fileCreate ( string filePath )
SString strFile;
CScriptArgReader argStream ( luaVM );
argStream.ReadString ( strFile );
if ( argStream.NextIsUserData () )
m_pScriptDebugging->LogCustom ( luaVM, "fileCreate may be using an outdated syntax. Please check and update." );
if ( !argStream.HasErrors () )
{
// Grab our lua VM
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
// Grab the filename
std::string strAbsPath;
std::string strSubPath;
// We have a resource argument?
CResource* pThisResource = pLuaMain->GetResource ();
CResource* pResource = pThisResource;
if ( CResourceManager::ParseResourcePathInput ( strFile, pResource, &strAbsPath, &strSubPath ) )
{
// Do we have permissions?
if ( pResource == pThisResource ||
m_pACLManager->CanObjectUseRight ( pThisResource->GetName ().c_str (),
CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE,
"ModifyOtherObjects",
CAccessControlListRight::RIGHT_TYPE_GENERAL,
false ) )
{
// Make sure the destination folder exist so we can create the file
MakeSureDirExists ( strAbsPath.c_str () );
// Create the file to create
CScriptFile* pFile = new CScriptFile ( pThisResource->GetScriptID(), strSubPath.c_str (), DEFAULT_MAX_FILESIZE );
assert ( pFile );
// Try to load it
if ( pFile->Load ( pResource, CScriptFile::MODE_CREATE ) )
{
// Add it to the scrpt resource element group
CElementGroup* pGroup = pThisResource->GetElementGroup ();
if ( pGroup )
{
pGroup->Add ( pFile );
}
// Success. Return the file.
lua_pushelement ( luaVM, pFile );
return 1;
}
else
{
// Delete the file again
delete pFile;
// Output error
m_pScriptDebugging->LogWarning ( luaVM, "%s; unable to load file", lua_tostring ( luaVM, lua_upvalueindex ( 1 ) ) );
}
}
else
m_pScriptDebugging->LogError ( luaVM, "%s failed; ModifyOtherObjects in ACL denied resource %s to access %s", lua_tostring ( luaVM, lua_upvalueindex ( 1 ) ), pThisResource->GetName ().c_str (), pResource->GetName ().c_str () );
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
// Failed
lua_pushboolean ( luaVM, false );
return 1;
}
示例15: color
int CLuaBlipDefs::CreateBlip(lua_State* luaVM)
{
CVector vecPosition;
unsigned char ucIcon = 0;
int iSize = 2;
SColorRGBA color(255, 0, 0, 255);
int iOrdering = 0;
int iVisibleDistance = 16383;
CScriptArgReader argStream(luaVM);
argStream.ReadVector3D(vecPosition);
argStream.ReadNumber(ucIcon, 0);
argStream.ReadNumber(iSize, 2);
argStream.ReadNumber(color.R, 255);
argStream.ReadNumber(color.G, 0);
argStream.ReadNumber(color.B, 0);
argStream.ReadNumber(color.A, 255);
argStream.ReadNumber(iOrdering, 0);
argStream.ReadNumber(iVisibleDistance, 16383);
if (!CClientRadarMarkerManager::IsValidIcon(ucIcon))
{
argStream.SetCustomError("Invalid icon");
}
if (iSize < 0 || iSize > 25)
argStream.SetCustomWarning(SString("Blip size beyond 25 is no longer supported (got %i). It will be clamped between 0 and 25.", iSize));
if (!argStream.HasErrors())
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
if (pLuaMain)
{
CResource* pResource = pLuaMain->GetResource();
if (pResource)
{
unsigned char ucSize = Clamp(0, iSize, 25);
short sOrdering = Clamp(-32768, iOrdering, 32767);
unsigned short usVisibleDistance = Clamp(0, iVisibleDistance, 65535);
// Create the blip
CClientRadarMarker* pMarker =
CStaticFunctionDefinitions::CreateBlip(*pResource, vecPosition, ucIcon, ucSize, color, sOrdering, usVisibleDistance);
if (pMarker)
{
CElementGroup* pGroup = pResource->GetElementGroup();
if (pGroup)
{
pGroup->Add(pMarker);
}
lua_pushelement(luaVM, pMarker);
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
lua_pushboolean(luaVM, false);
return 1;
}