From 30b7aeb3fc9ccec754f404d8c7b73b80983388aa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Jan 2015 22:11:03 +0300 Subject: Fix lg function. Now it need two strings for text translation based on gender. --- src/map/utils/formatutils.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/map') 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)) { -- cgit v1.2.3-70-g09d2