forked from github/server
Merge branch 'master' of github.com:eressea/server
This commit is contained in:
commit
408febe1e1
|
@ -1,4 +1,6 @@
|
|||
eressea.ini
|
||||
Debug
|
||||
Release
|
||||
|
||||
# SlickEdit
|
||||
*.vtg
|
||||
|
|
|
@ -79,6 +79,6 @@ add_subdirectory (iniparser)
|
|||
add_subdirectory (quicklist)
|
||||
add_subdirectory (critbit)
|
||||
add_subdirectory (src eressea)
|
||||
install(DIRECTORY res core conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml")
|
||||
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml")
|
||||
install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua")
|
||||
install(DIRECTORY core/scripts DESTINATION core FILES_MATCHING PATTERN "*.lua")
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
@ -3732,8 +3729,8 @@
|
|||
<arg name="want" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) in $region($region) rekrutiert $int($amount) von $int($want) Personen."</text>
|
||||
<text locale="fr">"$unit($unit) in $region($region) recruits $int($amount) $int($want) people."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region) recruits $int($amount) $int($want) people."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region) recruits
|
||||
$int($amount) of $int($want) people."</text>
|
||||
</message>
|
||||
<message name="siege_catapults" section="events">
|
||||
<type>
|
||||
|
@ -8057,7 +8054,8 @@
|
|||
<arg name="race" type="race"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) in $region($region): $int($number) $race($race,$number) $if($eq($number,1),"verschwand", "verschwanden") über Nacht."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region): $int($number) $race($race,$number) disappearedin the night."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region): $int($number)
|
||||
$race($race,$number) disappeared in the night."</text>
|
||||
</message>
|
||||
|
||||
<message name="forestfire_spread" section="events">
|
||||
|
|
|
@ -15,6 +15,7 @@ MACHINE=`uname -m`
|
|||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
BIN_DIR="build-$MACHINE-$CC-$BUILD"
|
||||
mkdir -p $BIN_DIR
|
||||
ln -sf $BIN_DIR $BUILD
|
||||
cd $BIN_DIR
|
||||
|
||||
MACHINE=$(gcc -dumpmachine)
|
||||
|
|
|
@ -16,4 +16,4 @@ BIN_DIR="build-$MACHINE-$CC-Debug"
|
|||
|
||||
cd $ROOT/$BIN_DIR
|
||||
make install
|
||||
cd $OLDPWD
|
||||
|
||||
|
|
42
s/setup
42
s/setup
|
@ -8,10 +8,11 @@ exit $2 # otherwise
|
|||
|
||||
function usage() {
|
||||
cat <<USAGE
|
||||
Usage: $u [-hf] [-d DIR] [-g <game>] [-r <rules>] [-s DIR]
|
||||
Usage: $u [-hfn] [-d DIR] [-g <game>] [-r <rules>] [-s DIR]
|
||||
-h print this message
|
||||
-f force overwrite of existing game
|
||||
-g game id
|
||||
-n create new eressea.ini file
|
||||
-r name of ruleset
|
||||
-s server installation directory
|
||||
-d override directory name
|
||||
|
@ -21,13 +22,14 @@ USAGE
|
|||
game=0
|
||||
force=0
|
||||
src=server
|
||||
|
||||
while getopts :d:g:r:s:hf o; do
|
||||
edit=1
|
||||
while getopts :d:g:r:s:hfn o; do
|
||||
case "${o}" in
|
||||
h) usage ; exit 0 ;;
|
||||
s) src=${OPTARG} ;;
|
||||
d) dir=${OPTARG} ;;
|
||||
f) force=1 ;;
|
||||
n) edit=0 ;;
|
||||
g) game=${OPTARG} ;;
|
||||
r) rules=${OPTARG} ;;
|
||||
*) echo "not implemented ${o} ${OPTARG}" ;;
|
||||
|
@ -44,7 +46,7 @@ done
|
|||
[ -e $TOOLS ] || TOOLS=$SOURCE/bin
|
||||
[ -z $INIFILE ] && INIFILE=$TOOLS/inifile
|
||||
[ -e $INIFILE ] || INIFILE=$TOOLS/iniparser/inifile
|
||||
[ -e $INIFILE ] || abort "tool is not installed: $INIFILE"
|
||||
#[ -e $INIFILE ] || abort "tool is not installed: $INIFILE"
|
||||
|
||||
cd $ERESSEA
|
||||
if [ -d $dir ] ; then
|
||||
|
@ -55,18 +57,38 @@ cd $dir || abort "could not chdir to game-$game"
|
|||
mkdir -p data reports
|
||||
|
||||
function ini_sec() {
|
||||
if [ $edit -eq 1 ]; then
|
||||
$INIFILE eressea.ini add $1
|
||||
else
|
||||
echo "[$1]" >> eressea.ini
|
||||
fi
|
||||
}
|
||||
function ini_add() {
|
||||
$INIFILE eressea.ini add $1 $2
|
||||
if [ $edit -eq 1 ]; then
|
||||
$INIFILE eressea.ini add $1:$2 $3
|
||||
else
|
||||
echo "$2 = $3" >> eressea.ini
|
||||
fi
|
||||
}
|
||||
function ini_start() {
|
||||
if [ -e eressea.ini ]; then
|
||||
if [ ! -e $INIFILE ] && [ $edit -eq 1 ]; then
|
||||
abort "missing editor for eressea.ini. use -n to create new file."
|
||||
fi
|
||||
rm -f eressea.ini
|
||||
edit=0
|
||||
else
|
||||
edit=0
|
||||
fi
|
||||
touch eressea.ini
|
||||
}
|
||||
|
||||
ini_start
|
||||
ini_sec eressea
|
||||
ini_add eressea:locales de,en
|
||||
ini_add eressea locales de,en
|
||||
ini_sec lua
|
||||
ini_add lua:install $SOURCE
|
||||
ini_add lua:install $SOURCE
|
||||
ini_add lua:paths $SOURCE/scripts:$SOURCE/lunit
|
||||
ini_add lua:rules $rules
|
||||
ini_add lua install $SOURCE
|
||||
ini_add lua paths $SOURCE/scripts:$SOURCE/lunit
|
||||
ini_add lua rules $rules
|
||||
|
||||
ln -f $SOURCE/scripts/run-turn.lua
|
||||
|
|
|
@ -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));
|
||||
const char *spc = strchr(skname, ' ');
|
||||
size_t len = strlen(skname);
|
||||
char *dst = mkdata(&data, len + (spc ? 3 : 0), kwd, lindex, spc ? 0 : 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);
|
||||
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);
|
||||
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;
|
||||
}
|
4377
src/report.c
4377
src/report.c
File diff suppressed because it is too large
Load Diff
|
@ -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