horsegen: spam vectors to try to limit type check time

This commit is contained in:
2026-02-16 14:06:51 -05:00
parent 2184515938
commit b0e422ac01
14 changed files with 157 additions and 6644 deletions

View File

@@ -3,28 +3,17 @@ module horse/{{ $.Region }}/spark
// Automatically generated with horsegen; DO NOT EDIT
import std/core/delayed
import std/core/vector
import std/core-extras
import horse/game-id
pub import horse/spark
// Enumeration of all sparks for type-safe programming.
pub type spark
{{- range $s := $.Sparks }}
{{ kkenum $s.Name }}-Lv{{ $s.Rarity }}
{{- end }}
// Get the ID for a spark.
pub fun spark-id(s: spark): spark-id
match s
{{- range $s := $.Sparks }}
{{ kkenum $s.Name }}-Lv{{ $s.Rarity }} -> Spark-id({{ $s.ID }})
{{- end }}
// List of all sparks in ID order for easy iterating.
pub val all = [
{{- range $s := $.Sparks }}
{{ kkenum $s.Name }}-Lv{{ $s.Rarity }},
{{- end }}
]
extern create-id-table(): vector<int>
c inline "int32_t arr[] = { {{- range $s := $.Sparks }}{{ $s.ID }},{{ end -}} };\nkk_vector_from_cint32array(arr, (kk_ssize_t){{ $.SparkCount }}, kk_context())"
js inline "[{{ range $s := $.Sparks }}{{ $s.ID }},{{ end }}]"
// Vector of all spark IDs in order for easy iterating.
val all = once(create-id-table)
// Get the name for a spark.
// The name does not indicate the spark level.