forked from github/server
Merge branch 'master' of github.com:eressea/server
This commit is contained in:
commit
a289eee06f
|
@ -6944,34 +6944,24 @@
|
|||
<text locale="en">none</text>
|
||||
</string>
|
||||
|
||||
<string name="faction_help_one">
|
||||
<text locale="de">Wir helfen der Partei</text>
|
||||
<text locale="en">We are helping the faction</text>
|
||||
<string name="faction_help">
|
||||
<text locale="de">Wir helfen</text>
|
||||
<text locale="en">We are helping</text>
|
||||
</string>
|
||||
|
||||
<string name="faction_help_many">
|
||||
<text locale="de">Wir helfen den Parteien</text>
|
||||
<text locale="en">We are helping the factions</text>
|
||||
</string>
|
||||
|
||||
<string name="group_help_one">
|
||||
<text locale="de">hilft der Partei</text>
|
||||
<text locale="en">is helping the faction</text>
|
||||
</string>
|
||||
|
||||
<string name="group_help_many">
|
||||
<text locale="de">hilft den Parteien</text>
|
||||
<text locale="en">is helping the factions</text>
|
||||
<string name="group_help">
|
||||
<text locale="de">hilft</text>
|
||||
<text locale="en">is helping</text>
|
||||
</string>
|
||||
|
||||
<string name="has_moved_one">
|
||||
<text locale="de">hat die Region durchquert</text>
|
||||
<text locale="en">has traveled through the region</text>
|
||||
<text locale="de">hat die Region durchquert.</text>
|
||||
<text locale="en">passed through the region.</text>
|
||||
</string>
|
||||
|
||||
<string name="has_moved_many">
|
||||
<text locale="de">haben die Region durchquert</text>
|
||||
<text locale="en">have traveled through the region</text>
|
||||
<text locale="de">haben die Region durchquert.</text>
|
||||
<text locale="en">passed through the region.</text>
|
||||
</string>
|
||||
|
||||
<string name="see_travel">
|
||||
|
|
|
@ -804,51 +804,49 @@
|
|||
<arg name="max" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Unterhaltung: max. $int($max) Silber"</text>
|
||||
<text locale="en">"Entertainment: max. $int($max) silver"</text>
|
||||
<text locale="en">"entertainment: max. $int($max) silver"</text>
|
||||
</message>
|
||||
<message name="nr_stat_morale" section="nr">
|
||||
<type>
|
||||
<arg name="morale" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Moral der Bauern: $int($morale)"</text>
|
||||
<text locale="en">"Peasant morale: $int($morale)"</text>
|
||||
<text locale="en">"peasant morale: $int($morale)"</text>
|
||||
</message>
|
||||
<message name="nr_stat_luxuries" section="nr">
|
||||
<type>
|
||||
<arg name="max" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Luxusgüter zum angegebenen Preis: $int($max)"</text>
|
||||
<text locale="en">"Luxury goods at this price: $int($max)"</text>
|
||||
<text locale="en">"luxury goods at this price: $int($max)"</text>
|
||||
</message>
|
||||
<message name="nr_stat_salary" section="nr">
|
||||
<type>
|
||||
<arg name="max" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Lohn für Arbeit: $int($max) Silber"</text>
|
||||
<text locale="en">"Worker salary: $int($max) silver"</text>
|
||||
<text locale="en">"worker salary: $int($max) silver"</text>
|
||||
</message>
|
||||
<message name="nr_stat_salary_new" section="nr">
|
||||
<type>
|
||||
<arg name="max" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Bauerneinnahmen: $int($max) Silber"</text>
|
||||
<text locale="en">"Peasant wages: $int($max) silver"</text>
|
||||
<text locale="en">"peasant wages: $int($max) silver"</text>
|
||||
</message>
|
||||
<message name="nr_stat_people" section="nr">
|
||||
<type>
|
||||
<arg name="max" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Personen: $int($max)"</text>
|
||||
<text locale="en">"People: $int($max)"</text>
|
||||
<text locale="fr">"People: $int($max)"</text>
|
||||
<text locale="en">"people: $int($max)"</text>
|
||||
</message>
|
||||
<message name="nr_stat_recruits" section="nr">
|
||||
<type>
|
||||
<arg name="max" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"Rekruten: max. $int($max) Bauern"</text>
|
||||
<text locale="en">"Recruits: $int($max) peasants"</text>
|
||||
<text locale="fr">"Recruits: $int($max) peasants"</text>
|
||||
<text locale="en">"recruits: $int($max) peasants"</text>
|
||||
</message>
|
||||
<message name="nr_score" section="nr">
|
||||
<type>
|
||||
|
@ -857,7 +855,6 @@
|
|||
</type>
|
||||
<text locale="de">"Deine Partei hat $int($score) Punkte. Der Durchschnitt für Parteien ähnlichen Alters ist $int($average) Punkte."</text>
|
||||
<text locale="fr">"Your faction has a score of $int($score). The average score for similar factions is $int($average)."</text>
|
||||
<text locale="en">"Your faction has a score of $int($score). The average score for similar factions is $int($average)."</text>
|
||||
</message>
|
||||
<message name="nr_header_date" section="nr">
|
||||
<type>
|
||||
|
|
|
@ -14,6 +14,7 @@ equipment.test.c
|
|||
curse.test.c
|
||||
item.test.c
|
||||
move.test.c
|
||||
order.test.c
|
||||
pool.test.c
|
||||
reports.test.c
|
||||
spellbook.test.c
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
+-------------------+
|
||||
| | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| Eressea PBEM host | Enno Rehling <enno@eressea.de>
|
||||
| (c) 1998 - 2004 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2014 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| |
|
||||
+-------------------+
|
||||
|
||||
|
@ -44,7 +44,7 @@ static struct locale_data *locale_array[16];
|
|||
static int nlocales = 0;
|
||||
|
||||
typedef struct order_data {
|
||||
char *_str;
|
||||
const char *_str;
|
||||
# ifdef LOMEM
|
||||
int _refcount:20;
|
||||
int _lindex:4;
|
||||
|
@ -59,8 +59,6 @@ static void release_data(order_data * data)
|
|||
{
|
||||
if (data) {
|
||||
if (--data->_refcount == 0) {
|
||||
if (data->_str)
|
||||
free(data->_str);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
@ -182,6 +180,22 @@ void free_orders(order ** olist)
|
|||
}
|
||||
}
|
||||
|
||||
static char *mkdata(order_data **pdata, size_t len, keyword_t kwd, int lindex, const char *str)
|
||||
{
|
||||
order_data *data;
|
||||
char *result;
|
||||
data = malloc(sizeof(order_data) + len +1);
|
||||
result = (char *)(data + 1);
|
||||
data->_keyword = kwd;
|
||||
data->_lindex = lindex;
|
||||
data->_refcount = 0;
|
||||
data->_str = 0;
|
||||
data->_str = (len > 0) ? result : 0;
|
||||
if (str) strcpy(result, str);
|
||||
if (pdata) *pdata = data;
|
||||
return result;
|
||||
}
|
||||
|
||||
static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
|
||||
{
|
||||
const char *s = sptr;
|
||||
|
@ -204,21 +218,15 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
|
|||
data = locale_array[lindex]->study_orders[sk];
|
||||
if (data == NULL) {
|
||||
const char *skname = skillname(sk, lang);
|
||||
data = (order_data *)malloc(sizeof(order_data));
|
||||
locale_array[lindex]->study_orders[sk] = data;
|
||||
data->_keyword = kwd;
|
||||
data->_lindex = lindex;
|
||||
assert(data->_lindex >= 0);
|
||||
if (strchr(skname, ' ') != NULL) {
|
||||
const char *spc = strchr(skname, ' ');
|
||||
size_t len = strlen(skname);
|
||||
data->_str = malloc(len + 3);
|
||||
data->_str[0] = '\"';
|
||||
memcpy(data->_str + 1, skname, len);
|
||||
data->_str[len + 1] = '\"';
|
||||
data->_str[len + 2] = '\0';
|
||||
}
|
||||
else {
|
||||
data->_str = _strdup(skname);
|
||||
char *dst = mkdata(&data, len + (spc ? 3 : 0), kwd, lindex, spc ? 0 : skname);
|
||||
locale_array[lindex]->study_orders[sk] = data;
|
||||
if (spc) {
|
||||
dst[0] = '\"';
|
||||
memcpy(dst + 1, skname, len);
|
||||
dst[len + 1] = '\"';
|
||||
dst[len + 2] = '\0';
|
||||
}
|
||||
data->_refcount = 1;
|
||||
}
|
||||
|
@ -231,22 +239,13 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
|
|||
else if (kwd != NOKEYWORD && *sptr == 0) {
|
||||
data = locale_array[lindex]->short_orders[kwd];
|
||||
if (data == NULL) {
|
||||
data = (order_data *)malloc(sizeof(order_data));
|
||||
locale_array[lindex]->short_orders[kwd] = data;
|
||||
data->_keyword = kwd;
|
||||
data->_lindex = lindex;
|
||||
assert(data->_lindex >= 0);
|
||||
data->_str = NULL;
|
||||
mkdata(&data, 0, kwd, lindex, 0);
|
||||
data->_refcount = 1;
|
||||
}
|
||||
++data->_refcount;
|
||||
return data;
|
||||
}
|
||||
data = (order_data *)malloc(sizeof(order_data));
|
||||
data->_keyword = kwd;
|
||||
data->_lindex = lindex;
|
||||
assert(data->_lindex >= 0);
|
||||
data->_str = s ? _strdup(s) : NULL;
|
||||
mkdata(&data, s ? strlen(s) : 0, kwd, lindex, s);
|
||||
data->_refcount = 1;
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#include <config.h>
|
||||
#include "order.h"
|
||||
|
||||
#include <util/parser.h>
|
||||
#include <util/language.h>
|
||||
|
||||
#include <CuTest.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void test_create_order(CuTest *tc) {
|
||||
char cmd[32];
|
||||
order *ord;
|
||||
struct locale * lang = get_or_create_locale("en");
|
||||
|
||||
locale_setstring(lang, "keyword::move", "MOVE");
|
||||
ord = create_order(K_MOVE, lang, "NORTH");
|
||||
CuAssertPtrNotNull(tc, ord);
|
||||
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
||||
init_tokens(ord);
|
||||
CuAssertStrEquals(tc, "MOVE NORTH", get_command(ord, cmd, sizeof(cmd)));
|
||||
CuAssertStrEquals(tc, "MOVE", getstrtoken());
|
||||
CuAssertStrEquals(tc, "NORTH", getstrtoken());
|
||||
free_order(ord);
|
||||
}
|
||||
|
||||
static void test_parse_order(CuTest *tc) {
|
||||
char cmd[32];
|
||||
order *ord;
|
||||
struct locale * lang = get_or_create_locale("en");
|
||||
|
||||
locale_setstring(lang, "keyword::move", "MOVE");
|
||||
ord = parse_order("MOVE NORTH", lang);
|
||||
CuAssertPtrNotNull(tc, ord);
|
||||
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));
|
||||
init_tokens(ord);
|
||||
CuAssertStrEquals(tc, "MOVE NORTH", get_command(ord, cmd, sizeof(cmd)));
|
||||
CuAssertStrEquals(tc, "MOVE", getstrtoken());
|
||||
CuAssertStrEquals(tc, "NORTH", getstrtoken());
|
||||
free_order(ord);
|
||||
}
|
||||
|
||||
CuSuite *get_order_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
SUITE_ADD_TEST(suite, test_create_order);
|
||||
SUITE_ADD_TEST(suite, test_parse_order);
|
||||
return suite;
|
||||
}
|
203
src/report.c
203
src/report.c
|
@ -143,7 +143,8 @@ static void centre(FILE * F, const char *s, bool breaking)
|
|||
SP = SP->next;
|
||||
}
|
||||
freestrlist(T);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rpc(F, ' ', (REPORTWIDTH - strlen(s) + 1) / 2);
|
||||
fputs(s, F);
|
||||
putc('\n', F);
|
||||
|
@ -182,9 +183,11 @@ rparagraph(FILE * F, const char *str, ptrdiff_t indent, int hanging_indent,
|
|||
fputc(mark, F);
|
||||
fputc(' ', F);
|
||||
mark = 0;
|
||||
} else if (begin == str) {
|
||||
}
|
||||
else if (begin == str) {
|
||||
fwrite(spaces, sizeof(char), indent, F);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
fwrite(spaces, sizeof(char), indent + hanging_indent, F);
|
||||
}
|
||||
while (*end && end <= begin + length - indent) {
|
||||
|
@ -215,7 +218,8 @@ static size_t write_spell_modifier(spell * sp, int flag, const char * str, bool
|
|||
size_t bytes = 0;
|
||||
if (cont) {
|
||||
bytes = strlcpy(bufp, ", ", size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = strlcpy(bufp, " ", size);
|
||||
}
|
||||
bytes += strlcpy(bufp + bytes, str, size - bytes);
|
||||
|
@ -249,11 +253,14 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
}
|
||||
if (sp->sptyp & PRECOMBATSPELL) {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_precombat"), size);
|
||||
} else if (sp->sptyp & COMBATSPELL) {
|
||||
}
|
||||
else if (sp->sptyp & COMBATSPELL) {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_combat"), size);
|
||||
} else if (sp->sptyp & POSTCOMBATSPELL) {
|
||||
}
|
||||
else if (sp->sptyp & POSTCOMBATSPELL) {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_postcombat"), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_normal"), size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -286,7 +293,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = _snprintf(bufp, size, "%d %s", itemanz, LOC(lang, resourcename(rtype, itemanz != 1)));
|
||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||
WARN_STATIC_BUFFER();
|
||||
|
@ -336,7 +344,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
|
||||
if (sp->sptyp & ISCOMBATSPELL) {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_COMBATSPELL)), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_CAST)), size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -389,7 +398,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else if (cp == 's') {
|
||||
}
|
||||
else if (cp == 's') {
|
||||
targetp = targets + 2;
|
||||
locp = LOC(lang, targetp->vars);
|
||||
bytes = (int)_snprintf(bufp, size, " <%s>", locp);
|
||||
|
@ -401,7 +411,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else if (cp == 'r') {
|
||||
}
|
||||
else if (cp == 'r') {
|
||||
bytes = (int)strlcpy(bufp, " <x> <y>", size);
|
||||
if (*params == '+') {
|
||||
++params;
|
||||
|
@ -411,7 +422,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else if (cp == 'b') {
|
||||
}
|
||||
else if (cp == 'b') {
|
||||
targetp = targets + 3;
|
||||
locp = LOC(lang, targetp->vars);
|
||||
bytes = (int)_snprintf(bufp, size, " <%s>", locp);
|
||||
|
@ -423,7 +435,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else if (cp == 'k') {
|
||||
}
|
||||
else if (cp == 'k') {
|
||||
if (*params == 'c') {
|
||||
/* skip over a potential id */
|
||||
++params;
|
||||
|
@ -456,7 +469,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)_snprintf(bufp, size, " [<%s> ...]", locp);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes =
|
||||
(int)_snprintf(bufp, size, " %s", parameters[targetp->param]);
|
||||
}
|
||||
|
@ -469,13 +483,15 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
|||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
} else if (cp == 'i' || cp == 'c') {
|
||||
}
|
||||
else if (cp == 'i' || cp == 'c') {
|
||||
const char *cstr;
|
||||
assert(syntaxp);
|
||||
cstr = strchr(syntaxp, ':');
|
||||
if (!cstr) {
|
||||
locp = LOC(lang, mkname("spellpar", syntaxp));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
char substr[32];
|
||||
strncpy(substr, syntaxp, cstr - syntaxp);
|
||||
substr[cstr - syntaxp] = 0;
|
||||
|
@ -524,8 +540,7 @@ void sparagraph(strlist ** SP, const char *s, int indent, char mark)
|
|||
break;
|
||||
}
|
||||
i = j + 1;
|
||||
}
|
||||
while (s[j]);
|
||||
} while (s[j]);
|
||||
|
||||
for (j = 0; j != indent; j++)
|
||||
buf[j] = ' ';
|
||||
|
@ -568,7 +583,8 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
|||
if (owner) {
|
||||
if (owner->faction == viewer) {
|
||||
self = 2;
|
||||
} else { /* steht eine person der Partei auf dem Schiff? */
|
||||
}
|
||||
else { /* steht eine person der Partei auf dem Schiff? */
|
||||
unit *u = NULL;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->ship == sh) {
|
||||
|
@ -578,7 +594,8 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (typ == TYP_BUILDING) {
|
||||
}
|
||||
else if (typ == TYP_BUILDING) {
|
||||
building *b = (building *)obj;
|
||||
unit *owner;
|
||||
a = b->attribs;
|
||||
|
@ -586,7 +603,8 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
|||
if ((owner = building_owner(b)) != NULL) {
|
||||
if (owner->faction == viewer) {
|
||||
self = 2;
|
||||
} else { /* steht eine Person der Partei in der Burg? */
|
||||
}
|
||||
else { /* steht eine Person der Partei in der Burg? */
|
||||
unit *u = NULL;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->building == b) {
|
||||
|
@ -596,17 +614,20 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (typ == TYP_UNIT) {
|
||||
}
|
||||
else if (typ == TYP_UNIT) {
|
||||
unit *u = (unit *)obj;
|
||||
a = u->attribs;
|
||||
r = u->region;
|
||||
if (u->faction == viewer) {
|
||||
self = 2;
|
||||
}
|
||||
} else if (typ == TYP_REGION) {
|
||||
}
|
||||
else if (typ == TYP_REGION) {
|
||||
r = (region *)obj;
|
||||
a = r->attribs;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* fehler */
|
||||
}
|
||||
|
||||
|
@ -628,7 +649,8 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
|||
rparagraph(F, buf, indent, 2, 0);
|
||||
msg_release(msg);
|
||||
}
|
||||
} else if (a->type == &at_effect && self) {
|
||||
}
|
||||
else if (a->type == &at_effect && self) {
|
||||
effect_data *data = (effect_data *)a->data.v;
|
||||
if (data->value > 0) {
|
||||
sprintf(buf, "Auf der Einheit lieg%s %d Wirkung%s %s.",
|
||||
|
@ -686,16 +708,20 @@ nr_unit(FILE * F, const faction * f, const unit * u, int indent, int mode)
|
|||
|
||||
if (u->faction == f) {
|
||||
marker = '*';
|
||||
} else if ALLIED
|
||||
}
|
||||
else if ALLIED
|
||||
(u->faction, f) {
|
||||
marker = 'o';
|
||||
} else if (a_otherfaction && f != u->faction
|
||||
}
|
||||
else if (a_otherfaction && f != u->faction
|
||||
&& get_otherfaction(a_otherfaction) == f && !fval(u, UFL_ANON_FACTION)) {
|
||||
marker = '!';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (dh && !fval(u, UFL_ANON_FACTION)) {
|
||||
marker = '+';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
marker = '-';
|
||||
}
|
||||
}
|
||||
|
@ -813,7 +839,8 @@ static void prices(FILE * F, const region * r, const faction * f)
|
|||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"), size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else if (n == 1) {
|
||||
}
|
||||
else if (n == 1) {
|
||||
bytes = (int)strlcpy(bufp, " ", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
@ -823,7 +850,8 @@ static void prices(FILE * F, const region * r, const faction * f)
|
|||
bytes = (int)strlcpy(bufp, " ", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"), size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
@ -922,11 +950,14 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
|||
|
||||
if (sr->mode == see_travel) {
|
||||
bytes = _snprintf(bufp, size, " (%s)", LOC(f->locale, "see_travel"));
|
||||
} else if (sr->mode == see_neighbour) {
|
||||
}
|
||||
else if (sr->mode == see_neighbour) {
|
||||
bytes = _snprintf(bufp, size, " (%s)", LOC(f->locale, "see_neighbour"));
|
||||
} else if (sr->mode == see_lighthouse) {
|
||||
}
|
||||
else if (sr->mode == see_lighthouse) {
|
||||
bytes = _snprintf(bufp, size, " (%s)", LOC(f->locale, "see_lighthouse"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = 0;
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -954,12 +985,15 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
|||
if (fval(r, RF_MALLORN)) {
|
||||
if (trees == 1) {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_mallorntree"), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_mallorntree_p"), size);
|
||||
}
|
||||
} else if (trees == 1) {
|
||||
}
|
||||
else if (trees == 1) {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_tree"), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_tree_p"), size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -1004,7 +1038,8 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
|||
bytes =
|
||||
(int)strlcpy(bufp, LOC(f->locale, n == 1 ? "rc_orc" : "rc_orc_p"),
|
||||
size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, " ", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
@ -1080,7 +1115,8 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
|||
bytes = (int)strlcpy(bufp, (char *)a->data.v, size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int nrd = 0;
|
||||
|
||||
/* Nachbarregionen, die gesehen werden, ermitteln */
|
||||
|
@ -1104,7 +1140,8 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
|||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_nb_final"), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_nb_next"), size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -1119,7 +1156,8 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
|||
bytes = _snprintf(bufp, size, trailinto(r2, f->locale), regname);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, " ", size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
|
@ -1293,7 +1331,8 @@ static void statistics(FILE * F, const region * r, const faction * f)
|
|||
if (markets_module()) { /* hack */
|
||||
m =
|
||||
msg_message("nr_stat_salary_new", "max", wage(r, NULL, NULL, turn + 1));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m = msg_message("nr_stat_salary", "max", wage(r, f, f->race, turn + 1));
|
||||
}
|
||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||
|
@ -1310,7 +1349,8 @@ static void statistics(FILE * F, const region * r, const faction * f)
|
|||
if (!markets_module()) {
|
||||
if (buildingtype_exists(r, bt_find("caravan"), true)) {
|
||||
m = msg_message("nr_stat_luxuries", "max", (p * 2) / TRADE_FRACTION);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m = msg_message("nr_stat_luxuries", "max", p / TRADE_FRACTION);
|
||||
}
|
||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||
|
@ -1379,7 +1419,8 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
|||
if (u->ship != NULL) {
|
||||
if (counter == 1) {
|
||||
bytes = (int)strlcpy(bufp, "Die ", size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, "die ", size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||
|
@ -1387,7 +1428,8 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
|||
break;
|
||||
}
|
||||
bytes = (int)strlcpy(bufp, shipname(u->ship), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, unitname(u), size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||
|
@ -1401,7 +1443,8 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
|||
WARN_STATIC_BUFFER();
|
||||
break;
|
||||
}
|
||||
} else if (counter + 1 == maxtravel) {
|
||||
}
|
||||
else if (counter + 1 == maxtravel) {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "list_and"), size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||
WARN_STATIC_BUFFER();
|
||||
|
@ -1521,7 +1564,8 @@ report_template(const char *filename, report_context * ctx, const char *charset)
|
|||
if (pl && pl->id != 0) {
|
||||
sprintf(buf, "%s %d,%d,%d ; %s", LOC(f->locale,
|
||||
parameters[P_REGION]), nx, ny, pl->id, rname(r, f->locale));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
sprintf(buf, "%s %d,%d ; %s", LOC(f->locale, parameters[P_REGION]),
|
||||
nx, ny, rname(r, f->locale));
|
||||
}
|
||||
|
@ -1554,10 +1598,12 @@ report_template(const char *filename, report_context * ctx, const char *charset)
|
|||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
} else if (u->ship) {
|
||||
}
|
||||
else if (u->ship) {
|
||||
if (ship_owner(u->ship) == u) {
|
||||
bytes = (int)strlcpy(bufp, ",S", size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, ",s", size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -1636,7 +1682,8 @@ show_allies(const faction * f, const ally * allies, char *buf, size_t size)
|
|||
if (dh) {
|
||||
if (i == allierte) {
|
||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "list_and"), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, ", ", size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -1654,7 +1701,8 @@ show_allies(const faction * f, const ally * allies, char *buf, size_t size)
|
|||
bytes = (int)strlcpy(bufp, locale_string(f->locale, parameters[P_ANY]), size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (h = 1; h < HELP_ALL; h *= 2) {
|
||||
int p = MAXPARAMS;
|
||||
if ((mode & h) == h) {
|
||||
|
@ -1685,7 +1733,7 @@ show_allies(const faction * f, const ally * allies, char *buf, size_t size)
|
|||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
}
|
||||
bytes = (int)strlcpy(bufp, parameters[p], size);
|
||||
bytes = (int)strlcpy(bufp, locale_string(f->locale, parameters[p]), size);
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
WARN_STATIC_BUFFER();
|
||||
hh = 1;
|
||||
|
@ -1710,11 +1758,7 @@ static void allies(FILE * F, const faction * f)
|
|||
if (f->allies) {
|
||||
int bytes;
|
||||
size_t size = sizeof(buf);
|
||||
if (!f->allies->next) {
|
||||
bytes = _snprintf(buf, size, "%s ", LOC(f->locale, "faction_help_one"));
|
||||
} else {
|
||||
bytes = _snprintf(buf, size, "%s ", LOC(f->locale, "faction_help_many"));
|
||||
}
|
||||
bytes = _snprintf(buf, size, "%s ", LOC(f->locale, "faction_help"));
|
||||
size -= bytes;
|
||||
show_allies(f, f->allies, buf + bytes, size);
|
||||
rparagraph(F, buf, 0, 0, 0);
|
||||
|
@ -1725,11 +1769,7 @@ static void allies(FILE * F, const faction * f)
|
|||
if (g->allies) {
|
||||
int bytes;
|
||||
size_t size = sizeof(buf);
|
||||
if (!g->allies->next) {
|
||||
bytes = _snprintf(buf, size, "%s %s ", g->name, LOC(f->locale, "group_help_one"));
|
||||
} else {
|
||||
bytes = _snprintf(buf, size, "%s %s ", g->name, LOC(f->locale, "group_help_many"));
|
||||
}
|
||||
bytes = _snprintf(buf, size, "%s %s ", g->name, LOC(f->locale, "group_help"));
|
||||
size -= bytes;
|
||||
show_allies(f, g->allies, buf + bytes, size);
|
||||
rparagraph(F, buf, 0, 0, 0);
|
||||
|
@ -1765,7 +1805,8 @@ static void guards(FILE * F, const region * r, const faction * see)
|
|||
|
||||
if (f != see && fval(u, UFL_ANON_FACTION)) {
|
||||
tarned = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (i = 0; i != nextguard; ++i)
|
||||
if (guardians[i] == f)
|
||||
break;
|
||||
|
@ -1790,7 +1831,8 @@ static void guards(FILE * F, const region * r, const faction * see)
|
|||
if (i != 0) {
|
||||
if (i == nextguard - (tarned ? 0 : 1)) {
|
||||
bytes = (int)strlcpy(bufp, LOC(see->locale, "list_and"), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, ", ", size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -1798,7 +1840,8 @@ static void guards(FILE * F, const region * r, const faction * see)
|
|||
}
|
||||
if (i < nextguard) {
|
||||
bytes = (int)strlcpy(bufp, factionname(guardians[i]), size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes = (int)strlcpy(bufp, "unbekannten Einheiten", size);
|
||||
}
|
||||
if (wrptr(&bufp, &size, bytes) != 0)
|
||||
|
@ -1873,7 +1916,8 @@ nr_ship(FILE * F, const seen_region * sr, const ship * sh, const faction * f,
|
|||
|
||||
bytes = _snprintf(bufp, size, "%s, %s, (%d/%d)", shipname(sh),
|
||||
LOC(f->locale, sh->type->_name), n, shipcapacity(sh) / 100);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bytes =
|
||||
_snprintf(bufp, size, "%s, %s", shipname(sh), LOC(f->locale,
|
||||
sh->type->_name));
|
||||
|
@ -2245,7 +2289,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
if (thisseason == 0) {
|
||||
centre(F, LOC(f->locale, "nr_insectwinter"), true);
|
||||
rnl(F);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (nextseason == 0) {
|
||||
centre(F, LOC(f->locale, "nr_insectfall"), true);
|
||||
rnl(F);
|
||||
|
@ -2374,7 +2419,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
if (herb && lux) {
|
||||
m = msg_message("nr_market_info_p", "p1 p2",
|
||||
lux ? lux->rtype : 0, herb ? herb->rtype : 0);
|
||||
} else if (lux || herb) {
|
||||
}
|
||||
else if (lux || herb) {
|
||||
m = msg_message("nr_market_info_s", "p1",
|
||||
lux ? lux->rtype : herb->rtype);
|
||||
}
|
||||
|
@ -2383,7 +2429,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
nr_paragraph(F, m, f);
|
||||
}
|
||||
/* */
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!fval(r->terrain, SEA_REGION) && rpeasants(r) / TRADE_FRACTION > 0) {
|
||||
rnl(F);
|
||||
prices(F, r, f);
|
||||
|
@ -2391,15 +2438,18 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
}
|
||||
guards(F, r, f);
|
||||
durchreisende(F, r, f);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (sr->mode == see_far) {
|
||||
describe(F, sr, f);
|
||||
guards(F, r, f);
|
||||
durchreisende(F, r, f);
|
||||
} else if (sr->mode == see_lighthouse) {
|
||||
}
|
||||
else if (sr->mode == see_lighthouse) {
|
||||
describe(F, sr, f);
|
||||
durchreisende(F, r, f);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
describe(F, sr, f);
|
||||
durchreisende(F, r, f);
|
||||
}
|
||||
|
@ -2467,7 +2517,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
if (!anyunits) {
|
||||
rnl(F);
|
||||
rparagraph(F, LOC(f->locale, "nr_youaredead"), 0, 2, 0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
list_address(F, f, ctx->addresses);
|
||||
}
|
||||
}
|
||||
|
@ -2544,7 +2595,8 @@ static void add_find(faction * f, unit * u, faction * f2)
|
|||
if (!*fp) {
|
||||
fs = *fp = calloc(sizeof(struct fsee), 1);
|
||||
fs->f = f;
|
||||
} else
|
||||
}
|
||||
else
|
||||
fs = *fp;
|
||||
sp = &fs->see;
|
||||
while (*sp && (*sp)->seen != f2)
|
||||
|
@ -2553,7 +2605,8 @@ static void add_find(faction * f, unit * u, faction * f2)
|
|||
ss = *sp = calloc(sizeof(struct see), 1);
|
||||
ss->proof = u;
|
||||
ss->seen = f2;
|
||||
} else
|
||||
}
|
||||
else
|
||||
ss = *sp;
|
||||
ss->proof = u;
|
||||
}
|
||||
|
|
|
@ -9,36 +9,6 @@
|
|||
CuSuite *get_##name##_suite(void); \
|
||||
CuSuiteAddSuite(suite, get_##name##_suite())
|
||||
|
||||
CuSuite *get_tests_suite(void);
|
||||
CuSuite *get_callback_suite(void);
|
||||
CuSuite *get_jsonconf_suite(void);
|
||||
CuSuite *get_json_suite(void);
|
||||
CuSuite *get_economy_suite(void);
|
||||
CuSuite *get_laws_suite(void);
|
||||
CuSuite *get_market_suite(void);
|
||||
CuSuite *get_battle_suite(void);
|
||||
CuSuite *get_building_suite(void);
|
||||
CuSuite *get_curse_suite(void);
|
||||
CuSuite *get_equipment_suite(void);
|
||||
CuSuite *get_item_suite(void);
|
||||
CuSuite *get_magic_suite(void);
|
||||
CuSuite *get_move_suite(void);
|
||||
CuSuite *get_pool_suite(void);
|
||||
CuSuite *get_build_suite(void);
|
||||
CuSuite *get_reports_suite(void);
|
||||
CuSuite *get_ship_suite(void);
|
||||
CuSuite *get_spellbook_suite(void);
|
||||
CuSuite *get_spell_suite(void);
|
||||
CuSuite *get_base36_suite(void);
|
||||
CuSuite *get_config_suite(void);
|
||||
CuSuite *get_bsdstring_suite(void);
|
||||
CuSuite *get_functions_suite(void);
|
||||
CuSuite *get_umlaut_suite(void);
|
||||
CuSuite *get_ally_suite(void);
|
||||
CuSuite *get_direction_suite(void);
|
||||
CuSuite *get_skill_suite(void);
|
||||
CuSuite *get_keyword_suite(void);
|
||||
|
||||
int RunAllTests(void)
|
||||
{
|
||||
CuString *output = CuStringNew();
|
||||
|
@ -56,6 +26,7 @@ int RunAllTests(void)
|
|||
ADD_TESTS(suite, direction);
|
||||
ADD_TESTS(suite, skill);
|
||||
ADD_TESTS(suite, keyword);
|
||||
ADD_TESTS(suite, order);
|
||||
/* util */
|
||||
ADD_TESTS(suite, config);
|
||||
ADD_TESTS(suite, base36);
|
||||
|
|
Loading…
Reference in New Issue