diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5048358 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Dawid WysokiƄski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..715aca2 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# map-generator + +[TribalWars](https://www.tribalwars.net/en-dk/) server map generation package. diff --git a/generator/generator.go b/generator/generator.go index ba75370..94d6be9 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -24,22 +24,28 @@ const ( type Marker struct { Larger bool Villages []*models.Village `json:"villages" gqlgen:"villages" xml:"villages"` - Color string `json:"color" gqlgen:"color" xml:"color"` + // Color in HEX format + Color string `json:"color" gqlgen:"color" xml:"color"` } type Config struct { - Markers []*Marker - Destination io.Writer - MapSize int - ContinentGrid bool - ContinentNumbers bool - BackgroundColor string - GridLineColor string + Markers []*Marker + Destination io.Writer + // Default 1000x1000 + MapSize int + ContinentGrid bool + ContinentNumbers bool + // BackgroundColor in HEX format + BackgroundColor string + // GridLineColor in HEX format + GridLineColor string + // ContinentNumberColor in HEX format ContinentNumberColor string Scale float32 CenterX int CenterY int - Quality int + // Quality of image (1-100) + Quality int } func (cfg *Config) init() { @@ -55,7 +61,7 @@ func (cfg *Config) init() { if cfg.MapSize <= 0 { cfg.MapSize = defaultMapSize } - if cfg.Quality <= 0 { + if cfg.Quality <= 0 || cfg.Quality > 100 { cfg.Quality = defaultQuality } if cfg.Scale < 1 {