Merge branch 'master' of github.com:TomBraun/server into TomBraun-master

Conflicts:
	src/kernel/build.c
	src/kernel/item.c
This commit is contained in:
Enno Rehling 2014-06-29 20:05:44 -07:00
commit 7a6b237de0
6 changed files with 59 additions and 14 deletions

View File

@ -12,9 +12,8 @@ Eressea depends on a number of external libraries. On a recent Debian-based Linu
This repository relies heavily on the use of submodules, and it pulls in most of the code from those. The build system being used is cmake, which can create Makefiles on Unix, or Visual Studio project files on Windows. Here's how you clone and build the source on Ubuntu: This repository relies heavily on the use of submodules, and it pulls in most of the code from those. The build system being used is cmake, which can create Makefiles on Unix, or Visual Studio project files on Windows. Here's how you clone and build the source on Ubuntu:
git clone git://github.com/eressea/server.git git clone --recursive git://github.com/eressea/server.git
cd server cd server
git submodule update --init
./configure ./configure
If you got this far and all went well, you have built a server (it is linked from the `game` subdirectory), and it will have passed some basic functionality tests. If you got this far and all went well, you have built a server (it is linked from the `game` subdirectory), and it will have passed some basic functionality tests.

View File

@ -693,3 +693,20 @@ function disabled_test_bug_1738_build_castle_e3()
-- does not have the needed minimum skill. -- does not have the needed minimum skill.
assert_equal(c.size, 250) assert_equal(c.size, 250)
end end
function test_golem_use_four_iron()
local r0 = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "dwarf", "de")
local u1 = unit.create(f1, r0, 3)
u1.race = "irongolem"
u1:set_skill("weaponsmithing", 1)
u1:set_skill("armorer", 1)
u1:clear_orders()
u1:add_order("Mache 4 Turmschild")
process_orders()
assert_equal(2, u1.number)
assert_equal(4, u1:get_item("towershield"))
end

View File

@ -306,3 +306,32 @@ function test_block_movement_aots()
assert_equal(r1, u21.region, "unit with amulet should stop me") assert_equal(r1, u21.region, "unit with amulet should stop me")
assert_equal(r2, u22.region, "nobody should see me") assert_equal(r2, u22.region, "nobody should see me")
end end
function test_stonegolems()
local r0 = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "stonegolem", "de")
local u1 = unit.create(f1, r0, 1)
local u2 = unit.create(f1, r0, 2)
local c1 = building.create(r0, "castle")
c1.size = 226
u1:set_skill("building", 1)
u2:set_skill("building", 1)
-- test that no server crash occur
u1:clear_orders()
u1:add_order("Mache Burg")
process_orders()
assert_equal(0 ,u1.number, "There shoud be no Stone Golems")
-- end test server crash
-- test that Stone Golems build for four stones
u2:clear_orders()
u2:add_order("MACHE 4 BURG " .. itoa36(c1.id))
process_orders()
assert_equal(230, c1.size, "resulting size should be 230")
assert_equal(1 ,u2.number, "There shoud be one Stone Golems")
-- end test Stone Golems four stones
end

View File

@ -777,13 +777,12 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
/* Die Einheit befindet sich automatisch im Inneren der neuen Burg. */ /* Die Einheit befindet sich automatisch im Inneren der neuen Burg. */
if (u->number && leave(u, false)) { if (u->number && leave(u, false)) {
u_set_building(u, b); u_set_building(u, b);
assert(building_owner(b)==u);
} }
#ifdef WDW_PYRAMID #ifdef WDW_PYRAMID
if (b->type == bt_find("pyramid") && f_get_alliance(u->faction) != NULL) { if (b->type == bt_find("pyramid") && f_get_alliance(u->faction) != NULL) {
attrib *a = a_add(&b->attribs, a_new(&at_alliance)); attrib *a = a_add(&b->attribs, a_new(&at_alliance));
a->data.i = u->faction->alliance->id; a->data.i = u->faction->alliance->id;
} }
#endif #endif
} }

View File

@ -109,14 +109,14 @@ static int res_changeitem(unit * u, const resource_type * rtype, int delta)
if (delta % GOLEM_STONE != 0) if (delta % GOLEM_STONE != 0)
--reduce; --reduce;
scale_number(u, u->number + reduce); scale_number(u, u->number + reduce);
num = u->number; num = u->number * GOLEM_STONE;
} else if (rtype == get_resourcetype(R_IRON) } else if (rtype == get_resourcetype(R_IRON)
&& u_race(u) == get_race(RC_IRONGOLEM) && delta <= 0) { && u_race(u) == get_race(RC_IRONGOLEM) && delta <= 0) {
int reduce = delta / GOLEM_IRON; int reduce = delta / GOLEM_IRON;
if (delta % GOLEM_IRON != 0) if (delta % GOLEM_IRON != 0)
--reduce; --reduce;
scale_number(u, u->number + reduce); scale_number(u, u->number + reduce);
num = u->number; num = u->number * GOLEM_IRON;
} else { } else {
const item_type *itype = resource2item(rtype); const item_type *itype = resource2item(rtype);
item *i; item *i;
@ -711,10 +711,11 @@ mod_elves_only(const unit * u, const region * r, skill_t sk, int value)
static int static int
mod_dwarves_only(const unit * u, const region * r, skill_t sk, int value) mod_dwarves_only(const unit * u, const region * r, skill_t sk, int value)
{ {
if (u_race(u) == get_race(RC_DWARF)) unused_arg(r);
if (u->faction->race == get_race(RC_DWARF)) {
return value; return value;
unused_arg(r); }
return -118; return -118;
} }
static int heal(unit * user, int effect) static int heal(unit * user, int effect)

View File

@ -1441,6 +1441,8 @@ static int parse_spells(xmlDocPtr doc)
xmlXPathObjectPtr spells; xmlXPathObjectPtr spells;
char zText[32]; char zText[32];
strcpy(zText, "fumble_"); strcpy(zText, "fumble_");
pf_generic cast = 0;
pf_generic fumble = 0;
/* reading eressea/spells/spell */ /* reading eressea/spells/spell */
spells = xmlXPathEvalExpression(BAD_CAST "/eressea/spells/spell", xpath); spells = xmlXPathEvalExpression(BAD_CAST "/eressea/spells/spell", xpath);
@ -1509,8 +1511,6 @@ static int parse_spells(xmlDocPtr doc)
sp->sptyp |= modes[k]; sp->sptyp |= modes[k];
/* reading eressea/spells/spell/function */ /* reading eressea/spells/spell/function */
pf_generic cast = 0;
pf_generic fumble = 0;
xpath->node = node; xpath->node = node;
result = xmlXPathEvalExpression(BAD_CAST "function", xpath); result = xmlXPathEvalExpression(BAD_CAST "function", xpath);