horsegen: better formatting for charater template
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -8,15 +8,15 @@ import std/core-extras
|
||||
|
||||
// Character identity.
|
||||
pub type character
|
||||
{{- range $uma := $.Characters }}
|
||||
{{- range $uma := $.Characters }}
|
||||
{{ kkenum $uma.Name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
// The list of all characters in order by ID, for easy iterating.
|
||||
pub val character/all = [
|
||||
{{- range $uma := $.Characters }}
|
||||
{{- range $uma := $.Characters }}
|
||||
{{ kkenum $uma.Name }},
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
]
|
||||
|
||||
// Get the character for a character ID.
|
||||
@@ -61,7 +61,7 @@ pub fun character/(==)(a: character, b: character): bool
|
||||
{{- end }}
|
||||
_ -> False
|
||||
|
||||
inline fip fun character/index(^c: character): int
|
||||
fip fun character/index(^c: character): int
|
||||
match c
|
||||
{{- range $uma := $.Characters }}
|
||||
{{ kkenum $uma.Name }} -> {{ $uma.Index }}
|
||||
@@ -70,8 +70,20 @@ inline fip fun character/index(^c: character): int
|
||||
// Create the table of all pair affinities.
|
||||
// The affinity is the value at a.index*count + b.index.
|
||||
extern global/create-pair-table(): vector<int>
|
||||
c inline "kk_intx_t arr[] = { {{- range $a := $.Characters }}{{ range $b := $.Characters }}{{ index $.PairMaps $a.ID $b.ID }},{{ end }}{{ end -}} };\nkk_vector_from_cintarray(arr, (kk_ssize_t){{ $.Count }}*(kk_ssize_t){{ $.Count }}, kk_context())"
|
||||
js inline "[ {{- range $a := $.Characters }}{{ range $b := $.Characters }}{{ index $.PairMaps $a.ID $b.ID }},{{ end }}{{ end -}} ]"
|
||||
c inline "kk_intx_t arr[] = {
|
||||
{{- range $a := $.Characters }}
|
||||
{{- range $b := $.Characters }}
|
||||
{{- index $.PairMaps $a.ID $b.ID }},
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
};\nkk_vector_from_cintarray(arr, (kk_ssize_t){{ $.Count }} * (kk_ssize_t){{ $.Count }}, kk_context())"
|
||||
js inline "[
|
||||
{{- range $a := $.Characters }}
|
||||
{{- range $b := $.Characters }}
|
||||
{{- index $.PairMaps $a.ID $b.ID }},
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
]"
|
||||
val global/pair-table = global/create-pair-table()
|
||||
|
||||
// Base affinity between a pair using the global ruleset.
|
||||
@@ -81,8 +93,24 @@ pub fun global/pair-affinity(a: character, b: character): int
|
||||
// Create the table of all trio affinities.
|
||||
// The affinity is the value at a.index*count*count + b.index*count + c.index.
|
||||
extern global/create-trio-table(): vector<int>
|
||||
c inline "kk_intx_t arr[] = { {{- range $a := $.Characters }}{{ range $b := $.Characters }}{{ range $c := $.Characters }}{{ index $.TrioMaps $a.ID $b.ID $c.ID }},{{ end }}{{ end }}{{ end -}} };\nkk_vector_from_cintarray(arr, (kk_ssize_t){{ $.Count }}*(kk_ssize_t){{ $.Count }}*(kk_ssize_t){{ $.Count }}, kk_context())"
|
||||
js inline "[ {{- range $a := $.Characters }}{{ range $b := $.Characters }}{{ range $c := $.Characters }}{{ index $.TrioMaps $a.ID $b.ID $c.ID }},{{ end }}{{ end }}{{ end -}} ]"
|
||||
c inline "kk_intx_t arr[] = {
|
||||
{{- range $a := $.Characters }}
|
||||
{{- range $b := $.Characters }}
|
||||
{{- range $c := $.Characters }}
|
||||
{{- index $.TrioMaps $a.ID $b.ID $c.ID }},
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
};\nkk_vector_from_cintarray(arr, (kk_ssize_t){{ $.Count }} * (kk_ssize_t){{ $.Count }} * (kk_ssize_t){{ $.Count }}, kk_context())"
|
||||
js inline "[
|
||||
{{- range $a := $.Characters }}
|
||||
{{- range $b := $.Characters }}
|
||||
{{- range $c := $.Characters }}
|
||||
{{- index $.TrioMaps $a.ID $b.ID $c.ID }},
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
]"
|
||||
val global/trio-table = global/create-trio-table()
|
||||
|
||||
// Base affinity for a trio using the global ruleset.
|
||||
|
||||
Reference in New Issue
Block a user