annotate CODING.txt @ 1686:db1a3e72c1d1 default tip

Update to match in-game changes ('help item conditions').
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 18 May 2024 21:25:57 +0300
parents 0266ebb11f68
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
736
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 GgrTF Coding Guidelines
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 =======================
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 This short text is supposed to become, at some point, a guideline
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 for expanding GgrTF and perhaps a simplistic introduction into
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 the internals of the "system".
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 General
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 =======
799
c8affac953e9 Indention notes.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
11 - By convention, tabs are used for indentation.
c8affac953e9 Indention notes.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
12
1453
0266ebb11f68 Note that the current tab-width is assumed to be 4 spaces.
Matti Hamalainen <ccr@tnsp.org>
parents: 799
diff changeset
13 - Tab width is 4 characters.
799
c8affac953e9 Indention notes.
Matti Hamalainen <ccr@tnsp.org>
parents: 736
diff changeset
14
736
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 - Variable assignations SHOULD use /let or /set, using constructs
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 such as /test foo:= ... should be avoided, as this has version-
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 specific bugs and incompatibilities.
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 - Also integer manipulations in expressions should be avoided,
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 again due to bugs. For example TF5.0b6 has a bug in += vs -=.
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 Local/temporary variables
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 =========================
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 - Typically global variables SHOULD be avoided if possible, but as
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 it is, this is impossible or unwieldy in many cases.
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 - Variable identifiers logically local to the macro MUST begin with
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 underscore ("_"). However, this is NOT tied to the actual scope of
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 the variable, thus in some cases global (/set) variables are
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 considered "local" to the macro and thus marked as such!
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 Naming conventions
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 ==================
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 First of all, it should be noted that not all of the code currently
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 follows these conventions, some of the code is old and has not been
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 updated to comply.
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 Macros
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 ------
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 - Macros LOCAL to the module and not intended to be used from other
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 modules MUST be prefixed with "g", such as "gparty_set_foo".
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 - Macros that may be accessed from other modules SHOULD be prefixed
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 "pr", such as "prdefpprot". Typically these are useful utility
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 functions or core functionality. There may be some exceptions to
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 this rule, in such cases "g"-prefix MUST be used.
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 - Macros that are meant to be invoked by user interactively or via
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 bindings, SHOULD follow some kind of naming logic too .. possibly
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 depending on the module itself.
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 Variables
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 ---------
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 - Tables/lists -> lst_
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 - Toggle options -> opt_
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 - Settings (string/integer) -> set_
c1799dc43569 Added a tiny and incomplete coding guidelines document.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 - Runtime counters -> cnt_