

Please consider those items when adding new source code, or cleaning up existing source code. Here are a few hints about keeping Super TuxKart portable.
#Supertuxkart modding code#
It was checked that there is no difference in the created code, and we developers prefer postfix, and having our code consistent. if i should be a class, not a simple type). Use postfix operators like i++, not ++i (unless there is a difference, e.g.Use std::min() / std::max() instead of a #define (Windows needs NOMINMAX to be defined before including windows.h).However, there are cases when this cannot be avoided (like when using strings with gettext). If you need a C-style string, use the function std::string.c_str(). In this mail it’s written that uppercase booleans are used only for older compilers, so we should try to avoid this inconsistency. Use true / false instead of TRUE / FALSE.The actual enums should be in uppercase, and contain a prefix to make it obvious where the enum is coming from.Type (including classes/struct/enum) names have all their words capitalized.Avoid the use of std::tuple and std::pair, instead use a simple class or struct so that all variables are properly named (instead of say a std::get()).Function names should be capitalized, except the first word.Example: sun_position (member variable: m_kart_pointer). Variable names are lower case separated by _.Compile time constant values should be all uppercase, e.g.Try to sort parameters with input first, then output parameters.


if it’s not modified, it should be declared const). If possible, all parameters of functions should be const correct (i.e.This makes it more obvious which values are modified. If an object is modified, pass it in as a pointer. References should only be used as const: const Kart& k.Use const instead of #define if possible.Really simple functions (for example setters and getters), that do not raise an exception or have any preconditions, might not need documentation, this is left to the discretion of the reviewer. NetworkMode getMode () const // handleSelectedItemĮach function should have a corresponding doxygen documentation, briefly explaining what the function does, its parameters, and any exceptions it might raise. hpp file that is in the same subdir (say font/font_manager.hpp in font/font_with_face.cpp), use the path including the subdir, i.e.: HEADER_ followed by the filename in all caps, with “.” replaced by “_”. Use a #ifdef header guard in the following form to protect against multiple include: HEADER_FILE_NAME_HPP.This makes it much easier to spot if a file is included more than once. for STK sources: first files in src, then the files from the different subdirs. Sort the header files alphabetically in each sections - e.g.External libraries used by STK (OpenAL, …),.Libraries that are included with the STK source code (bullet, enet, irrlicht),.In file XX.cpp first include the corresponding XX.hpp file if available (this guarantees that the header has no hidden dependencies).Not more than one class should be declared inside a single file. grand_prix_ending.hpp contains the class GrandPri圎nding (see Coding below). The file names should represent the name of the classes it contains, e.g.Avoid having more than one level of subdirectories. Files should be grouped in appropriate subdirectories.All file names are in lower case, with _ as a word separator, e.g.: grand_prix_ending.hpp (while classes inside the files will use camel case, e.g.cpp (this allows shell commands to easily specify all sources: *.?pp). Most of the sources follow this coding style, and the rest is being re-styled as we continue development. Currently, not all our sources are following this style, and we welcome any patches to improve this. It was inspired by Google’s coding style, but this set is only a small subset of it.
