horsegen: spam vectors to try to limit type check time
This commit is contained in:
@@ -3,29 +3,18 @@ module horse/{{ $.Region }}/saddle
|
||||
|
||||
// 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/race
|
||||
pub import horse/{{ $.Region }}/race
|
||||
|
||||
// Enumeration of all saddles for type-safe programming.
|
||||
pub type saddle
|
||||
{{- range $s := $.Saddles }}
|
||||
{{ kkenum $s.Name }}{{ if $s.Alternate }}-Alt{{ $s.ID }}{{ end }}
|
||||
{{- end }}
|
||||
|
||||
// Get the saddle ID for a saddle.
|
||||
pub fun saddle-id(s: saddle): saddle-id
|
||||
match s
|
||||
{{- range $s := $.Saddles }}
|
||||
{{ kkenum $s.Name }}{{ if $s.Alternate }}-Alt{{ $s.ID }}{{ end }} -> Saddle-id({{ $s.ID }})
|
||||
{{- end }}
|
||||
|
||||
// List of all saddles in ID order for easy iterating.
|
||||
pub val all = [
|
||||
{{- range $s := $.Saddles }}
|
||||
{{ kkenum $s.Name }}{{ if $s.Alternate }}-Alt{{ $s.ID }}{{ end }},
|
||||
{{- end }}
|
||||
]
|
||||
extern create-id-table(): vector<int>
|
||||
c inline "int32_t arr[] = { {{- range $s := $.Saddles }}{{ $s.ID }},{{ end -}} };\nkk_vector_from_cint32array(arr, (kk_ssize_t){{ $.SaddleCount }}, kk_context())"
|
||||
js inline "[{{ range $s := $.Saddles }}{{ $s.ID }},{{ end }}]"
|
||||
// Vector of all saddle IDs in order for easy iterating.
|
||||
val all = once(create-id-table)
|
||||
|
||||
// Get the name for a saddle.
|
||||
// Alternate versions of saddles have an indication of their ID in their names.
|
||||
|
||||
Reference in New Issue
Block a user