forked from github/server
Merge branch 'master' of github.com:ennorehling/eressea
This commit is contained in:
commit
c3097d3785
|
@ -4464,6 +4464,10 @@
|
|||
<text locale="de">Heimstein</text>
|
||||
<text locale="en">Homestone</text>
|
||||
</string>
|
||||
<string name="nocostbuilding">
|
||||
<text locale="de">Mauern der Ewigkeit</text>
|
||||
<text locale="en">Eternal Walls</text>
|
||||
</string>
|
||||
<string name="nodrift">
|
||||
<text locale="de">Wasserelementar</text>
|
||||
<text locale="en">Water Elemental</text>
|
||||
|
|
9
s/build
9
s/build
|
@ -5,8 +5,13 @@ while [ ! -d $ROOT/.git ]; do
|
|||
done
|
||||
|
||||
[ -z "$BUILD" ] && BUILD=Debug
|
||||
|
||||
[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc`
|
||||
if [ -z "$JOBS" ] ; then
|
||||
if [ -e /usr/sbin/sysctl ]; then
|
||||
JOBS=`sysctl -n hw.ncpu`
|
||||
else
|
||||
JOBS=`nproc`
|
||||
fi
|
||||
fi
|
||||
DISTCC=`which distcc`
|
||||
if [ ! -z "$DISTCC" ] ; then
|
||||
JOBS=`distcc -j`
|
||||
|
|
|
@ -76,7 +76,7 @@ end
|
|||
|
||||
function autoseed.init()
|
||||
-- local newbs = {}
|
||||
local num_seeded = 0
|
||||
local num_seeded = per_region
|
||||
local start = nil
|
||||
|
||||
eressea.log.info('autoseed new players')
|
||||
|
@ -94,8 +94,10 @@ function autoseed.init()
|
|||
for _, p in ipairs(players) do
|
||||
if num_seeded == per_region then
|
||||
local index = rng_int() % #sel
|
||||
start = nil
|
||||
while not start do
|
||||
start = sel[index + 1]
|
||||
sel[index+1] = nil
|
||||
index = (index + 1) % #sel
|
||||
end
|
||||
num_seeded = 0
|
||||
|
|
|
@ -3,7 +3,7 @@ eressea.log.debug("rules for game E2")
|
|||
|
||||
return {
|
||||
require('eressea'),
|
||||
-- require('eressea.autoseed'),
|
||||
require('eressea.autoseed'),
|
||||
require('eressea.xmas'),
|
||||
require('eressea.xmasitems'),
|
||||
require('eressea.wedding'),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <platform.h>
|
||||
#include "spells/shipcurse.h"
|
||||
#include "monster.h"
|
||||
#include "monsters.h"
|
||||
|
||||
#include <kernel/equipment.h>
|
||||
#include <kernel/faction.h>
|
||||
|
@ -28,7 +29,6 @@ static int tolua_levitate_ship(lua_State * L)
|
|||
}
|
||||
|
||||
extern void spawn_undead(void);
|
||||
extern void spawn_dragons(void);
|
||||
extern void plan_monsters(struct faction *f);
|
||||
|
||||
static int tolua_planmonsters(lua_State * L)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 9
|
||||
#define VERSION_BUILD 1
|
||||
#define VERSION_BUILD 2
|
||||
|
|
|
@ -155,7 +155,7 @@ static race *rc_find_i(const char *name)
|
|||
const char *rname = name;
|
||||
race *rc = races;
|
||||
|
||||
while (rc && !strcmp(rname, rc->_name) == 0) {
|
||||
while (rc && strcmp(rname, rc->_name) != 0) {
|
||||
rc = rc->next;
|
||||
}
|
||||
if (!rc && strcmp(name, "uruk") == 0) {
|
||||
|
|
|
@ -41,11 +41,20 @@ static void test_rc_defaults(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_rc_find(CuTest *tc) {
|
||||
race *rc;
|
||||
test_cleanup();
|
||||
rc = test_create_race("hungryhippos");
|
||||
CuAssertPtrEquals(tc, rc, (void *)rc_find("hungryhippos"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_race_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
SUITE_ADD_TEST(suite, test_rc_name);
|
||||
SUITE_ADD_TEST(suite, test_rc_defaults);
|
||||
SUITE_ADD_TEST(suite, test_rc_find);
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -1470,12 +1470,12 @@ unit *create_unit(region * r, faction * f, int number, const struct race *urace,
|
|||
/* u->region auch */
|
||||
u->hp = unit_max_hp(u) * number;
|
||||
|
||||
if (!dname) {
|
||||
name_unit(u);
|
||||
}
|
||||
else {
|
||||
if (dname) {
|
||||
u->_name = _strdup(dname);
|
||||
}
|
||||
else if (urace->generate_name || playerrace(urace)) {
|
||||
name_unit(u);
|
||||
}
|
||||
|
||||
if (creator) {
|
||||
attrib *a;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
|
||||
#include "monsters.h"
|
||||
|
||||
#include "economy.h"
|
||||
#include "chaos.h"
|
||||
#include "give.h"
|
||||
|
@ -883,7 +885,16 @@ static int nrand(int start, int sub)
|
|||
return res;
|
||||
}
|
||||
|
||||
/** Drachen und Seeschlangen können entstehen */
|
||||
unit *spawn_seaserpent(region *r, faction *f) {
|
||||
unit *u = create_unit(r, f, 1, get_race(RC_SEASERPENT), 0, NULL, NULL);
|
||||
fset(u, UFL_ISNEW | UFL_MOVED);
|
||||
equip_unit(u, get_equipment("monster_seaserpent"));
|
||||
return u;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drachen und Seeschlangen können entstehen
|
||||
*/
|
||||
void spawn_dragons(void)
|
||||
{
|
||||
region *r;
|
||||
|
@ -892,13 +903,12 @@ void spawn_dragons(void)
|
|||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
|
||||
if (fval(r->terrain, SEA_REGION) && rng_int() % 10000 < 1) {
|
||||
u = create_unit(r, monsters, 1, get_race(RC_SEASERPENT), 0, NULL, NULL);
|
||||
fset(u, UFL_ISNEW | UFL_MOVED);
|
||||
equip_unit(u, get_equipment("monster_seaserpent"));
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
if (rng_int() % 10000 < 1) {
|
||||
u = spawn_seaserpent(r, monsters);
|
||||
}
|
||||
}
|
||||
|
||||
if ((r->terrain == newterrain(T_GLACIER)
|
||||
else if ((r->terrain == newterrain(T_GLACIER)
|
||||
|| r->terrain == newterrain(T_SWAMP)
|
||||
|| r->terrain == newterrain(T_DESERT))
|
||||
&& rng_int() % 10000 < (5 + 100 * chaosfactor(r))) {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
struct unit;
|
||||
struct region;
|
||||
struct faction;
|
||||
|
||||
struct unit *spawn_seaserpent(struct region *r, struct faction *f);
|
||||
void spawn_dragons(void);
|
|
@ -11,6 +11,7 @@
|
|||
#include <kernel/unit.h>
|
||||
|
||||
#include "monster.h"
|
||||
#include "monsters.h"
|
||||
#include "guard.h"
|
||||
#include "reports.h"
|
||||
#include "skill.h"
|
||||
|
@ -244,10 +245,27 @@ static void test_monsters_learn_exp(CuTest * tc)
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_spawn_seaserpent(CuTest *tc) {
|
||||
region *r;
|
||||
unit *u;
|
||||
faction *f;
|
||||
race *rc;
|
||||
test_cleanup();
|
||||
rc = test_create_race("seaserpent");
|
||||
rc->flags |= RCF_NPC;
|
||||
r = test_create_region(0, 0, 0);
|
||||
f = test_create_faction(0);
|
||||
u = spawn_seaserpent(r, f);
|
||||
CuAssertPtrNotNull(tc, u);
|
||||
CuAssertPtrEquals(tc, 0, u->_name);
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_monsters_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
SUITE_ADD_TEST(suite, test_monsters_attack);
|
||||
SUITE_ADD_TEST(suite, test_spawn_seaserpent);
|
||||
SUITE_ADD_TEST(suite, test_monsters_attack_ocean);
|
||||
SUITE_ADD_TEST(suite, test_seaserpent_piracy);
|
||||
SUITE_ADD_TEST(suite, test_monsters_waiting);
|
||||
|
|
|
@ -2482,7 +2482,7 @@ static void move_pirates(void)
|
|||
unit *u = *up;
|
||||
|
||||
if (!fval(u, UFL_NOTMOVING) && getkeyword(u->thisorder) == K_PIRACY) {
|
||||
piracy_cmd(u, u->thisorder);
|
||||
piracy_cmd(u);
|
||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
}
|
||||
|
||||
|
|
14
src/piracy.c
14
src/piracy.c
|
@ -115,8 +115,9 @@ direction_t find_piracy_target(unit *u, int *il) {
|
|||
return NODIRECTION;
|
||||
}
|
||||
|
||||
void piracy_cmd(unit * u, order *ord)
|
||||
void piracy_cmd(unit * u)
|
||||
{
|
||||
order *ord;
|
||||
region *r = u->region;
|
||||
ship *sh = u->ship, *sh2;
|
||||
direction_t target_dir;
|
||||
|
@ -127,11 +128,11 @@ void piracy_cmd(unit * u, order *ord)
|
|||
int saff = 0;
|
||||
int *il;
|
||||
|
||||
if (!validate_pirate(u, ord)) {
|
||||
if (!validate_pirate(u, u->thisorder)) {
|
||||
return;
|
||||
}
|
||||
|
||||
il = parse_ids(ord);
|
||||
il = parse_ids(u->thisorder);
|
||||
/* Feststellen, ob schon ein anderer alliierter Pirat ein
|
||||
* Ziel gefunden hat. */
|
||||
|
||||
|
@ -201,11 +202,12 @@ void piracy_cmd(unit * u, order *ord)
|
|||
"ship unit region dir", sh, u, r, target_dir));
|
||||
|
||||
/* Befehl konstruieren */
|
||||
set_order(&u->thisorder, create_order(K_MOVE, u->faction->locale, "%s",
|
||||
LOC(u->faction->locale, directions[target_dir])));
|
||||
// TODO: why change u->thisorder?
|
||||
// FIXME: when u->thisorder == ord, set_order calls free, destroys both.
|
||||
ord = create_order(K_MOVE, u->faction->locale, "%s", LOC(u->faction->locale, directions[target_dir]));
|
||||
|
||||
/* Bewegung ausführen */
|
||||
init_order(u->thisorder);
|
||||
init_order(ord);
|
||||
move_cmd(u, ord);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ extern "C" {
|
|||
struct order;
|
||||
struct region;
|
||||
|
||||
void piracy_cmd(struct unit * u, struct order *ord);
|
||||
void piracy_cmd(struct unit * u);
|
||||
void age_piracy(struct region *r);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -32,7 +32,7 @@ static void setup_piracy(void) {
|
|||
}
|
||||
|
||||
static void setup_pirate(unit **pirate, int p_r_flags, int p_rc_flags, const char *p_shiptype,
|
||||
order **ord, unit **victim, int v_r_flags, const char *v_shiptype) {
|
||||
unit **victim, int v_r_flags, const char *v_shiptype) {
|
||||
terrain_type *vterrain;
|
||||
ship_type *st_boat = NULL;
|
||||
race *rc;
|
||||
|
@ -67,16 +67,13 @@ static void setup_pirate(unit **pirate, int p_r_flags, int p_rc_flags, const cha
|
|||
}
|
||||
|
||||
f->locale = get_or_create_locale("de");
|
||||
*ord = create_order(K_PIRACY, f->locale, "%s", itoa36((*victim)->faction->no));
|
||||
assert(*ord);
|
||||
|
||||
(*pirate)->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36((*victim)->faction->no));
|
||||
}
|
||||
|
||||
static void test_piracy_cmd(CuTest * tc) {
|
||||
faction *f;
|
||||
region *r;
|
||||
unit *u, *u2;
|
||||
order *ord;
|
||||
terrain_type *t_ocean;
|
||||
ship_type *st_boat;
|
||||
|
||||
|
@ -93,10 +90,9 @@ static void test_piracy_cmd(CuTest * tc) {
|
|||
u_set_ship(u, test_create_ship(u->region, st_boat));
|
||||
assert(f && u);
|
||||
f->locale = get_or_create_locale("de");
|
||||
ord = create_order(K_PIRACY, f->locale, "%s", itoa36(u2->faction->no));
|
||||
assert(ord);
|
||||
u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(u2->faction->no));
|
||||
|
||||
piracy_cmd(u, ord);
|
||||
piracy_cmd(u);
|
||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
||||
CuAssertTrue(tc, u->region != r);
|
||||
CuAssertPtrEquals(tc, u2->region, u->region);
|
||||
|
@ -104,7 +100,6 @@ static void test_piracy_cmd(CuTest * tc) {
|
|||
CuAssertPtrNotNullMsg(tc, "successful PIRACY sets attribute", r->attribs); // FIXME: this is testing implementation, not interface
|
||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY message", test_find_messagetype(f->msgs, "piratesawvictim"));
|
||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY movement", test_find_messagetype(f->msgs, "shipsail"));
|
||||
free_order(ord);
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
@ -113,7 +108,6 @@ static void test_piracy_cmd_errors(CuTest * tc) {
|
|||
race *r;
|
||||
faction *f;
|
||||
unit *u, *u2;
|
||||
order *ord;
|
||||
ship_type *st_boat;
|
||||
|
||||
test_cleanup();
|
||||
|
@ -123,15 +117,15 @@ static void test_piracy_cmd_errors(CuTest * tc) {
|
|||
r = test_create_race("pirates");
|
||||
u = test_create_unit(f = test_create_faction(r), test_create_region(0, 0, get_or_create_terrain("ocean")));
|
||||
f->locale = get_or_create_locale("de");
|
||||
ord = create_order(K_PIRACY, f->locale, "");
|
||||
assert(u && ord);
|
||||
u->thisorder = create_order(K_PIRACY, f->locale, "");
|
||||
assert(u && u->thisorder);
|
||||
|
||||
piracy_cmd(u, ord);
|
||||
piracy_cmd(u);
|
||||
CuAssertPtrNotNullMsg(tc, "must be on a ship for PIRACY", test_find_messagetype(f->msgs, "error144"));
|
||||
|
||||
test_clear_messages(f);
|
||||
fset(r, RCF_SWIM);
|
||||
piracy_cmd(u, ord);
|
||||
piracy_cmd(u);
|
||||
CuAssertPtrEquals_Msg(tc, "swimmers are pirates", 0, test_find_messagetype(f->msgs, "error144"));
|
||||
CuAssertPtrEquals_Msg(tc, "swimmers are pirates", 0, test_find_messagetype(f->msgs, "error146"));
|
||||
freset(r, RCF_SWIM);
|
||||
|
@ -146,40 +140,37 @@ static void test_piracy_cmd_errors(CuTest * tc) {
|
|||
u_set_ship(u2, u->ship);
|
||||
|
||||
test_clear_messages(f);
|
||||
piracy_cmd(u2, ord);
|
||||
piracy_cmd(u2);
|
||||
CuAssertPtrNotNullMsg(tc, "must be owner for PIRACY", test_find_messagetype(f->msgs, "error146"));
|
||||
|
||||
test_clear_messages(f);
|
||||
piracy_cmd(u, ord);
|
||||
piracy_cmd(u);
|
||||
CuAssertPtrNotNullMsg(tc, "must specify target for PIRACY", test_find_messagetype(f->msgs, "piratenovictim"));
|
||||
free_order(ord);
|
||||
CuAssertPtrNotNull(tc, u->thisorder);
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_piracy_cmd_walking(CuTest * tc) {
|
||||
unit *pirate, *victim;
|
||||
order *ord;
|
||||
region *r;
|
||||
|
||||
test_cleanup();
|
||||
|
||||
setup_pirate(&pirate, 0, 0, NULL, &ord, &victim, SWIM_INTO | SEA_REGION, "boat");
|
||||
setup_pirate(&pirate, 0, 0, NULL, &victim, SWIM_INTO | SEA_REGION, "boat");
|
||||
/* fset(rc, RCF_SWIM); */
|
||||
r = pirate->region;
|
||||
|
||||
piracy_cmd(pirate, ord);
|
||||
CuAssertPtrEquals(tc, 0, pirate->thisorder);
|
||||
piracy_cmd(pirate);
|
||||
CuAssertPtrNotNull(tc, pirate->thisorder);
|
||||
CuAssertTrue(tc, pirate->region == r);
|
||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY message", test_find_messagetype(pirate->faction->msgs, "error144"));
|
||||
free_order(ord);
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_piracy_cmd_land_to_land(CuTest * tc) {
|
||||
unit *u;
|
||||
order *ord;
|
||||
region *r;
|
||||
faction *f;
|
||||
int target;
|
||||
|
@ -205,34 +196,30 @@ static void test_piracy_cmd_land_to_land(CuTest * tc) {
|
|||
u = test_create_unit(f, r);
|
||||
u->ship = test_create_ship(r, stype);
|
||||
set_level(u, SK_SAILING, u->ship->type->sumskill);
|
||||
ord = create_order(K_PIRACY, f->locale, "%s", itoa36(target));
|
||||
u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(target));
|
||||
|
||||
piracy_cmd(u, ord);
|
||||
piracy_cmd(u);
|
||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
||||
CuAssertPtrEquals(tc, r, u->region);
|
||||
// TODO check message
|
||||
free_order(ord);
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_piracy_cmd_swimmer(CuTest * tc) {
|
||||
unit *pirate, *victim;
|
||||
order *ord;
|
||||
region *r;
|
||||
|
||||
test_cleanup();
|
||||
|
||||
setup_pirate(&pirate, 0, RCF_SWIM, NULL, &ord, &victim, SWIM_INTO | SEA_REGION, "boat");
|
||||
setup_pirate(&pirate, 0, RCF_SWIM, NULL, &victim, SWIM_INTO | SEA_REGION, "boat");
|
||||
r = pirate->region;
|
||||
|
||||
piracy_cmd(pirate, ord);
|
||||
piracy_cmd(pirate);
|
||||
CuAssertPtrEquals(tc, 0, pirate->thisorder);
|
||||
CuAssertTrue(tc, pirate->region != r);
|
||||
CuAssertPtrEquals(tc, victim->region, pirate->region);
|
||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY message", test_find_messagetype(pirate->faction->msgs, "piratesawvictim"));
|
||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY movement", test_find_messagetype(pirate->faction->msgs, "travel"));
|
||||
free_order(ord);
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
|
|
@ -5354,7 +5354,7 @@ int sp_leaveastral(castorder * co)
|
|||
u = pa->param[n]->data.u;
|
||||
|
||||
if (!ucontact(u, mage)) {
|
||||
if (power > 10 && !pa->param[n]->flag == TARGET_RESISTS
|
||||
if (power > 10 && !(pa->param[n]->flag == TARGET_RESISTS)
|
||||
&& can_survive(u, rt)) {
|
||||
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order,
|
||||
"feedback_no_contact_no_resist", "target", u));
|
||||
|
|
2
tolua
2
tolua
|
@ -1 +1 @@
|
|||
Subproject commit e53fe09e5789083698d2efb1fd36250efa700c34
|
||||
Subproject commit 32cc6a3e78238278bc5b1fb8566526558e5afdda
|
Loading…
Reference in New Issue