Quick reference to the code samples

These code samples can look daunting even to a programmer, let alone a beginner. Below you'll find explanations for some common idioms in the code.


This function returns the type descriptor of this object, which is basically the section from the INI - e.g., when a function is called for a Rhino Heavy Tank, GetType() will return the [HTNK] as described in the INI. So properties acquired via GetType are per-type (GetType()->Speed returns the Speed of HTNK as defined in the INI, not the current speed of this particular instance of HTNK), as opposed to per-instance properties. This is a function for ancestor classes, descendant classes like InfantryClass use similar methods like this->InfantryType. There are exceptions to this rule, for example, Warheads and Weapons do not use a GetType() since instances of them are never created.
This function returns a magic value describing what this object is - a VehicleType, an InfantryType, a TerrainType, etc. It's used in ancestor classes like TechnoClass/FootClass since they don't actually know which of their descendants is the target of the function, so they need What_Am_I to call appropriate functionality only for certain descendants.
This is a container for all Locomotor functions, such as Is_Moving(), Is_Really_Moving(), Is_Really_Moving_Now() (yes, all three exist, no, I don't really want to know how they differ), Power_On(), Stop_Moving(), and such.

Generic C/C++ stuff

strcmp(str1, str2)/strcmpi(str1, str2)
These functions are for string comparison, the only difference is that the former one is case-sensitive while the latter is not. They return false if strings are equal and non-false when they differ (actually, if the strings differ, they return -1 and 1 depending on the lexical sort order - if str1 would come before str2 in a dictionary, it returns 1, otherwise it returns -1). So a test like
if(!strcmpi(input, "xx")) { ShowMessage("Strings do match!"); }
will show a message when the input string is, ignoring case-sensitivity, equal to "xx".
See also: strcmp in C++ Reference.