1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-16 17:35:57 -05:00

Label fix (#931)

This commit is contained in:
Michał Mrówka 2020-11-18 08:50:31 +01:00 committed by GitHub
parent 28a16a36e0
commit 2a36c956a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 13 deletions

View File

@ -28,18 +28,18 @@ func GetLanguageLiteral(code byte) string {
// Source https://github.com/eezstreet/OpenD2/blob/065f6e466048482b28b9dbc6286908dc1e0d10f6/Shared/D2Shared.hpp#L36
func getCharsets() map[string]string {
return map[string]string{
"ENG": "LATIN", // (English)
"ESP": "LATIN", // (Spanish)
"DEU": "LATIN", // (German)
"FRA": "LATIN", // (French)
"POR": "LATIN", // (Portuguese)
"ITA": "LATIN", // (Italian)
"JPN": "JAPAN", // (Japanese)
"KOR": "KOREAN", // (Korean)
"SIN": "LATIN", //
"CHI": "CHINESE", // (Chinese)
"POL": "LATIN2", // (Polish)
"RUS": "RUSSIAN", // (Russian)
"ENG": "LATIN", // (English)
"ESP": "LATIN", // (Spanish)
"DEU": "LATIN", // (German)
"FRA": "LATIN", // (French)
"POR": "LATIN", // (Portuguese)
"ITA": "LATIN", // (Italian)
"JPN": "JPN", // (Japanese)
"KOR": "KOR", // (Korean)
"SIN": "LATIN", //
"CHI": "CHI", // (Chinese)
"POL": "LATIN2", // (Polish)
"RUS": "CYR", // (Russian)
}
}

View File

@ -133,7 +133,11 @@ func (v *Label) processColorTokens(str string) string {
matchToken := tokenMatch.Find(match)
matchStr := string(tokenMatch.ReplaceAll(match, empty))
token := ColorToken(matchToken)
theColor := getColor(token)
if theColor == nil {
continue
}
if v.Color == nil {
v.Color = make(map[int]color.Color)
@ -183,7 +187,7 @@ func getColor(token ColorToken) color.Color {
chosen := colors[token]
if chosen == nil {
return colors[ColorTokenWhite]
return nil
}
return chosen