0 wastelands, size bug

This commit is contained in:
Aaron Fischer 2021-03-21 00:12:29 +01:00
parent 3871273730
commit 1a5fc52bc2
2 changed files with 19 additions and 17 deletions

View file

@ -111,6 +111,7 @@ func New(size int, numWastelands int, numMountains int, numRuins int, seed strin
// and surround it with 6 more wastelands
var wastelands []int
if numWastelands > 0 {
startPos := roll(w.Size-1) + roll(w.Size-1)*w.Size
w.place(WastelandTerritory, startPos)
wastelands = append(wastelands, startPos)
@ -133,6 +134,7 @@ func New(size int, numWastelands int, numMountains int, numRuins int, seed strin
w.place(WastelandTerritory, candidate)
wastelands = append(wastelands, candidate)
}
}
// Place 5 mountains on free tiles. We need to make sure that
// a mountain do not touch another mountain.

View file

@ -33,7 +33,7 @@ func Start(address string, port int) {
}
func mapHandler(w http.ResponseWriter, req *http.Request) {
size, err := strconv.Atoi(req.URL.Query().Get("size"))
size, err := strconv.Atoi(req.URL.Query().Get("s"))
if err != nil {
size = 11
}