aboutsummaryrefslogtreecommitdiff
path: root/advtrains/doc
diff options
context:
space:
mode:
authorywang <yw05@forksworld.de>2021-11-03 18:55:31 +0100
committerywang <yw05@forksworld.de>2021-11-07 13:49:01 +0100
commitbe2f37a0678c66278d1c491b8f1250a8a3be9feb (patch)
treeff592e9890892b0d0c6c9dc9b5e8ec81f76a956c /advtrains/doc
parent22994705235dfcdfbdc9966a9ba037d657188b5a (diff)
downloadadvtrains-be2f37a0678c66278d1c491b8f1250a8a3be9feb.tar.gz
advtrains-be2f37a0678c66278d1c491b8f1250a8a3be9feb.tar.bz2
advtrains-be2f37a0678c66278d1c491b8f1250a8a3be9feb.zip
Support different types of speed restrictions; add documentation
Diffstat (limited to 'advtrains/doc')
-rw-r--r--advtrains/doc/advtrains_speed_lessp.3advtrains.md15
-rw-r--r--advtrains/doc/advtrains_speed_merge_aspect.3advtrains.md18
2 files changed, 33 insertions, 0 deletions
diff --git a/advtrains/doc/advtrains_speed_lessp.3advtrains.md b/advtrains/doc/advtrains_speed_lessp.3advtrains.md
new file mode 100644
index 0000000..165d028
--- /dev/null
+++ b/advtrains/doc/advtrains_speed_lessp.3advtrains.md
@@ -0,0 +1,15 @@
+% advtrains.speed.lessp(3advtrains) | Advtrains Developer's Manual
+
+# NAME
+`advtrains.speed.lessp`, `advtrains.speed.greaterp`, `advtrains.speed.not_lessp`, `advtrains.speed_not_greaterp`, `advtrains.speed.equalp`, `advtrains.speed.not_equalp`, `advtrains.speed.max`, `advtrains.speed.min` - speed restriction comparison functions
+
+# SYNOPSIS
+Each function takes two arguments and returns a boolean or (for `advtrains.speed.max` and `advtrains.speed.min`) a valid speed limit
+
+# DESCRIPTION
+
+The functions above correspond to the arithmetic `<`, `>`, `>=`, `<=`, `==`, `~=` operators and the `math.max` and `math.min` functions, respectively. The constants `nil` and `false` are treated as -1.
+
+# NOTES
+
+These functions are trivial to implement and the implementation can be easily embedded into existing code. They are simply provided for convenience.
diff --git a/advtrains/doc/advtrains_speed_merge_aspect.3advtrains.md b/advtrains/doc/advtrains_speed_merge_aspect.3advtrains.md
new file mode 100644
index 0000000..02e83ea
--- /dev/null
+++ b/advtrains/doc/advtrains_speed_merge_aspect.3advtrains.md
@@ -0,0 +1,18 @@
+% advtrains.speed.set_restriction(3advtrains) | Advtrains Developer's Manual
+
+# NAME
+`advtrains.speed.set_restriction`, `advtrains.speed.merge_aspect` - modify speed restriction
+
+# SYNOPSIS
+* `advtrains.speed.set_restriction(train, rtype, rval)`
+* `advtrains.speed.merge_aspect(train, asp)`
+
+# DESCRIPTION
+
+The `advtrains.speed.set_restriction` function sets the speed restriction of type `rtype` of `train` to `rval` and updates the speed restriction value to the strictest speed restriction in the table, or `nil` if all speed restrictions are `nil` or `-1`. If the speed restriction table does not exist, it is created with the `"main"` speed restriction being the speed restriction value of `train`.
+
+The `advtrains.speed.merge_aspect` function merges the main aspect of `asp` into the speed restriction table with the same procedure described above. If the signal aspect table does not provide the type of speed restriction, the restriction type `"main"` is assumed.
+
+# SIDE EFFECTS
+
+Both functions modify `train.speed_restriction` and `train.speed_restrictions_t`.