Template:CD

From Valve Developer Community
Jump to: navigation, search
Curly brackets white.pngTemplate Documentation
Icon-translate.png
View
Edit
Page history

This template is used to generate class hierarchy for an entity.

Usage

{{CD|<entity_class>|file1=<file_where_the_class_is_defined_in>}}

Tip.pngTip:If the template fails for some classname try using Template:CD2 (usage same as shown above)

If file1 param is specified there will be lookup using the specified classname into Template:CD/classlink to automatically link to Valve Source SDK 2013 githup repo (multiplayer files are linked) and if nothing is found then file1 param is shown as is. To not link anything nolink=1 param can be used.

Parameter base can be also specified to explicitly choose the superclass which can be useful in case there isn't the desired class in Template:CD/superclass or it is defined there but it's already used for something else.

Specifying <entity_class> as ??? will add hidden Category:Unknown Classname to the page.

Examples and Parameters

{{CD|CGasCan|file1=somefile.cpp}}
class hierarchy
CGasCan defined in somefile.cpp
CCarriedPropWeapon
CCarriedProp
CBaseBackpackItem
CTerrorWeapon
CWeaponCSBase
CBaseCombatWeapon
CBaseAnimating
CBaseEntity
{{CD|CPhysicsProp|file1=1}}
class hierarchy
CPhysicsProp defined in props.cpp
CBreakableProp
CBaseProp
CBaseAnimating
CBaseEntity
{{CD|unknown class|base=CDynamicProp}}
class hierarchy
unknown class
CDynamicProp
CBreakableProp
CBaseProp
CBaseAnimating
CBaseEntity


Template performance

CD2 repeatedly calls Template:CD/superclass to build the hierarchy

CD calls that once and then builds the rest from smaller defined templates like Template:CD CPointEntity

specifying the base parameter avoids the first Template:CD/superclass call which makes it stuff even faster

Tests:

{{CD2|Hunter}} CPU time: ~0.26s

{{CD|Hunter}} CPU time: ~0.1s

{{CD|Hunter|base=BossZombiePlayerBot}} CPU time: ~0.03s

Hunter class hierarchy
class hierarchy
Hunter
BossZombiePlayerBot
NextBotPlayer
CTerrorPlayer
CCSPlayer
CBaseMultiplayerPlayer
CBasePlayer
CBaseCombatCharacter
CBaseFlex
CBaseAnimatingOverlay
CBaseAnimating
CBaseEntity

See Also