Template:CD

De Valve Developer Community
Aller à la navigation Aller à la recherche
English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Icon-translate.png Available doc translations
Info.png
The Template:CD/doc/fr documentation page does not exist.
English documentation will be displayed instead, which you can translate using Google Translate (or similar software). If there is nothing after this message, most likely the documentation does not exist even in English.

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 classname specified in {{{1}}} into Template:CD/classlink to automatically link to Valve Source SDK 2013 githup repo (multiplayer files are linked)
  • {{{goldsrc}}} - should be used when adding class hierarchy for GoldSrc entities. It adds ' (GoldSrc)' to all links and the lookup for file link will use Template:CD/classlink/hl.
  • If nothing is found during the file link lookup or {{{nolink}}} is specified then file1 or goldsrc param are shown as they were specified. If neither file1 or goldsrc params were specified then automatic file link lookup won't be done at all.
  • {{{base}}} can be 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.

Examples and Parameters

Tip.pngTip:The arrow symbol left to the class is a separate link that is linking to category representing subclasses of the given class
{{CD|CGasCan|file1=somefile.cpp}}
Class hierarchy
CGasCan
CCarriedPropWeapon
CCarriedProp
CBaseBackpackItem
CTerrorWeapon
CWeaponCSBase
CBaseCombatWeapon
CBaseAnimating
CBaseEntity
somefile.cpp
{{CD|CPhysicsProp|file1=1}}
Class hierarchy
CPhysicsProp
CBreakableProp
CBaseProp
CBaseAnimating
CBaseEntity
props.cpp
{{CD|???|base=CDynamicProp}}
Class hierarchy
???
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