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.
|
// Character identity.
|
||||||
pub type character
|
pub type character
|
||||||
{{- range $uma := $.Characters }}
|
{{- range $uma := $.Characters }}
|
||||||
{{ kkenum $uma.Name }}
|
{{ kkenum $uma.Name }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
// The list of all characters in order by ID, for easy iterating.
|
// The list of all characters in order by ID, for easy iterating.
|
||||||
pub val character/all = [
|
pub val character/all = [
|
||||||
{{- range $uma := $.Characters }}
|
{{- range $uma := $.Characters }}
|
||||||
{{ kkenum $uma.Name }},
|
{{ kkenum $uma.Name }},
|
||||||
{{- end }}
|
{{- end }}
|
||||||
]
|
]
|
||||||
|
|
||||||
// Get the character for a character ID.
|
// Get the character for a character ID.
|
||||||
@@ -61,7 +61,7 @@ pub fun character/(==)(a: character, b: character): bool
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
_ -> False
|
_ -> False
|
||||||
|
|
||||||
inline fip fun character/index(^c: character): int
|
fip fun character/index(^c: character): int
|
||||||
match c
|
match c
|
||||||
{{- range $uma := $.Characters }}
|
{{- range $uma := $.Characters }}
|
||||||
{{ kkenum $uma.Name }} -> {{ $uma.Index }}
|
{{ kkenum $uma.Name }} -> {{ $uma.Index }}
|
||||||
@@ -70,8 +70,20 @@ inline fip fun character/index(^c: character): int
|
|||||||
// Create the table of all pair affinities.
|
// Create the table of all pair affinities.
|
||||||
// The affinity is the value at a.index*count + b.index.
|
// The affinity is the value at a.index*count + b.index.
|
||||||
extern global/create-pair-table(): vector<int>
|
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())"
|
c inline "kk_intx_t arr[] = {
|
||||||
js inline "[ {{- range $a := $.Characters }}{{ range $b := $.Characters }}{{ index $.PairMaps $a.ID $b.ID }},{{ end }}{{ end -}} ]"
|
{{- 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()
|
val global/pair-table = global/create-pair-table()
|
||||||
|
|
||||||
// Base affinity between a pair using the global ruleset.
|
// 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.
|
// Create the table of all trio affinities.
|
||||||
// The affinity is the value at a.index*count*count + b.index*count + c.index.
|
// The affinity is the value at a.index*count*count + b.index*count + c.index.
|
||||||
extern global/create-trio-table(): vector<int>
|
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())"
|
c inline "kk_intx_t arr[] = {
|
||||||
js inline "[ {{- range $a := $.Characters }}{{ range $b := $.Characters }}{{ range $c := $.Characters }}{{ index $.TrioMaps $a.ID $b.ID $c.ID }},{{ end }}{{ end }}{{ end -}} ]"
|
{{- 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()
|
val global/trio-table = global/create-trio-table()
|
||||||
|
|
||||||
// Base affinity for a trio using the global ruleset.
|
// Base affinity for a trio using the global ruleset.
|
||||||
|
|||||||
Reference in New Issue
Block a user