forked from github/server
Merge branch 'develop' into massive_overload
Conflicts: src/move.test.c
This commit is contained in:
commit
a6757ecf9d
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<building name="castle" capacity="1" fort="1">
|
<building name="castle" capacity="1" fort="yes">
|
||||||
<function name="name" value="castle_name_2"/>
|
<function name="name" value="castle_name_2"/>
|
||||||
<function name="protection" value="building_protection"/>
|
<function name="protection" value="building_protection"/>
|
||||||
<function name="taxes" value="lua_building_taxes"/>
|
<function name="taxes" value="lua_building_taxes"/>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<building name="castle" capacity="1" fort="1">
|
<building name="castle" capacity="1" fort="yes">
|
||||||
<function name="name" value="castle_name"/>
|
<function name="name" value="castle_name"/>
|
||||||
<function name="protection" value="building_protection"/>
|
<function name="protection" value="building_protection"/>
|
||||||
<construction skill="building" minskill="1" maxsize="2" reqsize="1" defense_bonus="0">
|
<construction skill="building" minskill="1" maxsize="2" reqsize="1" defense_bonus="0">
|
||||||
|
|
|
@ -246,6 +246,10 @@
|
||||||
unharmed from every conflict, no enemy will lay hand on
|
unharmed from every conflict, no enemy will lay hand on
|
||||||
the bearer for one week.</text>
|
the bearer for one week.</text>
|
||||||
</string>
|
</string>
|
||||||
|
<string name="skillpotion">
|
||||||
|
<text locale="en">The recipe of this potion is a well kept secret. Some even say it couldn't be brewed by mere mortals. One thing is certain though, the drinker receives further insight into any learned skills, which furthers their progress towards the mastery of those skills.</text>
|
||||||
|
<text locale="de">Die Herstellung dieses Trunkes ist ein wohlgehütetes Geheimnis. Manche behaupten gar, von Sterblichen könne er gar nicht gebraut werden. Tatsache ist, dass er dem Trinkenden tiefere Einsicht in seine erlernten Talente gewährt, was ihn in der Meisterung dieser Talente voranbringt.</text>
|
||||||
|
</string>
|
||||||
</namespace>
|
</namespace>
|
||||||
|
|
||||||
<namespace name="school">
|
<namespace name="school">
|
||||||
|
@ -3648,10 +3652,6 @@
|
||||||
<text locale="en">For a healing potion one takes the peel of a windbag and some bugleweed, stirr in some chopped elvendear and sprinkle it with the blossoms of an ice begonia. This has to cook through for four days, while a gapgrowth has to be added on the second day. Then one carefully scoops off the top layer of liquid. One such potion gives four men (or one man four times) a 50% chance to survive otherwise lethal wounds. The potion is automatically used in case of injury.</text>
|
<text locale="en">For a healing potion one takes the peel of a windbag and some bugleweed, stirr in some chopped elvendear and sprinkle it with the blossoms of an ice begonia. This has to cook through for four days, while a gapgrowth has to be added on the second day. Then one carefully scoops off the top layer of liquid. One such potion gives four men (or one man four times) a 50% chance to survive otherwise lethal wounds. The potion is automatically used in case of injury.</text>
|
||||||
<text locale="de">Für einen Heiltrank nehme man die Schale eines Windbeutels und etwas Gurgelkraut, rühre eine kleingehacktes Elfenlieb dazu und bestreue alles mit den Blüten einer Eisblume. Dies muß vier Tage lang gären, wobei man am zweiten Tag einen Spaltwachs dazutun muß. Dann ziehe man vorsichtig den oben schwimmenden Saft ab. Ein solcher Trank gibt vier Männern (oder einem Mann vier mal) im Kampf eine Chance von 50%, sonst tödliche Wunden zu überleben. Der Trank wird von ihnen automatisch bei Verletzung angewandt.</text>
|
<text locale="de">Für einen Heiltrank nehme man die Schale eines Windbeutels und etwas Gurgelkraut, rühre eine kleingehacktes Elfenlieb dazu und bestreue alles mit den Blüten einer Eisblume. Dies muß vier Tage lang gären, wobei man am zweiten Tag einen Spaltwachs dazutun muß. Dann ziehe man vorsichtig den oben schwimmenden Saft ab. Ein solcher Trank gibt vier Männern (oder einem Mann vier mal) im Kampf eine Chance von 50%, sonst tödliche Wunden zu überleben. Der Trank wird von ihnen automatisch bei Verletzung angewandt.</text>
|
||||||
</string>
|
</string>
|
||||||
<string name="skillpotion">
|
|
||||||
<text locale="en">The recipe of this potion is a well kept secret. Some even say it couldn't be brewed by mere mortals. One thing is certain though, the drinker receives further insight into any learned skills, which furthers their progress towards the mastery of those skills.</text>
|
|
||||||
<text locale="de">Die Herstellung dieses Trunkes ist ein wohlgehütetes Geheimnis. Manche behaupten gar, von Sterblichen könne er gar nicht gebraut werden. Tatsache ist, dass er dem Trinkenden tiefere Einsicht in seine erlernten Talente gewährt, was ihn in der Meisterung dieser Talente voranbringt.</text>
|
|
||||||
</string>
|
|
||||||
</namespace>
|
</namespace>
|
||||||
<namespace name="spell">
|
<namespace name="spell">
|
||||||
<string name="create_rop">
|
<string name="create_rop">
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<xi:include href="config://default/buildings/castle-2.xml" />
|
<xi:include href="config://default/buildings/castle-2.xml" />
|
||||||
|
|
||||||
<building name="watch" capacity="1" maxsize="10" fort="1">
|
<building name="watch" capacity="1" maxsize="10" fort="yes">
|
||||||
<function name="name" value="fort_name"/>
|
<function name="name" value="fort_name"/>
|
||||||
<function name="protection" value="building_protection"/>
|
<function name="protection" value="building_protection"/>
|
||||||
<function name="taxes" value="lua_building_taxes"/>
|
<function name="taxes" value="lua_building_taxes"/>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
|
echo "submitting version $VERSION"
|
||||||
shift
|
shift
|
||||||
DESC="$*"
|
DESC="$*"
|
||||||
cd Debug
|
cd Debug
|
||||||
|
|
|
@ -4,6 +4,7 @@ module("tests.e3.castles", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
eressea.game.reset()
|
eressea.game.reset()
|
||||||
|
eressea.settings.set("rules.food.flags", "4")
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_small_castles()
|
function test_small_castles()
|
||||||
|
|
|
@ -666,7 +666,7 @@ void building_setregion(building * b, region * r)
|
||||||
bool in_safe_building(unit *u1, unit *u2) {
|
bool in_safe_building(unit *u1, unit *u2) {
|
||||||
if (u1->building) {
|
if (u1->building) {
|
||||||
building * b = inside_building(u1);
|
building * b = inside_building(u1);
|
||||||
if (b->type->flags & BTF_FORTIFICATION) {
|
if (b && b->type->flags & BTF_FORTIFICATION) {
|
||||||
if (!u2->building) {
|
if (!u2->building) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,7 +410,9 @@ static void test_safe_building(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, true, in_safe_building(u1, u2));
|
CuAssertIntEquals(tc, true, in_safe_building(u1, u2));
|
||||||
u2->building = u1->building;
|
u2->building = u1->building;
|
||||||
CuAssertIntEquals(tc, true, in_safe_building(u1, u2));
|
CuAssertIntEquals(tc, true, in_safe_building(u1, u2));
|
||||||
u1->building->size = 2;
|
u1->number = 2;
|
||||||
|
CuAssertIntEquals(tc, false, in_safe_building(u1, u2));
|
||||||
|
u1->building->size = 3;
|
||||||
CuAssertIntEquals(tc, false, in_safe_building(u1, u2));
|
CuAssertIntEquals(tc, false, in_safe_building(u1, u2));
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
26
src/move.c
26
src/move.c
|
@ -1773,14 +1773,14 @@ static const region_list *travel_route(unit * u,
|
||||||
return iroute;
|
return iroute;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ship_ready(const region * r, unit * u)
|
static bool ship_ready(const region * r, unit * u, order * ord)
|
||||||
{
|
{
|
||||||
if (!u->ship || u != ship_owner(u->ship)) {
|
if (!u->ship || u != ship_owner(u->ship)) {
|
||||||
cmistake(u, u->thisorder, 146, MSG_MOVE);
|
cmistake(u, ord, 146, MSG_MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (effskill(u, SK_SAILING, r) < u->ship->type->cptskill) {
|
if (effskill(u, SK_SAILING, r) < u->ship->type->cptskill) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
|
||||||
"error_captain_skill_low", "value ship", u->ship->type->cptskill,
|
"error_captain_skill_low", "value ship", u->ship->type->cptskill,
|
||||||
u->ship));
|
u->ship));
|
||||||
return false;
|
return false;
|
||||||
|
@ -1788,16 +1788,16 @@ static bool ship_ready(const region * r, unit * u)
|
||||||
if (u->ship->type->construction) {
|
if (u->ship->type->construction) {
|
||||||
assert(!u->ship->type->construction->improvement); /* sonst ist construction::size nicht ship_type::maxsize */
|
assert(!u->ship->type->construction->improvement); /* sonst ist construction::size nicht ship_type::maxsize */
|
||||||
if (u->ship->size != u->ship->type->construction->maxsize) {
|
if (u->ship->size != u->ship->type->construction->maxsize) {
|
||||||
cmistake(u, u->thisorder, 15, MSG_MOVE);
|
cmistake(u, ord, 15, MSG_MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!enoughsailors(u->ship, crew_skill(u->ship))) {
|
if (!enoughsailors(u->ship, crew_skill(u->ship))) {
|
||||||
cmistake(u, u->thisorder, 1, MSG_MOVE);
|
cmistake(u, ord, 1, MSG_MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cansail(r, u->ship)) {
|
if (!cansail(r, u->ship)) {
|
||||||
cmistake(u, u->thisorder, 18, MSG_MOVE);
|
cmistake(u, ord, 18, MSG_MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1879,7 +1879,7 @@ sail(unit * u, order * ord, bool move_on_land, region_list ** routep)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ship_ready(starting_point, u))
|
if (!ship_ready(starting_point, u, ord))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Wir suchen so lange nach neuen Richtungen, wie es geht. Diese werden
|
/* Wir suchen so lange nach neuen Richtungen, wie es geht. Diese werden
|
||||||
|
@ -2336,13 +2336,13 @@ static void travel(unit * u, region_list ** routep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_cmd(unit * u, bool move_on_land)
|
void move_cmd(unit * u, order * ord, bool move_on_land)
|
||||||
{
|
{
|
||||||
region_list *route = NULL;
|
region_list *route = NULL;
|
||||||
|
|
||||||
assert(u->number);
|
assert(u->number);
|
||||||
if (u->ship && u == ship_owner(u->ship)) {
|
if (u->ship && u == ship_owner(u->ship)) {
|
||||||
sail(u, u->thisorder, move_on_land, &route);
|
sail(u, ord, move_on_land, &route);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
travel(u, &route);
|
travel(u, &route);
|
||||||
|
@ -2386,7 +2386,7 @@ static direction_t hunted_dir(attrib * at, int id)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int follow_ship(unit * u, order * ord)
|
int follow_ship(unit * u, order * ord)
|
||||||
{
|
{
|
||||||
region *rc = u->region;
|
region *rc = u->region;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
|
@ -2460,7 +2460,7 @@ static int follow_ship(unit * u, order * ord)
|
||||||
init_tokens_str(command);
|
init_tokens_str(command);
|
||||||
getstrtoken();
|
getstrtoken();
|
||||||
/* NACH ausführen */
|
/* NACH ausführen */
|
||||||
move_cmd(u, false);
|
move_cmd(u, ord, false);
|
||||||
return 1; /* true -> Einheitenliste von vorne durchgehen */
|
return 1; /* true -> Einheitenliste von vorne durchgehen */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2627,13 +2627,13 @@ void movement(void)
|
||||||
if (ships) {
|
if (ships) {
|
||||||
if (u->ship && ship_owner(u->ship) == u) {
|
if (u->ship && ship_owner(u->ship) == u) {
|
||||||
init_order(u->thisorder);
|
init_order(u->thisorder);
|
||||||
move_cmd(u, false);
|
move_cmd(u, u->thisorder, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!u->ship || ship_owner(u->ship) != u) {
|
if (!u->ship || ship_owner(u->ship) != u) {
|
||||||
init_order(u->thisorder);
|
init_order(u->thisorder);
|
||||||
move_cmd(u, false);
|
move_cmd(u, u->thisorder, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ extern "C" {
|
||||||
struct region_list;
|
struct region_list;
|
||||||
struct ship;
|
struct ship;
|
||||||
struct building_type;
|
struct building_type;
|
||||||
|
struct order;
|
||||||
|
|
||||||
extern struct attrib_type at_shiptrail;
|
extern struct attrib_type at_shiptrail;
|
||||||
|
|
||||||
|
@ -75,7 +76,8 @@ extern "C" {
|
||||||
bool move_blocked(const struct unit *u, const struct region *src,
|
bool move_blocked(const struct unit *u, const struct region *src,
|
||||||
const struct region *dest);
|
const struct region *dest);
|
||||||
bool can_takeoff(const struct ship * sh, const struct region * from, const struct region * to);
|
bool can_takeoff(const struct ship * sh, const struct region * from, const struct region * to);
|
||||||
void move_cmd(struct unit * u, bool move_on_land);
|
void move_cmd(struct unit * u, struct order * ord, bool move_on_land);
|
||||||
|
int follow_ship(struct unit * u, struct order * ord);
|
||||||
|
|
||||||
#define SA_HARBOUR 2
|
#define SA_HARBOUR 2
|
||||||
#define SA_COAST 1
|
#define SA_COAST 1
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
|
|
||||||
#include "guard.h"
|
#include "guard.h"
|
||||||
|
#include "keyword.h"
|
||||||
|
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include <kernel/ally.h>
|
#include <kernel/ally.h>
|
||||||
|
@ -14,9 +15,13 @@
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
|
#include <kernel/order.h>
|
||||||
|
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
|
#include <util/message.h>
|
||||||
|
#include <util/base36.h>
|
||||||
|
#include <util/parser.h>
|
||||||
|
|
||||||
#include <CuTest.h>
|
#include <CuTest.h>
|
||||||
#include <tests.h>
|
#include <tests.h>
|
||||||
|
@ -412,6 +417,69 @@ static void test_ship_damage_overload(CuTest *tc) {
|
||||||
CuAssertDblEquals(tc, 0.37, damage_overload(5), ASSERT_DBL_DELTA);
|
CuAssertDblEquals(tc, 0.37, damage_overload(5), ASSERT_DBL_DELTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct traveldir {
|
||||||
|
int no;
|
||||||
|
direction_t dir;
|
||||||
|
int age;
|
||||||
|
} traveldir;
|
||||||
|
|
||||||
|
static void test_follow_ship_msg(CuTest * tc) {
|
||||||
|
region *r;
|
||||||
|
ship * sh;
|
||||||
|
faction *f;
|
||||||
|
unit *u;
|
||||||
|
const ship_type *stype;
|
||||||
|
message *msg;
|
||||||
|
order *ord;
|
||||||
|
item_type *silver;
|
||||||
|
|
||||||
|
traveldir *td = NULL;
|
||||||
|
attrib *a;
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
test_create_world();
|
||||||
|
f = test_create_faction(0);
|
||||||
|
r = findregion(0, 0);
|
||||||
|
|
||||||
|
stype = st_find("boat");
|
||||||
|
sh = test_create_ship(r, stype);
|
||||||
|
u = test_create_unit(f, r);
|
||||||
|
u->ship = sh;
|
||||||
|
ship_set_owner(u);
|
||||||
|
set_level(u, SK_SAILING, 10);
|
||||||
|
|
||||||
|
ord = create_order(K_FOLLOW, f->locale, "SHIP 2");
|
||||||
|
assert(ord);
|
||||||
|
unit_addorder(u, ord);
|
||||||
|
|
||||||
|
silver = get_resourcetype(R_SILVER)->itype;
|
||||||
|
i_change(&u->items, silver, 999999);
|
||||||
|
|
||||||
|
a = a_add(&(r->attribs), a_new(&at_shiptrail));
|
||||||
|
td = (traveldir *)a->data.v;
|
||||||
|
td->no = 2;
|
||||||
|
td->dir = D_NORTHWEST;
|
||||||
|
td->age = 2;
|
||||||
|
|
||||||
|
locale_setstring(default_locale, "northwest", "Nordwesten");
|
||||||
|
locale_setstring(default_locale, "keyword::move", "NACH");
|
||||||
|
init_locale(default_locale);
|
||||||
|
|
||||||
|
mt_register(mt_new_va("error18", "unit:unit", "region:region", "command:order", 0));
|
||||||
|
|
||||||
|
init_order(ord);
|
||||||
|
getstrtoken();
|
||||||
|
|
||||||
|
follow_ship(u, ord);
|
||||||
|
|
||||||
|
CuAssertPtrNotNull(tc, msg = test_find_messagetype(u->faction->msgs, "error18"));
|
||||||
|
void *p = msg->parameters[2].v;
|
||||||
|
CuAssertPtrNotNull(tc, p);
|
||||||
|
CuAssertIntEquals(tc, K_FOLLOW, getkeyword((order *)p));
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
CuSuite *get_move_suite(void)
|
CuSuite *get_move_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
|
@ -434,5 +502,6 @@ CuSuite *get_move_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_ship_ridiculous_overload_bad);
|
SUITE_ADD_TEST(suite, test_ship_ridiculous_overload_bad);
|
||||||
SUITE_ADD_TEST(suite, test_ship_ridiculous_overload_no_captain);
|
SUITE_ADD_TEST(suite, test_ship_ridiculous_overload_no_captain);
|
||||||
SUITE_ADD_TEST(suite, test_ship_damage_overload);
|
SUITE_ADD_TEST(suite, test_ship_damage_overload);
|
||||||
|
SUITE_ADD_TEST(suite, test_follow_ship_msg);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ void piracy_cmd(unit * u, order *ord)
|
||||||
|
|
||||||
/* Bewegung ausführen */
|
/* Bewegung ausführen */
|
||||||
init_order(u->thisorder);
|
init_order(u->thisorder);
|
||||||
move_cmd(u, true);
|
move_cmd(u, ord, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void age_piracy(region *r) {
|
void age_piracy(region *r) {
|
||||||
|
|
Loading…
Reference in New Issue