main map, world name

This commit is contained in:
Robert Janetzko 2022-05-10 18:29:17 +00:00
parent 862cb7a82d
commit f13fa945e6
3 changed files with 23 additions and 12 deletions

View File

@ -32,6 +32,10 @@ func (w *DfWorld) LoadHistory() {
return return
} }
lines := strings.Split(string(data), "\n")
w.Name_ = lines[0]
w.Altname = lines[1]
fmt.Println("found world history", path) fmt.Println("found world history", path)
leaderRegEx := regexp.MustCompile(` \[\*\] (.+?) \(.*?Reign Began: (-?\d+)\)`) leaderRegEx := regexp.MustCompile(` \[\*\] (.+?) \(.*?Reign Began: (-?\d+)\)`)
results := regexp.MustCompile(`\n([^ ].*?), [^\n]+(?:\n [^\n]+)*`).FindAllStringSubmatch(util.ConvertCp473(data), -1) results := regexp.MustCompile(`\n([^ ].*?), [^\n]+(?:\n [^\n]+)*`).FindAllStringSubmatch(util.ConvertCp473(data), -1)

View File

@ -3,6 +3,21 @@
{{define "title"}}Legends Browser{{end}} {{define "title"}}Legends Browser{{end}}
{{define "content"}} {{define "content"}}
{{ if world.MapReady }}
<div class="object-map">
{{- if ne world.Name "" -}}
<h3>{{world.Name}} - {{world.Altname}}</h3>
{{- end }}
<div id="map" style="width: 750px; height: 750px"></div>
</div>
{{initMap}}
{{- range $race, $civs := .Civilizations }}{{- range $civs }}{{- range .Sites }}
{{ addSite . true }}
{{- end }}{{- end }}{{- end }}
{{- end }}
<h3>Civilizations</h3> <h3>Civilizations</h3>
<ul> <ul>
@ -16,16 +31,4 @@
{{- end }} {{- end }}
</ul> </ul>
{{ if world.MapReady }}
<div id="map" style="height: 400px"></div>
{{initMap}}
{{- range $race, $civs := .Civilizations }}
{{- range $civs }}
{{- range .Sites }}
{{ addSite . true }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }} {{- end }}

View File

@ -4,6 +4,10 @@
{{define "content"}} {{define "content"}}
{{- if ne world.Name "" -}}
<h3>{{world.Name}} - {{world.Altname}}</h3>
{{- end }}
{{ if world.MapReady }} {{ if world.MapReady }}
<div id="map" style="width: 100%; height: 1000px"></div> <div id="map" style="width: 100%; height: 1000px"></div>
{{initMap}} {{initMap}}