Moubootaur Legends:Code-Conventions

From The Mana World
Revision as of 23:49, 3 November 2022 by Jesusalva (talk | contribs) (Imported from GitLab Wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This game core is Tmw-Hercules. You should refer to the <a href="https://git.themanaworld.org/ml/Docs">Docs repository</a> for information about how to code and such.

As code grows it becomes harder to maintain, so we have decided a few conventions for this project.

  • menu vs switch(select()): All switch(select) must take less than 60 lines. If your switch is bigger than that, then you must use menu, or rewrite code in a way it’s easy to maintain.
  • Idents are four spaces. No tabulations except on item and mob databases, please.
  • Inline conditional: Only when you have various conditionals to be togheter. Otherwise, break a line and give it some ident.
  • Do not unnecessarily use braces where a single statement will do. This does not apply if at least one branch of a conditional statement is not a single statement;
  • The opening brace should be in-line, and the closing brace should have a whole line only for itself.
  • Do not try to explain HOW your code works in a comment. Use comments for WHAT the code does.

As a placeholder I will just link <a href="https://www.kernel.org/doc/Documentation/process/coding-style.rst">Linux Kernel Coding Conventions</a> here, and when I find a link from TMW project I’ll have this link updated. If you find conventions at Docs repo, give us a shout to update this.