mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-02-24 20:51:08 +03:00
Simplify CBreakableGibShooter::GetRandomTemplateModelIndex
MapEntity_ExtractValue(), as opposed to CEntityMapData, does not require a mutable string.
This commit is contained in:
parent
036fbda906
commit
d0b6998637
@ -2563,15 +2563,11 @@ LINK_ENTITY_TO_CLASS( env_break_shooter, CBreakableGibShooter );
|
|||||||
int CBreakableGibShooter::GetRandomTemplateModelIndex( CPointTemplate *pTemplate )
|
int CBreakableGibShooter::GetRandomTemplateModelIndex( CPointTemplate *pTemplate )
|
||||||
{
|
{
|
||||||
int iIndex = RandomInt( 0, pTemplate->GetNumTemplates() );
|
int iIndex = RandomInt( 0, pTemplate->GetNumTemplates() );
|
||||||
char *iszTemplate = strdup(STRING(Templates_FindByIndex(pTemplate->GetTemplateIndexForTemplate(iIndex))));
|
const char *szTemplate = STRING(Templates_FindByIndex(pTemplate->GetTemplateIndexForTemplate(iIndex)));
|
||||||
|
|
||||||
CEntityMapData entData( iszTemplate );
|
|
||||||
|
|
||||||
// This might seem a little messy, but I think it's cheaper than creating the entity.
|
// This might seem a little messy, but I think it's cheaper than creating the entity.
|
||||||
char szModel[MAPKEY_MAXLENGTH];
|
char szModel[MAPKEY_MAXLENGTH];
|
||||||
bool modelExtracted = entData.ExtractValue("model", szModel);
|
bool modelExtracted = MapEntity_ExtractValue(szTemplate, "model", szModel);
|
||||||
|
|
||||||
free(iszTemplate);
|
|
||||||
|
|
||||||
return modelinfo->GetModelIndex( modelExtracted ? szModel : NULL );
|
return modelinfo->GetModelIndex( modelExtracted ? szModel : NULL );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user