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 iIndex = RandomInt( 0, pTemplate->GetNumTemplates() );
|
||||
char *iszTemplate = strdup(STRING(Templates_FindByIndex(pTemplate->GetTemplateIndexForTemplate(iIndex))));
|
||||
|
||||
CEntityMapData entData( iszTemplate );
|
||||
const char *szTemplate = STRING(Templates_FindByIndex(pTemplate->GetTemplateIndexForTemplate(iIndex)));
|
||||
|
||||
// This might seem a little messy, but I think it's cheaper than creating the entity.
|
||||
char szModel[MAPKEY_MAXLENGTH];
|
||||
bool modelExtracted = entData.ExtractValue("model", szModel);
|
||||
|
||||
free(iszTemplate);
|
||||
bool modelExtracted = MapEntity_ExtractValue(szTemplate, "model", szModel);
|
||||
|
||||
return modelinfo->GetModelIndex( modelExtracted ? szModel : NULL );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user