Skip to content
Vlad edited this page Nov 9, 2016 · 12 revisions

Please follow those rules when writing code for Sfall.

Indentation

  • Use tabs for indentation. Recommended tab length in your editor is 4 characters.

Brackets

  • Place opening brackets always on the same line, except for namespace brackets.
  • Avoid writing control blocks without brackets.

Spaces

  • Always put spaces after control flow operators like if, for, while, etc.
  • Put spaces around binary operators like *, +, etc.
  • Put space after comma (,) in argument lists, etc.

Empty lines

  • Put 1 empty line between each function, class or class member declaration.

Inline ASM

  • Try to avoid writing complex ASM code (code with any condition, loop, etc.). If you want to use Engine functions, add/use Wrappers and then write all your logic in human-friendly C++ language.
  • Don't mix up code with and without semicolons at the end of lines. Be consistent.
  • Never use numeric literals for known addresses! Add/use constants.

Misc

  • Avoid writing code in C-style, like using sizeof/memset/etc when working with arrays (use std containers).
  • Use nullptr instead of NULL constant.
  • Try using std::string for strings when you need to copy, store, modify strings, etc.
Clone this wiki locally