| 10 | | * '''Identifier''': |
| 11 | | * '''!RegisterObject('''''!ClassName''''')''': This macro is used by classes that want to have an [wiki:Identifier]. Use the macro at the beginning of the constructor. It adds new objects of this class to the corresponding [wiki:ObjectList] and helps building up the [wiki:Identifier class hierarchy]. |
| 12 | | * '''!RegisterRootObject('''''!ClassName''''')''': This is the same as !RegisterObject(!ClassName), but for root-classes like Interfaces ([wiki:Tickable], [wiki:Synchronisable] and others) and the [wiki:BaseObject]. |
| 13 | | * '''Class('''''!ClassName''''')''': Returns the [wiki:ClassIdentifier] of the given class. |
| | 10 | === Object Registration === |
| | 11 | * '''!RegisterObject('''''!ClassName''''')''': This macro is used by classes that want to have an [wiki:Identifier]. Use the macro at the beginning of the constructor. It adds new instances of this class to the corresponding [wiki:ObjectListBase] and helps building the [wiki:Identifier class hierarchy]. |
| | 12 | * '''!RegisterRootObject('''''!ClassName''''')''': This is the same as !RegisterObject(!ClassName), but for root-classes like Interfaces ([wiki:Tickable], [wiki:network/Synchronisable] and others) and the [wiki:BaseObject]. |
| 19 | | * '''Config-values''': |
| 20 | | * '''!SetConfigValue('''''varname''''', '''''defvalue''''')''': Defines a [wiki:ConfigValueContainer configurable] variable with a default value that can be changed in the config-file. ''varname'' must be a member-variable of a class and the macro should only be used in the setConfigValues() function of this class to allow ingame-changes of the values. Read the Wiki-page of [wiki:ConfigValueContainer] for further information. |
| 21 | | * '''!ResetConfigValue('''''varname''''')''': Sets the given config-value back to the default value (see !SetConfigValue(varname, defvalue)). |
| | 17 | === Identifiers === |
| | 18 | * '''Class('''''!ClassName''''')''': Returns the [wiki:ClassIdentifier] of the given class. |
| | 19 | * '''ClassByString('''''String''''')''': Returns the [wiki:Identifier] of the class with the given name if the entry in the [wiki:Factory] exists |
| | 20 | * '''ClassByID('''''NetworkID''''')''': Returns the [wiki:Identifier] of the class with the given networkID if the entry in the [wiki:Factory] exists |
| | 21 | |
| | 22 | == Examples == |
| | 23 | |
| | 24 | {{{ |
| | 25 | // Create the factory for MyClass |
| | 26 | CreateFactory(MyClass); |
| | 27 | |
| | 28 | // Constructor: |
| | 29 | MyClass::MyClass() |
| | 30 | { |
| | 31 | // Register the object in the Identifier of MyClass |
| | 32 | RegisterObject(MyClass); |
| | 33 | } |
| | 34 | }}} |
| | 35 | |
| | 36 | {{{ |
| | 37 | // Assigns the Identifier of MyClass |
| | 38 | Identifier* identifier = Class(MyClass); |
| | 39 | }}} |
| | 40 | |
| | 41 | {{{ |
| | 42 | // Assigns the Identifier of a class named "MyClass" |
| | 43 | Identifier* identifier = ClassByName("MyClass"); |
| | 44 | }}} |