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>
|
<text locale="en">none</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="faction_help_one">
|
<string name="faction_help">
|
||||||
<text locale="de">Wir helfen der Partei</text>
|
<text locale="de">Wir helfen</text>
|
||||||
<text locale="en">We are helping the faction</text>
|
<text locale="en">We are helping</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="faction_help_many">
|
<string name="group_help">
|
||||||
<text locale="de">Wir helfen den Parteien</text>
|
<text locale="de">hilft</text>
|
||||||
<text locale="en">We are helping the factions</text>
|
<text locale="en">is helping</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>
|
</string>
|
||||||
|
|
||||||
<string name="has_moved_one">
|
<string name="has_moved_one">
|
||||||
<text locale="de">hat die Region durchquert</text>
|
<text locale="de">hat die Region durchquert.</text>
|
||||||
<text locale="en">has traveled through the region</text>
|
<text locale="en">passed through the region.</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="has_moved_many">
|
<string name="has_moved_many">
|
||||||
<text locale="de">haben die Region durchquert</text>
|
<text locale="de">haben die Region durchquert.</text>
|
||||||
<text locale="en">have traveled through the region</text>
|
<text locale="en">passed through the region.</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="see_travel">
|
<string name="see_travel">
|
||||||
|
|
|
@ -804,51 +804,49 @@
|
||||||
<arg name="max" type="int"/>
|
<arg name="max" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Unterhaltung: max. $int($max) Silber"</text>
|
<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>
|
||||||
<message name="nr_stat_morale" section="nr">
|
<message name="nr_stat_morale" section="nr">
|
||||||
<type>
|
<type>
|
||||||
<arg name="morale" type="int"/>
|
<arg name="morale" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Moral der Bauern: $int($morale)"</text>
|
<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>
|
||||||
<message name="nr_stat_luxuries" section="nr">
|
<message name="nr_stat_luxuries" section="nr">
|
||||||
<type>
|
<type>
|
||||||
<arg name="max" type="int"/>
|
<arg name="max" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Luxusgüter zum angegebenen Preis: $int($max)"</text>
|
<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>
|
||||||
<message name="nr_stat_salary" section="nr">
|
<message name="nr_stat_salary" section="nr">
|
||||||
<type>
|
<type>
|
||||||
<arg name="max" type="int"/>
|
<arg name="max" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Lohn für Arbeit: $int($max) Silber"</text>
|
<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>
|
||||||
<message name="nr_stat_salary_new" section="nr">
|
<message name="nr_stat_salary_new" section="nr">
|
||||||
<type>
|
<type>
|
||||||
<arg name="max" type="int"/>
|
<arg name="max" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Bauerneinnahmen: $int($max) Silber"</text>
|
<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>
|
||||||
<message name="nr_stat_people" section="nr">
|
<message name="nr_stat_people" section="nr">
|
||||||
<type>
|
<type>
|
||||||
<arg name="max" type="int"/>
|
<arg name="max" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Personen: $int($max)"</text>
|
<text locale="de">"Personen: $int($max)"</text>
|
||||||
<text locale="en">"People: $int($max)"</text>
|
<text locale="en">"people: $int($max)"</text>
|
||||||
<text locale="fr">"People: $int($max)"</text>
|
|
||||||
</message>
|
</message>
|
||||||
<message name="nr_stat_recruits" section="nr">
|
<message name="nr_stat_recruits" section="nr">
|
||||||
<type>
|
<type>
|
||||||
<arg name="max" type="int"/>
|
<arg name="max" type="int"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Rekruten: max. $int($max) Bauern"</text>
|
<text locale="de">"Rekruten: max. $int($max) Bauern"</text>
|
||||||
<text locale="en">"Recruits: $int($max) peasants"</text>
|
<text locale="en">"recruits: $int($max) peasants"</text>
|
||||||
<text locale="fr">"Recruits: $int($max) peasants"</text>
|
|
||||||
</message>
|
</message>
|
||||||
<message name="nr_score" section="nr">
|
<message name="nr_score" section="nr">
|
||||||
<type>
|
<type>
|
||||||
|
@ -857,7 +855,6 @@
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"Deine Partei hat $int($score) Punkte. Der Durchschnitt für Parteien ähnlichen Alters ist $int($average) Punkte."</text>
|
<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="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>
|
||||||
<message name="nr_header_date" section="nr">
|
<message name="nr_header_date" section="nr">
|
||||||
<type>
|
<type>
|
||||||
|
|
|
@ -14,6 +14,7 @@ equipment.test.c
|
||||||
curse.test.c
|
curse.test.c
|
||||||
item.test.c
|
item.test.c
|
||||||
move.test.c
|
move.test.c
|
||||||
|
order.test.c
|
||||||
pool.test.c
|
pool.test.c
|
||||||
reports.test.c
|
reports.test.c
|
||||||
spellbook.test.c
|
spellbook.test.c
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
+-------------------+
|
+-------------------+
|
||||||
| | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
| | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
| Eressea PBEM host | Enno Rehling <enno@eressea.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;
|
static int nlocales = 0;
|
||||||
|
|
||||||
typedef struct order_data {
|
typedef struct order_data {
|
||||||
char *_str;
|
const char *_str;
|
||||||
# ifdef LOMEM
|
# ifdef LOMEM
|
||||||
int _refcount:20;
|
int _refcount:20;
|
||||||
int _lindex:4;
|
int _lindex:4;
|
||||||
|
@ -59,8 +59,6 @@ static void release_data(order_data * data)
|
||||||
{
|
{
|
||||||
if (data) {
|
if (data) {
|
||||||
if (--data->_refcount == 0) {
|
if (--data->_refcount == 0) {
|
||||||
if (data->_str)
|
|
||||||
free(data->_str);
|
|
||||||
free(data);
|
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)
|
static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
|
||||||
{
|
{
|
||||||
const char *s = sptr;
|
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];
|
data = locale_array[lindex]->study_orders[sk];
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
const char *skname = skillname(sk, lang);
|
const char *skname = skillname(sk, lang);
|
||||||
data = (order_data *)malloc(sizeof(order_data));
|
const char *spc = strchr(skname, ' ');
|
||||||
locale_array[lindex]->study_orders[sk] = data;
|
|
||||||
data->_keyword = kwd;
|
|
||||||
data->_lindex = lindex;
|
|
||||||
assert(data->_lindex >= 0);
|
|
||||||
if (strchr(skname, ' ') != NULL) {
|
|
||||||
size_t len = strlen(skname);
|
size_t len = strlen(skname);
|
||||||
data->_str = malloc(len + 3);
|
char *dst = mkdata(&data, len + (spc ? 3 : 0), kwd, lindex, spc ? 0 : skname);
|
||||||
data->_str[0] = '\"';
|
locale_array[lindex]->study_orders[sk] = data;
|
||||||
memcpy(data->_str + 1, skname, len);
|
if (spc) {
|
||||||
data->_str[len + 1] = '\"';
|
dst[0] = '\"';
|
||||||
data->_str[len + 2] = '\0';
|
memcpy(dst + 1, skname, len);
|
||||||
}
|
dst[len + 1] = '\"';
|
||||||
else {
|
dst[len + 2] = '\0';
|
||||||
data->_str = _strdup(skname);
|
|
||||||
}
|
}
|
||||||
data->_refcount = 1;
|
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) {
|
else if (kwd != NOKEYWORD && *sptr == 0) {
|
||||||
data = locale_array[lindex]->short_orders[kwd];
|
data = locale_array[lindex]->short_orders[kwd];
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
data = (order_data *)malloc(sizeof(order_data));
|
mkdata(&data, 0, kwd, lindex, 0);
|
||||||
locale_array[lindex]->short_orders[kwd] = data;
|
|
||||||
data->_keyword = kwd;
|
|
||||||
data->_lindex = lindex;
|
|
||||||
assert(data->_lindex >= 0);
|
|
||||||
data->_str = NULL;
|
|
||||||
data->_refcount = 1;
|
data->_refcount = 1;
|
||||||
}
|
}
|
||||||
++data->_refcount;
|
++data->_refcount;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
data = (order_data *)malloc(sizeof(order_data));
|
mkdata(&data, s ? strlen(s) : 0, kwd, lindex, s);
|
||||||
data->_keyword = kwd;
|
|
||||||
data->_lindex = lindex;
|
|
||||||
assert(data->_lindex >= 0);
|
|
||||||
data->_str = s ? _strdup(s) : NULL;
|
|
||||||
data->_refcount = 1;
|
data->_refcount = 1;
|
||||||
return data;
|
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;
|
||||||
|
}
|
285
src/report.c
285
src/report.c
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
Katja Zedel <katze@felidae.kn-bremen.de
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -143,7 +143,8 @@ static void centre(FILE * F, const char *s, bool breaking)
|
||||||
SP = SP->next;
|
SP = SP->next;
|
||||||
}
|
}
|
||||||
freestrlist(T);
|
freestrlist(T);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
rpc(F, ' ', (REPORTWIDTH - strlen(s) + 1) / 2);
|
rpc(F, ' ', (REPORTWIDTH - strlen(s) + 1) / 2);
|
||||||
fputs(s, F);
|
fputs(s, F);
|
||||||
putc('\n', F);
|
putc('\n', F);
|
||||||
|
@ -152,7 +153,7 @@ static void centre(FILE * F, const char *s, bool breaking)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rparagraph(FILE * F, const char *str, ptrdiff_t indent, int hanging_indent,
|
rparagraph(FILE * F, const char *str, ptrdiff_t indent, int hanging_indent,
|
||||||
char mark)
|
char mark)
|
||||||
{
|
{
|
||||||
static const char *spaces = " ";
|
static const char *spaces = " ";
|
||||||
size_t length = REPORTWIDTH;
|
size_t length = REPORTWIDTH;
|
||||||
|
@ -182,9 +183,11 @@ rparagraph(FILE * F, const char *str, ptrdiff_t indent, int hanging_indent,
|
||||||
fputc(mark, F);
|
fputc(mark, F);
|
||||||
fputc(' ', F);
|
fputc(' ', F);
|
||||||
mark = 0;
|
mark = 0;
|
||||||
} else if (begin == str) {
|
}
|
||||||
|
else if (begin == str) {
|
||||||
fwrite(spaces, sizeof(char), indent, F);
|
fwrite(spaces, sizeof(char), indent, F);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
fwrite(spaces, sizeof(char), indent + hanging_indent, F);
|
fwrite(spaces, sizeof(char), indent + hanging_indent, F);
|
||||||
}
|
}
|
||||||
while (*end && end <= begin + length - indent) {
|
while (*end && end <= begin + length - indent) {
|
||||||
|
@ -215,10 +218,11 @@ static size_t write_spell_modifier(spell * sp, int flag, const char * str, bool
|
||||||
size_t bytes = 0;
|
size_t bytes = 0;
|
||||||
if (cont) {
|
if (cont) {
|
||||||
bytes = strlcpy(bufp, ", ", size);
|
bytes = strlcpy(bufp, ", ", size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = strlcpy(bufp, " ", size);
|
bytes = strlcpy(bufp, " ", size);
|
||||||
}
|
}
|
||||||
bytes += strlcpy(bufp+bytes, str, size-bytes);
|
bytes += strlcpy(bufp + bytes, str, size - bytes);
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -249,11 +253,14 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
||||||
}
|
}
|
||||||
if (sp->sptyp & PRECOMBATSPELL) {
|
if (sp->sptyp & PRECOMBATSPELL) {
|
||||||
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_precombat"), size);
|
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);
|
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);
|
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_postcombat"), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_normal"), size);
|
bytes = (int)strlcpy(bufp, LOC(lang, "sptype_normal"), size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = _snprintf(bufp, size, "%d %s", itemanz, LOC(lang, resourcename(rtype, itemanz != 1)));
|
bytes = _snprintf(bufp, size, "%d %s", itemanz, LOC(lang, resourcename(rtype, itemanz != 1)));
|
||||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
@ -304,24 +312,24 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
|
||||||
startp = bufp;
|
startp = bufp;
|
||||||
bytes = (int)write_spell_modifier(sp, FARCASTING, LOC(lang, "smod_far"), startp!=bufp, bufp, size);
|
bytes = (int)write_spell_modifier(sp, FARCASTING, LOC(lang, "smod_far"), startp != bufp, bufp, size);
|
||||||
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
bytes = (int)write_spell_modifier(sp, OCEANCASTABLE, LOC(lang, "smod_sea"), startp!=bufp, bufp, size);
|
bytes = (int)write_spell_modifier(sp, OCEANCASTABLE, LOC(lang, "smod_sea"), startp != bufp, bufp, size);
|
||||||
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
bytes = (int)write_spell_modifier(sp, ONSHIPCAST, LOC(lang, "smod_ship"), startp!=bufp, bufp, size);
|
bytes = (int)write_spell_modifier(sp, ONSHIPCAST, LOC(lang, "smod_ship"), startp != bufp, bufp, size);
|
||||||
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_nofamiliar"), startp!=bufp, bufp, size);
|
bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_nofamiliar"), startp != bufp, bufp, size);
|
||||||
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
if (startp==bufp) {
|
if (startp == bufp) {
|
||||||
bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_none"), startp!=bufp, bufp, size);
|
bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_none"), startp != bufp, bufp, size);
|
||||||
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
|
@ -336,7 +344,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
||||||
|
|
||||||
if (sp->sptyp & ISCOMBATSPELL) {
|
if (sp->sptyp & ISCOMBATSPELL) {
|
||||||
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_COMBATSPELL)), size);
|
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_COMBATSPELL)), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_CAST)), size);
|
bytes = (int)strlcpy(bufp, LOC(lang, keyword(K_CAST)), size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
|
@ -365,11 +374,11 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
||||||
const char *vars;
|
const char *vars;
|
||||||
} starget;
|
} starget;
|
||||||
starget targets[] = {
|
starget targets[] = {
|
||||||
{P_REGION, REGIONSPELL, NULL},
|
{ P_REGION, REGIONSPELL, NULL },
|
||||||
{P_UNIT, UNITSPELL, "par_unit"},
|
{ P_UNIT, UNITSPELL, "par_unit" },
|
||||||
{P_SHIP, SHIPSPELL, "par_ship"},
|
{ P_SHIP, SHIPSPELL, "par_ship" },
|
||||||
{P_BUILDING, BUILDINGSPELL, "par_building"},
|
{ P_BUILDING, BUILDINGSPELL, "par_building" },
|
||||||
{0, 0, NULL}
|
{ 0, 0, NULL }
|
||||||
};
|
};
|
||||||
starget *targetp;
|
starget *targetp;
|
||||||
char cp = *params++;
|
char cp = *params++;
|
||||||
|
@ -389,7 +398,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else if (cp == 's') {
|
}
|
||||||
|
else if (cp == 's') {
|
||||||
targetp = targets + 2;
|
targetp = targets + 2;
|
||||||
locp = LOC(lang, targetp->vars);
|
locp = LOC(lang, targetp->vars);
|
||||||
bytes = (int)_snprintf(bufp, size, " <%s>", locp);
|
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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else if (cp == 'r') {
|
}
|
||||||
|
else if (cp == 'r') {
|
||||||
bytes = (int)strlcpy(bufp, " <x> <y>", size);
|
bytes = (int)strlcpy(bufp, " <x> <y>", size);
|
||||||
if (*params == '+') {
|
if (*params == '+') {
|
||||||
++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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else if (cp == 'b') {
|
}
|
||||||
|
else if (cp == 'b') {
|
||||||
targetp = targets + 3;
|
targetp = targets + 3;
|
||||||
locp = LOC(lang, targetp->vars);
|
locp = LOC(lang, targetp->vars);
|
||||||
bytes = (int)_snprintf(bufp, size, " <%s>", locp);
|
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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else if (cp == 'k') {
|
}
|
||||||
|
else if (cp == 'k') {
|
||||||
if (*params == 'c') {
|
if (*params == 'c') {
|
||||||
/* skip over a potential id */
|
/* skip over a potential id */
|
||||||
++params;
|
++params;
|
||||||
|
@ -456,7 +469,8 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
bytes = (int)_snprintf(bufp, size, " [<%s> ...]", locp);
|
bytes = (int)_snprintf(bufp, size, " [<%s> ...]", locp);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes =
|
bytes =
|
||||||
(int)_snprintf(bufp, size, " %s", parameters[targetp->param]);
|
(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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
} else if (cp == 'i' || cp == 'c') {
|
}
|
||||||
|
else if (cp == 'i' || cp == 'c') {
|
||||||
const char *cstr;
|
const char *cstr;
|
||||||
assert(syntaxp);
|
assert(syntaxp);
|
||||||
cstr = strchr(syntaxp, ':');
|
cstr = strchr(syntaxp, ':');
|
||||||
if (!cstr) {
|
if (!cstr) {
|
||||||
locp = LOC(lang, mkname("spellpar", syntaxp));
|
locp = LOC(lang, mkname("spellpar", syntaxp));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
char substr[32];
|
char substr[32];
|
||||||
strncpy(substr, syntaxp, cstr - syntaxp);
|
strncpy(substr, syntaxp, cstr - syntaxp);
|
||||||
substr[cstr - syntaxp] = 0;
|
substr[cstr - syntaxp] = 0;
|
||||||
|
@ -524,8 +540,7 @@ void sparagraph(strlist ** SP, const char *s, int indent, char mark)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i = j + 1;
|
i = j + 1;
|
||||||
}
|
} while (s[j]);
|
||||||
while (s[j]);
|
|
||||||
|
|
||||||
for (j = 0; j != indent; j++)
|
for (j = 0; j != indent; j++)
|
||||||
buf[j] = ' ';
|
buf[j] = ' ';
|
||||||
|
@ -549,7 +564,7 @@ void sparagraph(strlist ** SP, const char *s, int indent, char mark)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
||||||
int indent)
|
int indent)
|
||||||
{
|
{
|
||||||
attrib *a = NULL;
|
attrib *a = NULL;
|
||||||
int self = 0;
|
int self = 0;
|
||||||
|
@ -561,14 +576,15 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
||||||
* Spezialfälle (besonderes Talent, verursachender Magier usw. werde
|
* Spezialfälle (besonderes Talent, verursachender Magier usw. werde
|
||||||
* bei jedem curse gesondert behandelt. */
|
* bei jedem curse gesondert behandelt. */
|
||||||
if (typ == TYP_SHIP) {
|
if (typ == TYP_SHIP) {
|
||||||
ship *sh = (ship *) obj;
|
ship *sh = (ship *)obj;
|
||||||
unit *owner = ship_owner(sh);
|
unit *owner = ship_owner(sh);
|
||||||
a = sh->attribs;
|
a = sh->attribs;
|
||||||
r = sh->region;
|
r = sh->region;
|
||||||
if (owner) {
|
if (owner) {
|
||||||
if (owner->faction == viewer) {
|
if (owner->faction == viewer) {
|
||||||
self = 2;
|
self = 2;
|
||||||
} else { /* steht eine person der Partei auf dem Schiff? */
|
}
|
||||||
|
else { /* steht eine person der Partei auf dem Schiff? */
|
||||||
unit *u = NULL;
|
unit *u = NULL;
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
if (u->ship == sh) {
|
if (u->ship == sh) {
|
||||||
|
@ -578,15 +594,17 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (typ == TYP_BUILDING) {
|
}
|
||||||
building *b = (building *) obj;
|
else if (typ == TYP_BUILDING) {
|
||||||
|
building *b = (building *)obj;
|
||||||
unit *owner;
|
unit *owner;
|
||||||
a = b->attribs;
|
a = b->attribs;
|
||||||
r = b->region;
|
r = b->region;
|
||||||
if ((owner = building_owner(b)) != NULL) {
|
if ((owner = building_owner(b)) != NULL) {
|
||||||
if (owner->faction == viewer) {
|
if (owner->faction == viewer) {
|
||||||
self = 2;
|
self = 2;
|
||||||
} else { /* steht eine Person der Partei in der Burg? */
|
}
|
||||||
|
else { /* steht eine Person der Partei in der Burg? */
|
||||||
unit *u = NULL;
|
unit *u = NULL;
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
if (u->building == b) {
|
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) {
|
}
|
||||||
unit *u = (unit *) obj;
|
else if (typ == TYP_UNIT) {
|
||||||
|
unit *u = (unit *)obj;
|
||||||
a = u->attribs;
|
a = u->attribs;
|
||||||
r = u->region;
|
r = u->region;
|
||||||
if (u->faction == viewer) {
|
if (u->faction == viewer) {
|
||||||
self = 2;
|
self = 2;
|
||||||
}
|
}
|
||||||
} else if (typ == TYP_REGION) {
|
}
|
||||||
r = (region *) obj;
|
else if (typ == TYP_REGION) {
|
||||||
|
r = (region *)obj;
|
||||||
a = r->attribs;
|
a = r->attribs;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* fehler */
|
/* fehler */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,7 +635,7 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
if (fval(a->type, ATF_CURSE)) {
|
if (fval(a->type, ATF_CURSE)) {
|
||||||
curse *c = (curse *) a->data.v;
|
curse *c = (curse *)a->data.v;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
if (c->type->cansee) {
|
if (c->type->cansee) {
|
||||||
|
@ -628,8 +649,9 @@ nr_curses(FILE * F, const faction * viewer, const void *obj, objtype_t typ,
|
||||||
rparagraph(F, buf, indent, 2, 0);
|
rparagraph(F, buf, indent, 2, 0);
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
}
|
}
|
||||||
} else if (a->type == &at_effect && self) {
|
}
|
||||||
effect_data *data = (effect_data *) a->data.v;
|
else if (a->type == &at_effect && self) {
|
||||||
|
effect_data *data = (effect_data *)a->data.v;
|
||||||
if (data->value > 0) {
|
if (data->value > 0) {
|
||||||
sprintf(buf, "Auf der Einheit lieg%s %d Wirkung%s %s.",
|
sprintf(buf, "Auf der Einheit lieg%s %d Wirkung%s %s.",
|
||||||
(data->value == 1 ? "t" : "en"),
|
(data->value == 1 ? "t" : "en"),
|
||||||
|
@ -650,7 +672,7 @@ static void rps_nowrap(FILE * F, const char *s)
|
||||||
|
|
||||||
if (!x) return;
|
if (!x) return;
|
||||||
|
|
||||||
while (*x++ == ' ') ;
|
while (*x++ == ' ');
|
||||||
indent = x - s - 1;
|
indent = x - s - 1;
|
||||||
if (*(x - 1) && indent && *x == ' ')
|
if (*(x - 1) && indent && *x == ' ')
|
||||||
indent += 2;
|
indent += 2;
|
||||||
|
@ -671,7 +693,7 @@ nr_unit(FILE * F, const faction * f, const unit * u, int indent, int mode)
|
||||||
attrib *a_otherfaction;
|
attrib *a_otherfaction;
|
||||||
char marker;
|
char marker;
|
||||||
int dh;
|
int dh;
|
||||||
bool isbattle = (bool) (mode == see_battle);
|
bool isbattle = (bool)(mode == see_battle);
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
|
|
||||||
if (fval(u_race(u), RCF_INVISIBLE))
|
if (fval(u_race(u), RCF_INVISIBLE))
|
||||||
|
@ -686,16 +708,20 @@ nr_unit(FILE * F, const faction * f, const unit * u, int indent, int mode)
|
||||||
|
|
||||||
if (u->faction == f) {
|
if (u->faction == f) {
|
||||||
marker = '*';
|
marker = '*';
|
||||||
} else if ALLIED
|
}
|
||||||
|
else if ALLIED
|
||||||
(u->faction, f) {
|
(u->faction, f) {
|
||||||
marker = 'o';
|
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)) {
|
&& get_otherfaction(a_otherfaction) == f && !fval(u, UFL_ANON_FACTION)) {
|
||||||
marker = '!';
|
marker = '!';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (dh && !fval(u, UFL_ANON_FACTION)) {
|
if (dh && !fval(u, UFL_ANON_FACTION)) {
|
||||||
marker = '+';
|
marker = '+';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
marker = '-';
|
marker = '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -708,7 +734,7 @@ nr_unit(FILE * F, const faction * f, const unit * u, int indent, int mode)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent,
|
rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent,
|
||||||
bool categorized)
|
bool categorized)
|
||||||
{
|
{
|
||||||
nrsection *section;
|
nrsection *section;
|
||||||
if (!msgs)
|
if (!msgs)
|
||||||
|
@ -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);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else if (n == 1) {
|
}
|
||||||
|
else if (n == 1) {
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
@ -823,7 +850,8 @@ static void prices(FILE * F, const region * r, const faction * f)
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
@ -922,11 +950,14 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
|
|
||||||
if (sr->mode == see_travel) {
|
if (sr->mode == see_travel) {
|
||||||
bytes = _snprintf(bufp, size, " (%s)", LOC(f->locale, "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"));
|
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"));
|
bytes = _snprintf(bufp, size, " (%s)", LOC(f->locale, "see_lighthouse"));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, 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 (fval(r, RF_MALLORN)) {
|
||||||
if (trees == 1) {
|
if (trees == 1) {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_mallorntree"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_mallorntree"), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_mallorntree_p"), size);
|
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);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_tree"), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_tree_p"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_tree_p"), size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
|
@ -968,7 +1002,7 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iron & stone */
|
/* iron & stone */
|
||||||
if (sr->mode == see_unit && f != (faction *) NULL) {
|
if (sr->mode == see_unit && f != (faction *)NULL) {
|
||||||
resource_report result[MAX_RAWMATERIALS];
|
resource_report result[MAX_RAWMATERIALS];
|
||||||
int n, numresults = report_resources(sr, result, MAX_RAWMATERIALS, f);
|
int n, numresults = report_resources(sr, result, MAX_RAWMATERIALS, f);
|
||||||
|
|
||||||
|
@ -1004,7 +1038,8 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
bytes =
|
bytes =
|
||||||
(int)strlcpy(bufp, LOC(f->locale, n == 1 ? "rc_orc" : "rc_orc_p"),
|
(int)strlcpy(bufp, LOC(f->locale, n == 1 ? "rc_orc" : "rc_orc_p"),
|
||||||
size);
|
size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
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);
|
bytes = (int)strlcpy(bufp, (char *)a->data.v, size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
int nrd = 0;
|
int nrd = 0;
|
||||||
|
|
||||||
/* Nachbarregionen, die gesehen werden, ermitteln */
|
/* 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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_nb_final"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_nb_final"), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_nb_next"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_nb_next"), size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
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);
|
bytes = _snprintf(bufp, size, trailinto(r2, f->locale), regname);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
@ -1132,7 +1170,7 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
/* Spezielle Richtungen */
|
/* Spezielle Richtungen */
|
||||||
for (a = a_find(r->attribs, &at_direction); a && a->type == &at_direction;
|
for (a = a_find(r->attribs, &at_direction); a && a->type == &at_direction;
|
||||||
a = a->next) {
|
a = a->next) {
|
||||||
spec_direction *d = (spec_direction *) (a->data.v);
|
spec_direction *d = (spec_direction *)(a->data.v);
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
@ -1293,7 +1331,8 @@ static void statistics(FILE * F, const region * r, const faction * f)
|
||||||
if (markets_module()) { /* hack */
|
if (markets_module()) { /* hack */
|
||||||
m =
|
m =
|
||||||
msg_message("nr_stat_salary_new", "max", wage(r, NULL, NULL, turn + 1));
|
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));
|
m = msg_message("nr_stat_salary", "max", wage(r, f, f->race, turn + 1));
|
||||||
}
|
}
|
||||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
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 (!markets_module()) {
|
||||||
if (buildingtype_exists(r, bt_find("caravan"), true)) {
|
if (buildingtype_exists(r, bt_find("caravan"), true)) {
|
||||||
m = msg_message("nr_stat_luxuries", "max", (p * 2) / TRADE_FRACTION);
|
m = msg_message("nr_stat_luxuries", "max", (p * 2) / TRADE_FRACTION);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m = msg_message("nr_stat_luxuries", "max", p / TRADE_FRACTION);
|
m = msg_message("nr_stat_luxuries", "max", p / TRADE_FRACTION);
|
||||||
}
|
}
|
||||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||||
|
@ -1354,9 +1394,9 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
||||||
|
|
||||||
/* How many are we listing? For grammar. */
|
/* How many are we listing? For grammar. */
|
||||||
for (a = abegin; a && a->type == &at_travelunit; a = a->next) {
|
for (a = abegin; a && a->type == &at_travelunit; a = a->next) {
|
||||||
unit *u = (unit *) a->data.v;
|
unit *u = (unit *)a->data.v;
|
||||||
|
|
||||||
if (r != u->region && (!u->ship || ship_owner(u->ship)==u)) {
|
if (r != u->region && (!u->ship || ship_owner(u->ship) == u)) {
|
||||||
if (cansee_durchgezogen(f, r, u, 0)) {
|
if (cansee_durchgezogen(f, r, u, 0)) {
|
||||||
++maxtravel;
|
++maxtravel;
|
||||||
}
|
}
|
||||||
|
@ -1371,15 +1411,16 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
||||||
rnl(F);
|
rnl(F);
|
||||||
|
|
||||||
for (a = abegin; a && a->type == &at_travelunit; a = a->next) {
|
for (a = abegin; a && a->type == &at_travelunit; a = a->next) {
|
||||||
unit *u = (unit *) a->data.v;
|
unit *u = (unit *)a->data.v;
|
||||||
|
|
||||||
if (r != u->region && (!u->ship || ship_owner(u->ship)==u)) {
|
if (r != u->region && (!u->ship || ship_owner(u->ship) == u)) {
|
||||||
if (cansee_durchgezogen(f, r, u, 0)) {
|
if (cansee_durchgezogen(f, r, u, 0)) {
|
||||||
++counter;
|
++counter;
|
||||||
if (u->ship != NULL) {
|
if (u->ship != NULL) {
|
||||||
if (counter == 1) {
|
if (counter == 1) {
|
||||||
bytes = (int)strlcpy(bufp, "Die ", size);
|
bytes = (int)strlcpy(bufp, "Die ", size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, "die ", size);
|
bytes = (int)strlcpy(bufp, "die ", size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||||
|
@ -1387,7 +1428,8 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bytes = (int)strlcpy(bufp, shipname(u->ship), size);
|
bytes = (int)strlcpy(bufp, shipname(u->ship), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, unitname(u), size);
|
bytes = (int)strlcpy(bufp, unitname(u), size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||||
|
@ -1401,7 +1443,8 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (counter + 1 == maxtravel) {
|
}
|
||||||
|
else if (counter + 1 == maxtravel) {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "list_and"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "list_and"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
@ -1412,7 +1455,7 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* TODO: finish localization */
|
/* TODO: finish localization */
|
||||||
if (size>0) {
|
if (size > 0) {
|
||||||
if (maxtravel == 1) {
|
if (maxtravel == 1) {
|
||||||
bytes = _snprintf(bufp, size, " %s", LOC(f->locale, "has_moved_one"));
|
bytes = _snprintf(bufp, size, " %s", LOC(f->locale, "has_moved_one"));
|
||||||
}
|
}
|
||||||
|
@ -1463,7 +1506,7 @@ report_template(const char *filename, report_context * ctx, const char *charset)
|
||||||
char buf[8192], *bufp;
|
char buf[8192], *bufp;
|
||||||
size_t size;
|
size_t size;
|
||||||
int bytes;
|
int bytes;
|
||||||
bool utf8 = _strcmpl(charset, "utf8")==0 || _strcmpl(charset, "utf-8")==0;
|
bool utf8 = _strcmpl(charset, "utf8") == 0 || _strcmpl(charset, "utf-8") == 0;
|
||||||
|
|
||||||
if (F == NULL) {
|
if (F == NULL) {
|
||||||
perror(filename);
|
perror(filename);
|
||||||
|
@ -1521,7 +1564,8 @@ report_template(const char *filename, report_context * ctx, const char *charset)
|
||||||
if (pl && pl->id != 0) {
|
if (pl && pl->id != 0) {
|
||||||
sprintf(buf, "%s %d,%d,%d ; %s", LOC(f->locale,
|
sprintf(buf, "%s %d,%d,%d ; %s", LOC(f->locale,
|
||||||
parameters[P_REGION]), nx, ny, pl->id, rname(r, 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]),
|
sprintf(buf, "%s %d,%d ; %s", LOC(f->locale, parameters[P_REGION]),
|
||||||
nx, ny, rname(r, f->locale));
|
nx, ny, rname(r, f->locale));
|
||||||
}
|
}
|
||||||
|
@ -1542,7 +1586,7 @@ report_template(const char *filename, report_context * ctx, const char *charset)
|
||||||
unitid(u), u->name, u->number, get_money(u));
|
unitid(u), u->name, u->number, get_money(u));
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
if (u->building && building_owner(u->building)==u) {
|
if (u->building && building_owner(u->building) == u) {
|
||||||
building *b = u->building;
|
building *b = u->building;
|
||||||
int cost = buildingmaintenance(b, rsilver);
|
int cost = buildingmaintenance(b, rsilver);
|
||||||
|
|
||||||
|
@ -1554,10 +1598,12 @@ report_template(const char *filename, report_context * ctx, const char *charset)
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
} else if (u->ship) {
|
}
|
||||||
if (ship_owner(u->ship)==u) {
|
else if (u->ship) {
|
||||||
|
if (ship_owner(u->ship) == u) {
|
||||||
bytes = (int)strlcpy(bufp, ",S", size);
|
bytes = (int)strlcpy(bufp, ",S", size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, ",s", size);
|
bytes = (int)strlcpy(bufp, ",s", size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
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 (dh) {
|
||||||
if (i == allierte) {
|
if (i == allierte) {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "list_and"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "list_and"), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, ", ", size);
|
bytes = (int)strlcpy(bufp, ", ", size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
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);
|
bytes = (int)strlcpy(bufp, locale_string(f->locale, parameters[P_ANY]), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
for (h = 1; h < HELP_ALL; h *= 2) {
|
for (h = 1; h < HELP_ALL; h *= 2) {
|
||||||
int p = MAXPARAMS;
|
int p = MAXPARAMS;
|
||||||
if ((mode & h) == h) {
|
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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
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)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
hh = 1;
|
hh = 1;
|
||||||
|
@ -1710,11 +1758,7 @@ static void allies(FILE * F, const faction * f)
|
||||||
if (f->allies) {
|
if (f->allies) {
|
||||||
int bytes;
|
int bytes;
|
||||||
size_t size = sizeof(buf);
|
size_t size = sizeof(buf);
|
||||||
if (!f->allies->next) {
|
bytes = _snprintf(buf, size, "%s ", LOC(f->locale, "faction_help"));
|
||||||
bytes = _snprintf(buf, size, "%s ", LOC(f->locale, "faction_help_one"));
|
|
||||||
} else {
|
|
||||||
bytes = _snprintf(buf, size, "%s ", LOC(f->locale, "faction_help_many"));
|
|
||||||
}
|
|
||||||
size -= bytes;
|
size -= bytes;
|
||||||
show_allies(f, f->allies, buf + bytes, size);
|
show_allies(f, f->allies, buf + bytes, size);
|
||||||
rparagraph(F, buf, 0, 0, 0);
|
rparagraph(F, buf, 0, 0, 0);
|
||||||
|
@ -1725,11 +1769,7 @@ static void allies(FILE * F, const faction * f)
|
||||||
if (g->allies) {
|
if (g->allies) {
|
||||||
int bytes;
|
int bytes;
|
||||||
size_t size = sizeof(buf);
|
size_t size = sizeof(buf);
|
||||||
if (!g->allies->next) {
|
bytes = _snprintf(buf, size, "%s %s ", g->name, LOC(f->locale, "group_help"));
|
||||||
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"));
|
|
||||||
}
|
|
||||||
size -= bytes;
|
size -= bytes;
|
||||||
show_allies(f, g->allies, buf + bytes, size);
|
show_allies(f, g->allies, buf + bytes, size);
|
||||||
rparagraph(F, buf, 0, 0, 0);
|
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)) {
|
if (f != see && fval(u, UFL_ANON_FACTION)) {
|
||||||
tarned = true;
|
tarned = true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
for (i = 0; i != nextguard; ++i)
|
for (i = 0; i != nextguard; ++i)
|
||||||
if (guardians[i] == f)
|
if (guardians[i] == f)
|
||||||
break;
|
break;
|
||||||
|
@ -1790,7 +1831,8 @@ static void guards(FILE * F, const region * r, const faction * see)
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
if (i == nextguard - (tarned ? 0 : 1)) {
|
if (i == nextguard - (tarned ? 0 : 1)) {
|
||||||
bytes = (int)strlcpy(bufp, LOC(see->locale, "list_and"), size);
|
bytes = (int)strlcpy(bufp, LOC(see->locale, "list_and"), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, ", ", size);
|
bytes = (int)strlcpy(bufp, ", ", size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
|
@ -1798,7 +1840,8 @@ static void guards(FILE * F, const region * r, const faction * see)
|
||||||
}
|
}
|
||||||
if (i < nextguard) {
|
if (i < nextguard) {
|
||||||
bytes = (int)strlcpy(bufp, factionname(guardians[i]), size);
|
bytes = (int)strlcpy(bufp, factionname(guardians[i]), size);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes = (int)strlcpy(bufp, "unbekannten Einheiten", size);
|
bytes = (int)strlcpy(bufp, "unbekannten Einheiten", size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
|
@ -1856,7 +1899,7 @@ static void list_address(FILE * F, const faction * uf, quicklist * seenfactions)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nr_ship(FILE * F, const seen_region * sr, const ship * sh, const faction * f,
|
nr_ship(FILE * F, const seen_region * sr, const ship * sh, const faction * f,
|
||||||
const unit * captain)
|
const unit * captain)
|
||||||
{
|
{
|
||||||
const region *r = sr->r;
|
const region *r = sr->r;
|
||||||
char buffer[8192], *bufp = buffer;
|
char buffer[8192], *bufp = buffer;
|
||||||
|
@ -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),
|
bytes = _snprintf(bufp, size, "%s, %s, (%d/%d)", shipname(sh),
|
||||||
LOC(f->locale, sh->type->_name), n, shipcapacity(sh) / 100);
|
LOC(f->locale, sh->type->_name), n, shipcapacity(sh) / 100);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bytes =
|
bytes =
|
||||||
_snprintf(bufp, size, "%s, %s", shipname(sh), LOC(f->locale,
|
_snprintf(bufp, size, "%s, %s", shipname(sh), LOC(f->locale,
|
||||||
sh->type->_name));
|
sh->type->_name));
|
||||||
|
@ -1930,7 +1974,7 @@ nr_ship(FILE * F, const seen_region * sr, const ship * sh, const faction * f,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nr_building(FILE * F, const seen_region * sr, const building * b,
|
nr_building(FILE * F, const seen_region * sr, const building * b,
|
||||||
const faction * f)
|
const faction * f)
|
||||||
{
|
{
|
||||||
int i, bytes;
|
int i, bytes;
|
||||||
const char *name, *bname, *billusion = NULL;
|
const char *name, *bname, *billusion = NULL;
|
||||||
|
@ -2078,7 +2122,7 @@ static void nr_paragraph(FILE * F, message * m, faction * f)
|
||||||
|
|
||||||
int
|
int
|
||||||
report_plaintext(const char *filename, report_context * ctx,
|
report_plaintext(const char *filename, report_context * ctx,
|
||||||
const char *charset)
|
const char *charset)
|
||||||
{
|
{
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
char ch;
|
char ch;
|
||||||
|
@ -2096,7 +2140,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
seen_region *sr = NULL;
|
seen_region *sr = NULL;
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
char *bufp;
|
char *bufp;
|
||||||
bool utf8 = _strcmpl(charset, "utf8")==0 || _strcmpl(charset, "utf-8")==0;
|
bool utf8 = _strcmpl(charset, "utf8") == 0 || _strcmpl(charset, "utf-8") == 0;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
/* static variables can cope with writing for different turns */
|
/* static variables can cope with writing for different turns */
|
||||||
|
@ -2245,7 +2289,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
if (thisseason == 0) {
|
if (thisseason == 0) {
|
||||||
centre(F, LOC(f->locale, "nr_insectwinter"), true);
|
centre(F, LOC(f->locale, "nr_insectwinter"), true);
|
||||||
rnl(F);
|
rnl(F);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (nextseason == 0) {
|
if (nextseason == 0) {
|
||||||
centre(F, LOC(f->locale, "nr_insectfall"), true);
|
centre(F, LOC(f->locale, "nr_insectfall"), true);
|
||||||
rnl(F);
|
rnl(F);
|
||||||
|
@ -2283,7 +2328,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
rnl(F);
|
rnl(F);
|
||||||
centre(F, LOC(f->locale, "section_newspells"), true);
|
centre(F, LOC(f->locale, "section_newspells"), true);
|
||||||
while (a && a->type == &at_reportspell) {
|
while (a && a->type == &at_reportspell) {
|
||||||
spellbook_entry *sbe = (spellbook_entry *) a->data.v;
|
spellbook_entry *sbe = (spellbook_entry *)a->data.v;
|
||||||
nr_spell(F, sbe, f->locale);
|
nr_spell(F, sbe, f->locale);
|
||||||
a = a->next;
|
a = a->next;
|
||||||
}
|
}
|
||||||
|
@ -2374,7 +2419,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
if (herb && lux) {
|
if (herb && lux) {
|
||||||
m = msg_message("nr_market_info_p", "p1 p2",
|
m = msg_message("nr_market_info_p", "p1 p2",
|
||||||
lux ? lux->rtype : 0, herb ? herb->rtype : 0);
|
lux ? lux->rtype : 0, herb ? herb->rtype : 0);
|
||||||
} else if (lux || herb) {
|
}
|
||||||
|
else if (lux || herb) {
|
||||||
m = msg_message("nr_market_info_s", "p1",
|
m = msg_message("nr_market_info_s", "p1",
|
||||||
lux ? lux->rtype : herb->rtype);
|
lux ? lux->rtype : herb->rtype);
|
||||||
}
|
}
|
||||||
|
@ -2383,7 +2429,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
nr_paragraph(F, m, f);
|
nr_paragraph(F, m, f);
|
||||||
}
|
}
|
||||||
/* */
|
/* */
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (!fval(r->terrain, SEA_REGION) && rpeasants(r) / TRADE_FRACTION > 0) {
|
if (!fval(r->terrain, SEA_REGION) && rpeasants(r) / TRADE_FRACTION > 0) {
|
||||||
rnl(F);
|
rnl(F);
|
||||||
prices(F, r, f);
|
prices(F, r, f);
|
||||||
|
@ -2391,15 +2438,18 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
}
|
}
|
||||||
guards(F, r, f);
|
guards(F, r, f);
|
||||||
durchreisende(F, r, f);
|
durchreisende(F, r, f);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (sr->mode == see_far) {
|
if (sr->mode == see_far) {
|
||||||
describe(F, sr, f);
|
describe(F, sr, f);
|
||||||
guards(F, r, f);
|
guards(F, r, f);
|
||||||
durchreisende(F, r, f);
|
durchreisende(F, r, f);
|
||||||
} else if (sr->mode == see_lighthouse) {
|
}
|
||||||
|
else if (sr->mode == see_lighthouse) {
|
||||||
describe(F, sr, f);
|
describe(F, sr, f);
|
||||||
durchreisende(F, r, f);
|
durchreisende(F, r, f);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
describe(F, sr, f);
|
describe(F, sr, f);
|
||||||
durchreisende(F, r, f);
|
durchreisende(F, r, f);
|
||||||
}
|
}
|
||||||
|
@ -2467,7 +2517,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
if (!anyunits) {
|
if (!anyunits) {
|
||||||
rnl(F);
|
rnl(F);
|
||||||
rparagraph(F, LOC(f->locale, "nr_youaredead"), 0, 2, 0);
|
rparagraph(F, LOC(f->locale, "nr_youaredead"), 0, 2, 0);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
list_address(F, f, ctx->addresses);
|
list_address(F, f, ctx->addresses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2544,7 +2595,8 @@ static void add_find(faction * f, unit * u, faction * f2)
|
||||||
if (!*fp) {
|
if (!*fp) {
|
||||||
fs = *fp = calloc(sizeof(struct fsee), 1);
|
fs = *fp = calloc(sizeof(struct fsee), 1);
|
||||||
fs->f = f;
|
fs->f = f;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
fs = *fp;
|
fs = *fp;
|
||||||
sp = &fs->see;
|
sp = &fs->see;
|
||||||
while (*sp && (*sp)->seen != f2)
|
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 = *sp = calloc(sizeof(struct see), 1);
|
||||||
ss->proof = u;
|
ss->proof = u;
|
||||||
ss->seen = f2;
|
ss->seen = f2;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
ss = *sp;
|
ss = *sp;
|
||||||
ss->proof = u;
|
ss->proof = u;
|
||||||
}
|
}
|
||||||
|
@ -2586,7 +2639,7 @@ static void update_find(void)
|
||||||
bool kann_finden(faction * f1, faction * f2)
|
bool kann_finden(faction * f1, faction * f2)
|
||||||
{
|
{
|
||||||
update_find();
|
update_find();
|
||||||
return (bool) (can_find(f1, f2) != NULL);
|
return (bool)(can_find(f1, f2) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******* end summary ******/
|
/******* end summary ******/
|
||||||
|
|
|
@ -9,36 +9,6 @@
|
||||||
CuSuite *get_##name##_suite(void); \
|
CuSuite *get_##name##_suite(void); \
|
||||||
CuSuiteAddSuite(suite, get_##name##_suite())
|
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)
|
int RunAllTests(void)
|
||||||
{
|
{
|
||||||
CuString *output = CuStringNew();
|
CuString *output = CuStringNew();
|
||||||
|
@ -56,6 +26,7 @@ int RunAllTests(void)
|
||||||
ADD_TESTS(suite, direction);
|
ADD_TESTS(suite, direction);
|
||||||
ADD_TESTS(suite, skill);
|
ADD_TESTS(suite, skill);
|
||||||
ADD_TESTS(suite, keyword);
|
ADD_TESTS(suite, keyword);
|
||||||
|
ADD_TESTS(suite, order);
|
||||||
/* util */
|
/* util */
|
||||||
ADD_TESTS(suite, config);
|
ADD_TESTS(suite, config);
|
||||||
ADD_TESTS(suite, base36);
|
ADD_TESTS(suite, base36);
|
||||||
|
|
Loading…
Reference in New Issue