35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
{{- define "koka-scenario" -}}
|
|
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
|
|
|
|
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.
|
|
pub fun show(s: scenario-id): string
|
|
match s.game-id
|
|
{{- range $s := $.Scenarios }}
|
|
{{ $s.ID }} -> {{ printf "%q" $s.Name }}
|
|
{{- end }}
|
|
x -> "scenario " ++ x.show
|
|
|
|
// Get the full title for a scenario, e.g. "The Beginning: URA Finale".
|
|
// If no scenario matches the ID, the result contains the numeric ID.
|
|
pub fun title(s: scenario-id): string
|
|
match s.game-id
|
|
{{- range $s := $.Scenarios }}
|
|
{{ $s.ID }} -> {{ printf "%q" $s.Title }}
|
|
{{- end }}
|
|
x -> "scenario " ++ x.show
|
|
{{ end }}
|