From 8316920d20da099c007de1e13b3cc5a25749f6d6 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 16 Dec 2018 16:43:15 +0000 Subject: [PATCH 1/3] Additional locale fixes. --- data/locale/characters.dat | 2 +- locale/fr.po | 2 +- src/system/text.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/locale/characters.dat b/data/locale/characters.dat index 9d09bd6..32a4940 100644 --- a/data/locale/characters.dat +++ b/data/locale/characters.dat @@ -1 +1 @@ -&|_# POfileorTBFS:handWCpygt2015-6,JwsbuGNUL3.Emj@c/"IV\RMD8+v?x;=%!AYq()'kH[]KzQX4Z79*àéí¡Çóè·úïçüºòÉÒÍÀ°æåøÆÅØ<>öÄäßÜá¿ñÁÊûâîôÈêùœÙìëęąłćżńśźŻŚŁĆÖ +Ö&|_# POfileorTBFS:handWCpygt2015-6,JwsbuGNUL3.Emj@c/"IV\RMD8+v?x;=%!AYq()'kH[]KzQX4Z79*àéí¡Çóè·úïçüºòÉÒÍÀ°æåøÆÅØ<>öÄäßÜá¿ñÁÊûâîôÈêùœÙìëęąłćżńśźŻŚŁĆÖ diff --git a/locale/fr.po b/locale/fr.po index 57dff3f..367ad32 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -81,7 +81,7 @@ msgid "Missiles" msgstr "Missiles" msgid "Missiles (%d)" -msgstr "Missiles ( %d )" +msgstr "Missiles (%d)" msgid "Target: %.2fkm" msgstr "Cible:% .2fkm" diff --git a/src/system/text.c b/src/system/text.c index f0712f1..4696c45 100644 --- a/src/system/text.c +++ b/src/system/text.c @@ -187,7 +187,7 @@ static void drawTextLines(int x, int y, int size, int align, SDL_Color color) memset(&line, '\0', sizeof(line)); memset(&token, '\0', sizeof(token)); - len = strlenMB(drawTextBuffer); + len = strlen(drawTextBuffer); n = currentWidth = 0; From bf6653505543a50ff2471a2ab7de8e1dd4bc6f00 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 16 Dec 2018 17:23:20 +0000 Subject: [PATCH 2/3] Removed strlenMB. Redundant. --- src/system/text.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/system/text.c b/src/system/text.c index 4696c45..3bfb68a 100644 --- a/src/system/text.c +++ b/src/system/text.c @@ -29,7 +29,6 @@ void useFont(char *name); static void initChars(Font *f); static char *nextCharacter(const char *str, int *i); static Glyph *findGlyph(char *c); -static int strlenMB(char *text); static SDL_Color white = {255, 255, 255, 255}; static char drawTextBuffer[1024]; @@ -365,7 +364,7 @@ int getWrappedTextHeight(char *text, int size) y = 0; h = 0; currentWidth = 0; - len = strlenMB(drawTextBuffer); + len = strlen(drawTextBuffer); memset(word, 0, MAX_WORD_LENGTH); for (i = 0 ; i < len ; i++) @@ -421,23 +420,3 @@ static char *nextCharacter(const char *str, int *i) *i = *i + 1; } } - -static int strlenMB(char *text) -{ - int i, n; - unsigned char bit; - - n = 0; - - for (i = 0 ; i < strlen(text) ; i++) - { - bit = (unsigned char)text[i]; - - if ((bit >= ' ' && bit <= '~') || bit >= 0xC0) - { - n++; - } - } - - return n; -} From 295e13a5ae98bf03bcf09cbb4337d7ac467dede3 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 16 Dec 2018 17:23:33 +0000 Subject: [PATCH 3/3] Translate names of missions. --- src/galaxy/mission.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 66449f3..7b1cf63 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -46,7 +46,7 @@ Mission *loadMissionMeta(char *filename) mission = malloc(sizeof(Mission)); memset(mission, 0, sizeof(Mission)); - STRNCPY(mission->name, cJSON_GetObjectItem(root, "name")->valuestring, MAX_NAME_LENGTH); + STRNCPY(mission->name, _(cJSON_GetObjectItem(root, "name")->valuestring), MAX_NAME_LENGTH); STRNCPY(mission->description, _(cJSON_GetObjectItem(root, "description")->valuestring), MAX_DESCRIPTION_LENGTH); STRNCPY(mission->filename, filename, MAX_DESCRIPTION_LENGTH);