Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 6 (modified by landauf, 16 years ago) (diff)

CoreIncludes

Description

CoreIncludes.h is a header-file, declaring several easy-to-use macros providing functionalities of the core library like Identifiers, the Factory, config-values and others.

Macros

  • Identifier:
    • RegisterObject(ClassName): This macro is used by classes that want to have an Identifier. Use the macro at the beginning of the constructor. It adds new objects of this class to the corresponding ObjectList and helps building up the class hierarchy.
    • RegisterRootObject(ClassName): This is the same as RegisterObject(ClassName), but for root-classes like Interfaces (Tickable, Synchronisable? and others) and the BaseObject.
    • Class(ClassName): Returns the ClassIdentifier of the given class.
  • Factory:
    • CreateFactory(ClassName): Creates the entry in the Factory for the given class and adds a ClassFactory to the corresponding Identifier. This macro has to be used outside the class-functions as a static call.
    • ID(StringOrInt): Returns the Identifier of the class with the given name or the given network ID if the entry in the Factory exists (see CreateFactory(ClassName)).
  • Config-values:
    • SetConfigValue(varname, defvalue): Defines a 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 ConfigValueContainer for further informations.
    • ResetConfigValue(varname): Sets the given config-value back to the default-value (see SetConfigValue(varname, defvalue)).