forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
MinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < BlockerPerformanceIs a performance concernIs a performance concern
Description
Object::isHero function is slightly inefficient.
This contain lookup can be avoided by caching hero count status on heros entering/exiting the contain module.
void localIsHero( Object *obj, void* userData )
{
Bool *hero = (Bool*)userData;
if( obj && obj->isKindOf( KINDOF_HERO ) )
{
*hero = TRUE;
}
}
Bool Object::isHero(void) const
{
ContainModuleInterface *contain = getContain();
if( contain )
{
Bool heroInside = FALSE;
contain->iterateContained( localIsHero, (void*)(&heroInside), FALSE );
if( heroInside )
{
return TRUE;
}
}
return isKindOf( KINDOF_HERO );
}
Metadata
Metadata
Assignees
Labels
MinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < BlockerPerformanceIs a performance concernIs a performance concern