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,27 +3,16 @@ module horse/{{ $.Region }}/scenario
// Automatically generated with horsegen; DO NOT EDIT
import std/core/delayed
import std/core/vector
import std/core-extras
import horse/game-id
// Enumeration of all scenarios for type-safe programming.
pub type scenario
{{- range $s := $.Scenarios }}
{{ kkenum $s.Name }}
{{- end }}
// Get the scenario ID for a scenario.
pub fun scenario-id(s: scenario): scenario-id
match s
{{- range $s := $.Scenarios }}
{{ kkenum $s.Name }} -> Scenario-id({{ $s.ID }})
{{- end }}
// List of all scenarios in ID order for easy iterating.
pub val all = [
{{- range $s := $.Scenarios }}
{{ kkenum $s.Name }},
{{- end }}
]
extern create-id-table(): vector<int>
c inline "int32_t arr[] = { {{- range $s := $.Scenarios }}{{ $s.ID }},{{ end -}} };\nkk_vector_from_cint32array(arr, (kk_ssize_t){{ $.ScenarioCount }}, kk_context())"
js inline "[{{ range $s := $.Scenarios }}{{ $s.ID }},{{ end }}]"
// Vector of all scenario IDs in order for easy iterating.
val all = once(create-id-table)
// Get the name for a scenario.
// If no scenario matches the ID, the result contains the numeric ID.