summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2021-03-17 11:05:02 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2021-03-17 11:05:02 (EDT)
commit2657bc0019a6840c90f3daa090c7101e5c7997d1 (patch)
tree7f827f272c3f3a54bb262d855d8c725489c6dbe4 /src
parentaaa24157f390ae5ec0a3d8ce221faba2db903cb1 (diff)
downloaddodge-balls-2657bc0019a6840c90f3daa090c7101e5c7997d1.zip
dodge-balls-2657bc0019a6840c90f3daa090c7101e5c7997d1.tar.gz
dodge-balls-2657bc0019a6840c90f3daa090c7101e5c7997d1.tar.bz2
game: Save best locale match
Diffstat (limited to 'src')
-rw-r--r--src/game.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/game.c b/src/game.c
index be3d40d..a8ab3e4 100644
--- a/src/game.c
+++ b/src/game.c
@@ -217,6 +217,7 @@ _db_game_xml_game_el_start(void *pv, const char *name, const char **attr)
XML_Parser p;
struct db_game *game;
char *lang;
+ int match;
db_dbg(" <%s> (game child)", name);
@@ -230,7 +231,9 @@ _db_game_xml_game_el_start(void *pv, const char *name, const char **attr)
return;
}
db_dbg(" lang=\"%s\"", lang);
- if (db_locale_match(lang) > game->best_name_match) {
+ match = db_locale_match(lang);
+ if (match > game->best_name_match) {
+ game->best_name_match = match;
goto name_ok;
}
db_xml_node_push(p, game, _db_game_xml_invalid_start,
@@ -255,7 +258,9 @@ _db_game_xml_game_el_start(void *pv, const char *name, const char **attr)
return;
}
db_dbg(" lang=\"%s\"", lang);
- if (db_locale_match(lang) > game->best_desc_match) {
+ match = db_locale_match(lang);
+ if (match > game->best_desc_match) {
+ game->best_name_match = match;
goto desc_ok;
}
db_xml_node_push(p, game, _db_game_xml_invalid_start,