This commit is contained in:
Enno Rehling 2016-10-23 10:03:46 +02:00
commit a921a6594a
12 changed files with 26 additions and 86 deletions

View File

@ -7,12 +7,12 @@ script: s/travis-build
addons:
apt:
packages:
- liblua5.2-dev
- liblua5.1-dev
- libtolua-dev
- libncurses5-dev
- libsqlite3-dev
- libxml2-dev
- valgrind
- libtolua-dev
os:
- linux
notifications:

View File

@ -14,7 +14,7 @@ GAME=$1
EMAIL=$2
FACTION=$3
PASSWD=$4
echo "$GAME $EMAIL $FACTION $PASSWD" >> /tmp/report.log
#echo "$GAME $EMAIL $FACTION $PASSWD" >> /tmp/report.log
function reply() {
echo $@ | mutt -s "Reportnachforderung Partei ${FACTION}" $EMAIL

View File

@ -269,11 +269,6 @@
<skill name="melee" level="1"/>
</set>
<set name="new_centaur_unit">
<skill name="polearm" level="1"/>
<skill name="melee" level="1"/>
</set>
<set name="seaserpent_spoils">
<item name="dragonblood" amount="6"/>
<item name="seaserpenthead" amount="1"/>

View File

@ -3,7 +3,7 @@
recruitcost="-1" maintenance="0" weight="1000" capacity="440" speed="1.000000"
hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="no"
walk="yes" shapeshift="no" giveperson="no" giveunit="no"
getitem="no" recruitethereal="no" equipment="yes" scarepeasants="yes"
getitem="no" equipment="yes" scarepeasants="yes"
cansteal="no" unarmedguard="yes" absorbpeasants="yes" noheal="yes"
undead="yes" resistpierce="yes">
<ai splitsize="1000" moverandom="yes" learn="yes" />

View File

@ -22,6 +22,7 @@ exit $2 # otherwise
function build() {
assert_dir $SOURCE
cd $SOURCE
rm -rf crypto tolua
git fetch || abort "failed to update source. do you have local changes?"
[ -z $1 ] || git checkout $1
git pull

View File

@ -180,15 +180,6 @@ static void expandorders(region * r, request * requests)
/* ------------------------------------------------------------- */
static void change_level(unit * u, skill_t sk, int bylevel)
{
skill *sv = unit_skill(u, sk);
assert(bylevel > 0);
if (sv == 0)
sv = add_skill(u, sk);
sk_set(sv, sv->level + bylevel);
}
typedef struct recruitment {
struct recruitment *next;
faction *f;
@ -258,10 +249,6 @@ void add_recruits(unit * u, int number, int wanted)
strlcat(equipment, "_unit", sizeof(equipment));
equip_unit(unew, get_equipment(equipment));
if (u_race(unew)->ec_flags & ECF_REC_HORSES) {
change_level(unew, SK_RIDING, 1);
}
if (unew != u) {
transfermen(unew, u, unew->number);
remove_unit(&r->units, unew);
@ -278,24 +265,6 @@ static int any_recruiters(const struct race *rc, int qty)
return (int)(qty * 2 * rc->recruit_multi);
}
/*static int peasant_recruiters(const struct race *rc, int qty)
{
if (rc->ec_flags & ECF_REC_ETHEREAL)
return -1;
if (rc->ec_flags & ECF_REC_HORSES)
return -1;
return (int)(qty * 2 * rc->recruit_multi);
}*/
static int horse_recruiters(const struct race *rc, int qty)
{
if (rc->ec_flags & ECF_REC_ETHEREAL)
return -1;
if (rc->ec_flags & ECF_REC_HORSES)
return (int)(qty * 2.0 * rc->recruit_multi);
return -1;
}
static int do_recruiting(recruitment * recruits, int available)
{
recruitment *rec;
@ -407,17 +376,6 @@ static void expandrecruit(region * r, request * recruitorders)
int orc_total = 0;
/* centaurs: */
recruits = select_recruitment(&recruitorders, horse_recruiters, &orc_total);
if (recruits) {
int recruited, horses = rhorses(r) * 2;
if (orc_total < horses)
horses = orc_total;
recruited = do_recruiting(recruits, horses);
rsethorses(r, (horses - recruited) / 2);
free_recruitments(recruits);
}
/* peasant limited: */
recruits = select_recruitment(&recruitorders, any_recruiters, &orc_total);
if (recruits) {
@ -539,7 +497,7 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders)
return;
}
if (!(rc->ec_flags & ECF_REC_HORSES) && fval(r, RF_ORCIFIED)) {
if (fval(r, RF_ORCIFIED)) {
if (rc != get_race(RC_ORC)) {
cmistake(u, ord, 238, MSG_EVENT);
return;

View File

@ -679,7 +679,7 @@ static const char * relpath(char *buf, size_t sz, const char *path) {
static const char *g_datadir;
const char *datapath(void)
{
static char zText[MAX_PATH]; // FIXME: static return value
static char zText[MAX_PATH];
if (g_datadir)
return g_datadir;
return relpath(zText, sizeof(zText), "data");
@ -693,7 +693,7 @@ void set_datapath(const char *path)
static const char *g_reportdir;
const char *reportpath(void)
{
static char zText[MAX_PATH]; // FIXME: static return value
static char zText[MAX_PATH];
if (g_reportdir)
return g_reportdir;
return relpath(zText, sizeof(zText), "reports");

View File

@ -386,19 +386,14 @@ void destroyfaction(faction ** fp)
const race *rc = u_race(u);
int m = rmoney(r);
/* Personen gehen nur an die Bauern, wenn sie auch von dort
* stammen */
if ((rc->ec_flags & ECF_REC_ETHEREAL) == 0) {
int p = rpeasants(u->region);
int h = rhorses(u->region);
item *itm;
/* Personen gehen nur an die Bauern, wenn sie auch von dort
* stammen */
if (rc->ec_flags & ECF_REC_HORSES) { /* Zentauren an die Pferde */
h += u->number;
}
else { /* Orks zählen nur zur Hälfte */
p += (int)(u->number * rc->recruit_multi);
}
p += (int)(u->number * rc->recruit_multi);
for (itm = u->items; itm; itm = itm->next) {
if (itm->type->flags & ITF_ANIMAL) {
h += itm->number;

View File

@ -217,7 +217,6 @@ extern "C" {
#define GIVEPERSON (1<<2) /* übergibt Personen */
#define GIVEUNIT (1<<3) /* Einheiten an andere Partei übergeben */
#define GETITEM (1<<4) /* nimmt Gegenstände an */
#define ECF_REC_HORSES (1<<6) /* Rekrutiert aus Pferden */
#define ECF_REC_ETHEREAL (1<<7) /* Rekrutiert aus dem Nichts */
#define ECF_REC_UNLIMITED (1<<8) /* Rekrutiert ohne Limit */

View File

@ -1084,15 +1084,9 @@ void transfermen(unit * u, unit * dst, int n)
else if (r->land) {
if ((u_race(u)->ec_flags & ECF_REC_ETHEREAL) == 0) {
const race *rc = u_race(u);
if (rc->ec_flags & ECF_REC_HORSES) { /* Zentauren an die Pferde */
int h = rhorses(r) + n;
rsethorses(r, h);
}
else {
int p = rpeasants(r);
p += (int)(n * rc->recruit_multi);
rsetpeasants(r, p);
}
int p = rpeasants(r);
p += (int)(n * rc->recruit_multi);
rsetpeasants(r, p);
}
}
}

View File

@ -1730,8 +1730,6 @@ static int parse_races(xmlDocPtr doc)
rc->ec_flags |= GIVEUNIT;
if (xml_bvalue(node, "getitem", false))
rc->ec_flags |= GETITEM;
if (xml_bvalue(node, "recruithorses", false))
rc->ec_flags |= ECF_REC_HORSES;
if (xml_bvalue(node, "recruitethereal", false))
rc->ec_flags |= ECF_REC_ETHEREAL;
if (xml_bvalue(node, "recruitunlimited", false))

View File

@ -23,42 +23,42 @@ static void test_unicode_utf8_to_other(CuTest *tc)
unsigned char ch;
size_t sz;
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp437(&ch, utf8_str, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, '?', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp437(&ch, utf8_str+2, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, '?', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp437(&ch, utf8_str+4, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, '?', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp437(&ch, utf8_str + 6, &sz));
CuAssertIntEquals(tc, 1, sz);
CuAssertIntEquals(tc, 1, (int)sz);
CuAssertIntEquals(tc, 'l', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp1252(&ch, utf8_str, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, 216, ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp1252(&ch, utf8_str+2, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, 120, ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp1252(&ch, utf8_str + 4, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, 0x9d, ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_cp1252(&ch, utf8_str + 6, &sz));
CuAssertIntEquals(tc, 1, sz);
CuAssertIntEquals(tc, 1, (int)sz);
CuAssertIntEquals(tc, 'l', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_ascii(&ch, utf8_str, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, '?', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_ascii(&ch, utf8_str + 2, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, '?', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_ascii(&ch, utf8_str + 4, &sz));
CuAssertIntEquals(tc, 2, sz);
CuAssertIntEquals(tc, 2, (int)sz);
CuAssertIntEquals(tc, '?', ch);
CuAssertIntEquals(tc, 0, unicode_utf8_to_ascii(&ch, utf8_str + 6, &sz));
CuAssertIntEquals(tc, 1, sz);
CuAssertIntEquals(tc, 1, (int)sz);
CuAssertIntEquals(tc, 'l', ch);
}