diff --git a/backend/model/history.go b/backend/model/history.go index 2b77850..47cf0af 100644 --- a/backend/model/history.go +++ b/backend/model/history.go @@ -32,6 +32,10 @@ func (w *DfWorld) LoadHistory() { return } + lines := strings.Split(string(data), "\n") + w.Name_ = lines[0] + w.Altname = lines[1] + fmt.Println("found world history", path) leaderRegEx := regexp.MustCompile(` \[\*\] (.+?) \(.*?Reign Began: (-?\d+)\)`) results := regexp.MustCompile(`\n([^ ].*?), [^\n]+(?:\n [^\n]+)*`).FindAllStringSubmatch(util.ConvertCp473(data), -1) diff --git a/backend/templates/index.html b/backend/templates/index.html index b1e78f3..a851d71 100644 --- a/backend/templates/index.html +++ b/backend/templates/index.html @@ -3,6 +3,21 @@ {{define "title"}}Legends Browser{{end}} {{define "content"}} + +{{ if world.MapReady }} +
+ {{- if ne world.Name "" -}} +

{{world.Name}} - {{world.Altname}}

+ {{- end }} +
+
+{{initMap}} +{{- range $race, $civs := .Civilizations }}{{- range $civs }}{{- range .Sites }} +{{ addSite . true }} +{{- end }}{{- end }}{{- end }} +{{- end }} + +

Civilizations

-{{ if world.MapReady }} -
-{{initMap}} -{{- range $race, $civs := .Civilizations }} -{{- range $civs }} -{{- range .Sites }} -{{ addSite . true }} -{{- end }} -{{- end }} -{{- end }} -{{- end }} - {{- end }} \ No newline at end of file diff --git a/backend/templates/worldMap.html b/backend/templates/worldMap.html index 22602c7..26e3a23 100644 --- a/backend/templates/worldMap.html +++ b/backend/templates/worldMap.html @@ -4,6 +4,10 @@ {{define "content"}} +{{- if ne world.Name "" -}} +

{{world.Name}} - {{world.Altname}}

+{{- end }} + {{ if world.MapReady }}
{{initMap}}