Skip to content

Commit

Permalink
Add the original map
Browse files Browse the repository at this point in the history
  • Loading branch information
noahpistilli committed Dec 21, 2023
1 parent e9bcfc0 commit 0783ee9
Show file tree
Hide file tree
Showing 4 changed files with 20,719 additions and 28,834 deletions.
8 changes: 4 additions & 4 deletions countries.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func PopulateCountryCodes() {
countryCodes["Bulgaria"] = 70
countryCodes["Croatia"] = 71
countryCodes["Cyprus"] = 72
countryCodes["Czechia"] = 73
countryCodes["Czech Republic"] = 73
countryCodes["Denmark"] = 74
countryCodes["Estonia"] = 75
countryCodes["Finland"] = 76
Expand All @@ -84,7 +84,7 @@ func PopulateCountryCodes() {
countryCodes["Liechtenstein"] = 86
countryCodes["Lithuania"] = 87
countryCodes["Luxembourg"] = 88
countryCodes["North Macedonia"] = 89
countryCodes["F.Y.R. of Macedonia"] = 89
countryCodes["Malta"] = 90
countryCodes["Montenegro"] = 91
countryCodes["Mozambique"] = 92
Expand All @@ -104,7 +104,7 @@ func PopulateCountryCodes() {
countryCodes["Eswatini"] = 106
countryCodes["Sweden"] = 107
countryCodes["Switzerland"] = 108
countryCodes["Türkiye"] = 109
countryCodes["Turkey"] = 109
countryCodes["United Kingdom"] = 110
countryCodes["Zambia"] = 111
countryCodes["Zimbabwe"] = 112
Expand Down Expand Up @@ -161,7 +161,7 @@ func PopulateCountryCodes() {
countryCodes["Tajikistan"] = 165
countryCodes["Turkmenistan"] = 166
countryCodes["Uzbekistan"] = 167
countryCodes["United Arab Emirates"] = 168
countryCodes["U.A.E"] = 168
countryCodes["India"] = 169
countryCodes["Egypt"] = 170
countryCodes["Oman"] = 171
Expand Down
20 changes: 20 additions & 0 deletions duplicates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/wii-tools/lzx/lz10"
"os"
"testing"
"unicode/utf16"
)

func TestDuplicates(t *testing.T) {
Expand Down Expand Up @@ -41,10 +42,12 @@ func TestDuplicates(t *testing.T) {
locationCode := binary.BigEndian.Uint32(decompressed[shortTableOffset:])
locationTableOffset := header.LocationsTableOffset
count := 0
var locationOffsets []uint32
for ii := 0; ii < int(header.NumberOfLocations); ii++ {
currentLocationCode := binary.BigEndian.Uint32(decompressed[locationTableOffset:])
if currentLocationCode == locationCode {
count++
locationOffsets = append(locationOffsets, locationTableOffset)
}

locationTableOffset += 24
Expand All @@ -53,6 +56,23 @@ func TestDuplicates(t *testing.T) {
if count != 1 {
fmt.Println(fmt.Sprintf("Error in Country %s", c))
fmt.Println(fmt.Sprintf("Duplicate Detected. Count: %d, Location Code: %d", count, locationCode))

for _, offset := range locationOffsets {
theNameOffset := binary.BigEndian.Uint32(decompressed[offset+4:])
var name []uint16
for {
// Find the name of the city I hope
currBytes := binary.BigEndian.Uint16(decompressed[theNameOffset:])
if currBytes == 0 {
break
}

name = append(name, currBytes)
theNameOffset += 2
}

fmt.Println("City Name: ", string(utf16.Decode(name)))
}
}

shortTableOffset += 72
Expand Down
5 changes: 0 additions & 5 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ func (f *Forecast) GetTemperatureFlag() uint8 {
}

func GetSupportedLanguages(countryCode uint8) []uint8 {
// Fill out the Russian supported countries first as those are specific
if countryCode == 18 {
return []uint8{7}
}

if countryCode == 1 {
return []uint8{0, 1, 2, 3, 4, 5, 6}
} else if 8 <= countryCode && countryCode <= 52 {
Expand Down
Loading

0 comments on commit 0783ee9

Please sign in to comment.