From d4bd2bc7f7f7e1101dff49a189e822ed1c311851 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 8 Jul 2012 11:37:19 -0700 Subject: [PATCH 1/6] remove DELIVER translate hunger in the NR --- res/de/strings.xml | 8 +++++--- src/gamecode/economy.c | 2 +- src/kernel/order.c | 5 ----- src/kernel/reports.c | 10 ++++++---- src/kernel/types.h | 1 - 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/res/de/strings.xml b/res/de/strings.xml index aea55a6a9..d7f7039f6 100644 --- a/res/de/strings.xml +++ b/res/de/strings.xml @@ -2200,9 +2200,6 @@ LERNEN - - LIEFERE - MACHEN @@ -6980,6 +6977,11 @@ guards the region + + hungert + hungry + + und and diff --git a/src/gamecode/economy.c b/src/gamecode/economy.c index 6668c3a21..859cdd079 100644 --- a/src/gamecode/economy.c +++ b/src/gamecode/economy.c @@ -1306,7 +1306,7 @@ void economics(region * r) ord = NULL; destroyed = true; } - } else if (kwd == K_GIVE || kwd == K_LIEFERE) { + } else if (kwd == K_GIVE) { give_cmd(u, ord); } else if (kwd == K_FORGET) { forget_cmd(u, ord); diff --git a/src/kernel/order.c b/src/kernel/order.c index 4457a5c6b..13cd7dc6d 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -260,10 +260,6 @@ static order *create_order_i(keyword_t kwd, const char *sptr, int persistent, case K_KOMMENTAR: case NOKEYWORD: return NULL; - case K_LIEFERE: - kwd = K_GIVE; - persistent = 1; - break; default: break; } @@ -575,7 +571,6 @@ bool is_persistent(const order * ord) return false; case K_KOMMENTAR: - case K_LIEFERE: return true; default: diff --git a/src/kernel/reports.c b/src/kernel/reports.c index 86995cb2d..54cdbb011 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -620,10 +620,12 @@ bufunit(const faction * f, const unit * u, int indent, int mode, char *buf, WARN_STATIC_BUFFER(); } if (fval(u, UFL_HUNGER)) { - if (c) - bytes = (int)strlcpy(bufp, ", hungert", size); - else - bytes = (int)strlcpy(bufp, "hungert", size); + if (c) { + bytes = (int)strlcpy(bufp, ", ", size); + if (wrptr(&bufp, &size, bytes) != 0) + WARN_STATIC_BUFFER(); + } + bytes = (int)strlcpy(bufp, LOC(f->locale, "unit_hungers"), size); if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER(); } diff --git a/src/kernel/types.h b/src/kernel/types.h index f6f1e4099..f023e435a 100644 --- a/src/kernel/types.h +++ b/src/kernel/types.h @@ -101,7 +101,6 @@ typedef enum { K_CONTACT, K_TEACH, K_STUDY, - K_LIEFERE, K_MAKE, K_MOVE, K_PASSWORD, From 7b0bdd568d6e8c2d915dcaf0139020484cee1fa5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 8 Jul 2012 11:44:57 -0700 Subject: [PATCH 2/6] fix previous commit --- src/kernel/config.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index 224923bf3..caf72d6cb 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -410,7 +410,6 @@ const char *keywords[MAXKEYWORDS] = { "KONTAKTIEREN", "LEHREN", "LERNEN", - "LIEFERE", "MACHEN", "NACH", "PASSWORT", From 9812a8dc3408db83b5e035fa48722bdc4a356d3d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 8 Jul 2012 15:40:37 -0700 Subject: [PATCH 3/6] translate spell modifiers --- res/de/strings.xml | 25 +++++++++++++ src/gamecode/report.c | 81 +++++++++++++++++++------------------------ 2 files changed, 61 insertions(+), 45 deletions(-) diff --git a/res/de/strings.xml b/res/de/strings.xml index d7f7039f6..c0f770f37 100644 --- a/res/de/strings.xml +++ b/res/de/strings.xml @@ -6982,6 +6982,31 @@ hungry + + Fernzauber + far + + + + Seezauber + sea + + + + Schiffszauber + ship + + + + Magier exklusiv + magicians only + + + + Keine + none + + und and diff --git a/src/gamecode/report.c b/src/gamecode/report.c index 898b06c20..ee4f24608 100644 --- a/src/gamecode/report.c +++ b/src/gamecode/report.c @@ -218,12 +218,26 @@ rparagraph(FILE * F, const char *str, ptrdiff_t indent, int hanging_indent, } while (*begin); } +static size_t write_spell_modifier(spell * sp, int flag, const char * str, bool cont, char * bufp, size_t size) { + if (sp->sptyp & flag) { + size_t bytes = 0; + if (cont) { + bytes = strlcpy(bufp, ", ", size); + } else { + bytes = strlcpy(bufp, " ", size); + } + bytes += strlcpy(bufp+bytes, str, size-bytes); + return bytes; + } + return 0; +} + static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang) { int bytes, k, itemanz, costtyp; int dh = 0; char buf[4096]; - char *bufp = buf; + char *startp, *bufp = buf; size_t size = sizeof(buf) - 1; spell * sp = sbe->sp; const char *params = sp->parameter; @@ -297,52 +311,29 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang) bytes = (int)strlcpy(buf, LOC(lang, "nr_spell_modifiers"), size); if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER(); - if (sp->sptyp & FARCASTING) { - bytes = (int)strlcpy(bufp, " Fernzauber", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - dh = 1; + + startp = bufp; + bytes = (int)write_spell_modifier(sp, FARCASTING, LOC(lang, "smod_far"), startp!=bufp, bufp, size); + if (bytes && wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); } - if (sp->sptyp & OCEANCASTABLE) { - if (dh == 1) { - bytes = (int)strlcpy(bufp, ",", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); + bytes = (int)write_spell_modifier(sp, OCEANCASTABLE, LOC(lang, "smod_sea"), startp!=bufp, bufp, size); + if (bytes && wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); + } + bytes = (int)write_spell_modifier(sp, ONSHIPCAST, LOC(lang, "smod_ship"), startp!=bufp, bufp, size); + if (bytes && wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); + } + bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_nofamiliar"), startp!=bufp, bufp, size); + if (bytes && wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); + } + if (startp==bufp) { + bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_none"), startp!=bufp, bufp, size); + if (bytes && wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); } - bytes = (int)strlcpy(bufp, " Seezauber", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - dh = 1; - } - if (sp->sptyp & ONSHIPCAST) { - if (dh == 1) { - bytes = (int)strlcpy(bufp, ",", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - } - bytes = (int)strlcpy(bufp, " Schiffszauber", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - dh = 1; - } - if (sp->sptyp & NOTFAMILIARCAST) { - if (dh == 1) { - bytes = (int)strlcpy(bufp, ", k", size); - } else { - bytes = (int)strlcpy(bufp, " K", size); - } - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - bytes = - (int)strlcpy(bufp, "ann nicht vom Vertrauten gezaubert werden", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - dh = 1; - } - if (dh == 0) { - bytes = (int)strlcpy(bufp, " Keine", size); - if (wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); } *bufp = 0; rparagraph(F, buf, 0, 0, 0); From e7f0650e4caa6e9b0c086b90a4afdb3ac7589ccf Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 8 Jul 2012 15:59:27 -0700 Subject: [PATCH 4/6] translate diplomatic status in the NR --- res/de/strings.xml | 20 ++++++++++++++++++++ src/gamecode/report.c | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/res/de/strings.xml b/res/de/strings.xml index c0f770f37..72292a714 100644 --- a/res/de/strings.xml +++ b/res/de/strings.xml @@ -7007,6 +7007,26 @@ none + + Wir helfen der Partei + We are helping the faction + + + + Wir helfen den Parteien + We are helping the factions + + + + hilft der Partei + is helping the faction + + + + hilft den Parteien + is helping the factions + + und and diff --git a/src/gamecode/report.c b/src/gamecode/report.c index ee4f24608..c5a7346eb 100644 --- a/src/gamecode/report.c +++ b/src/gamecode/report.c @@ -1727,9 +1727,9 @@ static void allies(FILE * F, const faction * f) int bytes; size_t size = sizeof(buf); if (!f->allies->next) { - bytes = (int)strlcpy(buf, "Wir helfen der Partei ", size); + bytes = snprintf(buf, size, "%s ", LOC(f->locale, "faction_help_one")); } else { - bytes = (int)strlcpy(buf, "Wir helfen den Parteien ", size); + bytes = snprintf(buf, size, "%s ", LOC(f->locale, "faction_help_many")); } size -= bytes; show_allies(f, f->allies, buf + bytes, size); @@ -1742,9 +1742,9 @@ static void allies(FILE * F, const faction * f) int bytes; size_t size = sizeof(buf); if (!g->allies->next) { - bytes = snprintf(buf, size, "%s hilft der Partei ", g->name); + bytes = snprintf(buf, size, "%s %s ", g->name, LOC(f->locale, "group_help_one")); } else { - bytes = snprintf(buf, size, "%s hilft den Parteien ", g->name); + bytes = snprintf(buf, size, "%s %s ", g->name, LOC(f->locale, "group_help_many")); } size -= bytes; show_allies(f, g->allies, buf + bytes, size); From 9af5f08a8a63e61ea48dd02ab8aff042774a08ca Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 8 Jul 2012 16:04:45 -0700 Subject: [PATCH 5/6] translate region visibility in NR --- res/de/strings.xml | 15 +++++++++++++++ src/gamecode/report.c | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/res/de/strings.xml b/res/de/strings.xml index 72292a714..2feb93f2a 100644 --- a/res/de/strings.xml +++ b/res/de/strings.xml @@ -7027,6 +7027,21 @@ is helping the factions + + durchgereist + travel + + + + benachbart + neighbour + + + + vom Turm erblickt + from lighthouse + + und and diff --git a/src/gamecode/report.c b/src/gamecode/report.c index c5a7346eb..1570a76b9 100644 --- a/src/gamecode/report.c +++ b/src/gamecode/report.c @@ -940,11 +940,11 @@ static void describe(FILE * F, const seen_region * sr, faction * f) WARN_STATIC_BUFFER(); if (sr->mode == see_travel) { - bytes = (int)strlcpy(bufp, " (durchgereist)", size); + bytes = snprintf(buf, size, " (%s)", LOC(f->locale, "see_travel")); } else if (sr->mode == see_neighbour) { - bytes = (int)strlcpy(bufp, " (benachbart)", size); + bytes = snprintf(buf, size, " (%s)", LOC(f->locale, "see_neighbour")); } else if (sr->mode == see_lighthouse) { - bytes = (int)strlcpy(bufp, " (vom Turm erblickt)", size); + bytes = snprintf(buf, size, " (%s)", LOC(f->locale, "see_lighthouse")); } else { bytes = 0; } From e01a420aa8edb53a72a926d952f7846ad780dfa0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 8 Jul 2012 16:10:48 -0700 Subject: [PATCH 6/6] translate travel-through message --- res/de/strings.xml | 10 ++++++++++ src/gamecode/report.c | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/res/de/strings.xml b/res/de/strings.xml index 2feb93f2a..3b7b88f43 100644 --- a/res/de/strings.xml +++ b/res/de/strings.xml @@ -7027,6 +7027,16 @@ is helping the factions + + hat die Region durchquert + has traveled through the region + + + + haben die Region durchquert + have traveled through the region + + durchgereist travel diff --git a/src/gamecode/report.c b/src/gamecode/report.c index 1570a76b9..3c773edc6 100644 --- a/src/gamecode/report.c +++ b/src/gamecode/report.c @@ -940,11 +940,11 @@ static void describe(FILE * F, const seen_region * sr, faction * f) WARN_STATIC_BUFFER(); if (sr->mode == see_travel) { - bytes = snprintf(buf, size, " (%s)", LOC(f->locale, "see_travel")); + bytes = snprintf(bufp, size, " (%s)", LOC(f->locale, "see_travel")); } else if (sr->mode == see_neighbour) { - bytes = snprintf(buf, size, " (%s)", LOC(f->locale, "see_neighbour")); + bytes = snprintf(bufp, size, " (%s)", LOC(f->locale, "see_neighbour")); } else if (sr->mode == see_lighthouse) { - bytes = snprintf(buf, size, " (%s)", LOC(f->locale, "see_lighthouse")); + bytes = snprintf(bufp, size, " (%s)", LOC(f->locale, "see_lighthouse")); } else { bytes = 0; } @@ -1432,9 +1432,9 @@ static void durchreisende(FILE * F, const region * r, const faction * f) } /* TODO: finish localization */ if (maxtravel == 1) { - bytes = (int)strlcpy(bufp, " hat die Region durchquert.", size); + bytes = snprintf(bufp, size, " %s", LOC(f->locale, "has_moved_one")); } else { - bytes = (int)strlcpy(bufp, " haben die Region durchquert.", size); + bytes = snprintf(bufp, size, " %s", LOC(f->locale, "has_moved_many")); } if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER();