@@ -279,12 +279,12 @@ void CClientEntity::SetID(ElementID ID)
279279 }
280280}
281281
282- CLuaArgument* CClientEntity::GetCustomData (const char * szName , bool bInheritData, bool * pbIsSynced)
282+ CLuaArgument* CClientEntity::GetCustomData (const CStringName& name , bool bInheritData, bool * pbIsSynced)
283283{
284- assert (szName );
284+ assert (name );
285285
286286 // Grab it and return a pointer to the variable
287- SCustomData* pData = m_pCustomData->Get (szName );
287+ SCustomData* pData = m_pCustomData->Get (name );
288288 if (pData)
289289 {
290290 if (pbIsSynced)
@@ -295,7 +295,7 @@ CLuaArgument* CClientEntity::GetCustomData(const char* szName, bool bInheritData
295295 // If none, try returning parent's custom data
296296 if (bInheritData && m_pParent)
297297 {
298- return m_pParent->GetCustomData (szName , true , pbIsSynced);
298+ return m_pParent->GetCustomData (name , true , pbIsSynced);
299299 }
300300
301301 // None available
@@ -315,10 +315,10 @@ CLuaArguments* CClientEntity::GetAllCustomData(CLuaArguments* table)
315315 return table;
316316}
317317
318- bool CClientEntity::GetCustomDataString (const char * szName , SString& strOut, bool bInheritData)
318+ bool CClientEntity::GetCustomDataString (const CStringName& name , SString& strOut, bool bInheritData)
319319{
320320 // Grab the custom data variable
321- CLuaArgument* pData = GetCustomData (szName , bInheritData);
321+ CLuaArgument* pData = GetCustomData (name , bInheritData);
322322 if (pData)
323323 {
324324 // Write the content depending on what type it is
@@ -350,10 +350,10 @@ bool CClientEntity::GetCustomDataString(const char* szName, SString& strOut, boo
350350 return false ;
351351}
352352
353- bool CClientEntity::GetCustomDataInt (const char * szName , int & iOut, bool bInheritData)
353+ bool CClientEntity::GetCustomDataInt (const CStringName& name , int & iOut, bool bInheritData)
354354{
355355 // Grab the custom data variable
356- CLuaArgument* pData = GetCustomData (szName , bInheritData);
356+ CLuaArgument* pData = GetCustomData (name , bInheritData);
357357 if (pData)
358358 {
359359 // Write the content depending on what type it is
@@ -388,10 +388,10 @@ bool CClientEntity::GetCustomDataInt(const char* szName, int& iOut, bool bInheri
388388 return false ;
389389}
390390
391- bool CClientEntity::GetCustomDataFloat (const char * szName , float & fOut , bool bInheritData)
391+ bool CClientEntity::GetCustomDataFloat (const CStringName& name , float & fOut , bool bInheritData)
392392{
393393 // Grab the custom data variable
394- CLuaArgument* pData = GetCustomData (szName , bInheritData);
394+ CLuaArgument* pData = GetCustomData (name , bInheritData);
395395 if (pData)
396396 {
397397 // Write the content depending on what type it is
@@ -415,10 +415,10 @@ bool CClientEntity::GetCustomDataFloat(const char* szName, float& fOut, bool bIn
415415 return false ;
416416}
417417
418- bool CClientEntity::GetCustomDataBool (const char * szName , bool & bOut, bool bInheritData)
418+ bool CClientEntity::GetCustomDataBool (const CStringName& name , bool & bOut, bool bInheritData)
419419{
420420 // Grab the custom data variable
421- CLuaArgument* pData = GetCustomData (szName , bInheritData);
421+ CLuaArgument* pData = GetCustomData (name , bInheritData);
422422 if (pData)
423423 {
424424 // Write the content depending on what type it is
@@ -470,50 +470,50 @@ bool CClientEntity::GetCustomDataBool(const char* szName, bool& bOut, bool bInhe
470470 return false ;
471471}
472472
473- void CClientEntity::SetCustomData (const char * szName , const CLuaArgument& Variable, bool bSynchronized)
473+ void CClientEntity::SetCustomData (const CStringName& name , const CLuaArgument& Variable, bool bSynchronized)
474474{
475- assert (szName );
476- if (strlen (szName ) > MAX_CUSTOMDATA_NAME_LENGTH)
475+ assert (name );
476+ if (name-> length ( ) > MAX_CUSTOMDATA_NAME_LENGTH)
477477 {
478478 // Don't allow it to be set if the name is too long
479- CLogger::ErrorPrintf (" Custom data name too long (%s)" , *SStringX (szName ).Left (MAX_CUSTOMDATA_NAME_LENGTH + 1 ));
479+ CLogger::ErrorPrintf (" Custom data name too long (%s)" , *SStringX (name. ToCString () ).Left (MAX_CUSTOMDATA_NAME_LENGTH + 1 ));
480480 return ;
481481 }
482482
483483 // Grab the old variable
484484 CLuaArgument oldVariable;
485- SCustomData* pData = m_pCustomData->Get (szName );
485+ SCustomData* pData = m_pCustomData->Get (name );
486486 if (pData)
487487 {
488488 oldVariable = pData->Variable ;
489489 }
490490
491491 // Set the new data
492- m_pCustomData->Set (szName , Variable, bSynchronized);
492+ m_pCustomData->Set (name , Variable, bSynchronized);
493493
494494 // Trigger the onClientElementDataChange event on us
495495 CLuaArguments Arguments;
496- Arguments.PushString (szName );
496+ Arguments.PushString (name );
497497 Arguments.PushArgument (oldVariable);
498498 Arguments.PushArgument (Variable);
499499 CallEvent (" onClientElementDataChange" , Arguments, true );
500500}
501501
502- void CClientEntity::DeleteCustomData (const char * szName )
502+ void CClientEntity::DeleteCustomData (const CStringName& name )
503503{
504504 // Grab the old variable
505- SCustomData* pData = m_pCustomData->Get (szName );
505+ SCustomData* pData = m_pCustomData->Get (name );
506506 if (pData)
507507 {
508508 CLuaArgument oldVariable;
509509 oldVariable = pData->Variable ;
510510
511511 // Delete the custom data
512- m_pCustomData->Delete (szName );
512+ m_pCustomData->Delete (name );
513513
514514 // Trigger the onClientElementDataChange event on us
515515 CLuaArguments Arguments;
516- Arguments.PushString (szName );
516+ Arguments.PushString (name );
517517 Arguments.PushArgument (oldVariable);
518518 Arguments.PushArgument (CLuaArgument ()); // Use nil as the new value to indicate the data has been removed
519519 CallEvent (" onClientElementDataChange" , Arguments, true );
0 commit comments