diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-15 22:11:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-15 22:11:03 +0300 |
commit | 30b7aeb3fc9ccec754f404d8c7b73b80983388aa (patch) | |
tree | 34db74f128731cfd640b60a576cfd2616773c717 | |
parent | c4a3fd1133cea06a1716ae81d9c5cf8b7f1ddb8b (diff) | |
download | plugin-30b7aeb3fc9ccec754f404d8c7b73b80983388aa.tar.gz plugin-30b7aeb3fc9ccec754f404d8c7b73b80983388aa.tar.bz2 plugin-30b7aeb3fc9ccec754f404d8c7b73b80983388aa.tar.xz plugin-30b7aeb3fc9ccec754f404d8c7b73b80983388aa.zip |
Fix lg function.
Now it need two strings for text translation based on gender.
-rw-r--r-- | src/map/utils/formatutils.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/map/utils/formatutils.c b/src/map/utils/formatutils.c index c30af49..0d50c25 100644 --- a/src/map/utils/formatutils.c +++ b/src/map/utils/formatutils.c @@ -56,18 +56,31 @@ int format_sub(struct script_state* st, int translate) } char *line = (char *) aCalloc (550, sizeof (char)); + int idx = 3; if (sd) { if (translate == 2) { - char *buf = aCalloc (strlen(script_getstr(st, 2)) + 3, sizeof(char)); - strcpy (buf, script_getstr(st, 2)); + char *str = NULL; + char *buf = NULL; if (sd->status.sex) + { + str = script_getstr(st, 3); + buf = aCalloc (strlen(str) + 3, sizeof(char)); + strcpy (buf, str); strcat (buf, "#1"); + } else + { + str = script_getstr(st, 2); + buf = aCalloc (strlen(str) + 3, sizeof(char)); + strcpy (buf, str); strcat (buf, "#0"); + } + ShowWarning("going to translate: %s\n", buf); strcpy(line, lang_pctrans(buf, sd)); aFree (buf); + idx = 4; } else { @@ -80,7 +93,6 @@ int format_sub(struct script_state* st, int translate) } char *ptr = line; - int idx = 3; int sz = strlen(line); while (script_hasdata(st, idx)) { |