update to latest version of the eressea module

fixes for bool type
fixes for lua 5.2
fixes for some intermittent tests
This commit is contained in:
Enno Rehling 2012-07-09 02:51:48 +02:00
parent b532673f89
commit f7edcf589a
10 changed files with 35 additions and 32 deletions

2
cmake

@ -1 +1 @@
Subproject commit 8cbbeef52b5807bdec52369322cbc9f21d5ed621
Subproject commit dcc663a7a08072b8a1ba0525b182b798c577ccf9

@ -1 +1 @@
Subproject commit f11005c686f672db9cd7991a5d04e4072dace986
Subproject commit f4761867cd8c301d28a6fa8611417f666a730938

View File

@ -44,7 +44,7 @@ function market_action(r)
give = {}
local numlux = p / trade
for x = 1, numlux do
local m = 1+math.mod(rng_int(), n)
local m = 1+math.fmod(rng_int(), n)
u = markets[m]
if give[u] then
give[u] = give[u] + 1
@ -62,7 +62,7 @@ function market_action(r)
give = {}
local numherb = p / 500
for x = 1, numherb do
local m = 1+math.mod(rng_int(), n)
local m = 1+math.fmod(rng_int(), n)
u = markets[m]
if give[u] then
give[u] = give[u] + 1

View File

@ -4,7 +4,7 @@ module("tests.e3.e3features", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("rules.economy.food", "0")
eressea.settings.set("rules.economy.food", "4")
end
function test_no_stealth()
@ -109,6 +109,7 @@ function test_xmastree()
end
function test_fishing()
eressea.settings.set("rules.economy.food", "0")
local r = region.create(0,0, "ocean")
local r2 = region.create(1,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
@ -217,7 +218,6 @@ function test_taxes()
r:set_resource("money", 5000)
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("money", u.number * 10)
u:clear_orders()
u:add_order("LERNE Holzfaellen") -- do not work
local b = building.create(r, "watch")
@ -408,14 +408,15 @@ function test_canoe_passes_through_land()
u1:clear_orders()
u1:add_order("NACH O O O")
process_orders()
assert_equal(u2.region.id, land.id, "canoe did not stop at coast")
assert_equal(land, u2.region, "canoe did not stop at coast")
u1:add_order("NACH O O O")
process_orders()
assert_equal(u2.region.id, dst.id, "canoe could not leave coast")
assert_equal(dst, sh.region, "canoe could not leave coast")
assert_equal(dst, u1.region, "canoe could not leave coast")
assert_equal(dst, u2.region, "canoe could not leave coast")
end
function test_give_50_percent_of_money()
eressea.settings.set("rules.economy.food", "4")
local r = region.create(0, 0, "plain")
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)

View File

@ -3,11 +3,12 @@ project (server C)
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
ELSE(CMAKE_COMPILER_IS_GNUCC)
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
find_package (Lua51 REQUIRED)
find_package (Lua 5 REQUIRED)
find_package (LibXml2 REQUIRED)
find_package (SQLite3 REQUIRED)
find_package (ToLua REQUIRED)
@ -46,5 +47,6 @@ target_link_libraries(server
${ERESSEA_LIBRARY}
${BINDINGS_LIBRARY}
${TOLUA_LIBRARIES}
${LUA_LIBRARIES}
${SQLITE3_LIBRARIES}
)

View File

@ -212,7 +212,7 @@ static int wall_age(connection * b)
}
static region *wall_move(const connection * b, struct unit *u,
struct region *from, struct region *to, boolean routing)
struct region *from, struct region *to, bool routing)
{
wall_data *fd = (wall_data *) b->data.v;
if (!routing && fd->active) {

View File

@ -16,7 +16,7 @@ extern "C" {
typedef struct wall_data {
struct unit *mage;
int force;
boolean active;
bool active;
int countdown;
} wall_data;

View File

@ -245,7 +245,7 @@ static direction_t richest_neighbour(region * r, faction * f, int absolut)
return d;
}
static boolean room_for_race_in_region(region * r, const race * rc)
static bool room_for_race_in_region(region * r, const race * rc)
{
unit *u;
int c = 0;
@ -428,7 +428,7 @@ static attrib *set_new_dragon_target(unit * u, region * r, int range)
}
static order *make_movement_order(unit * u, const region * target, int moves,
boolean(*allowed) (const region *, const region *))
bool(*allowed) (const region *, const region *))
{
region *r = u->region;
region **plan;
@ -593,7 +593,7 @@ static order *monster_learn(unit * u)
return NULL;
}
static boolean check_overpopulated(unit * u)
static bool check_overpopulated(unit * u)
{
unit *u2;
int c = 0;
@ -643,7 +643,7 @@ static order *plan_dragon(unit * u)
attrib *ta = a_find(u->attribs, &at_targetregion);
region *r = u->region;
region *tr = NULL;
boolean move = false;
bool move = false;
order *long_order = NULL;
reduce_weight(u);
@ -748,7 +748,7 @@ void plan_monsters(faction * f)
for (r = regions; r; r = r->next) {
unit *u;
double attack_chance = MONSTERATTACK;
boolean attacking = false;
bool attacking = false;
for (u = r->units; u; u = u->next) {
attrib *ta;

View File

@ -324,7 +324,7 @@ int sp_combatrosthauch(struct castorder * co)
int n = MIN(force, wp->used);
if (n) {
requirement *mat = wp->type->itype->construction->materials;
boolean iron = false;
bool iron = false;
while (mat && mat->number > 0) {
if (mat->rtype == oldresourcetype[R_IRON]) {
iron = true;
@ -454,7 +454,7 @@ int sp_speed(struct castorder * co)
return 1;
}
static skill_t random_skill(unit * u, boolean weighted)
static skill_t random_skill(unit * u, bool weighted)
{
int n = 0;
skill *sv;
@ -909,7 +909,7 @@ int sp_strong_wall(struct castorder * co)
unit *mage = fi->unit;
building *burg;
double effect;
static boolean init = false;
static bool init = false;
message *msg;
static const curse_type *strongwall_ct;
if (!init) {
@ -1539,7 +1539,7 @@ int sp_reanimate(struct castorder * co)
int healable, j = 0;
double c = 0.50 + 0.02 * power;
double k = EFFECT_HEALING_SPELL * power;
boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
bool use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
message *msg;
if (use_item) {
@ -1605,7 +1605,7 @@ int sp_keeploot(struct castorder * co)
return level;
}
static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters)
static int heal_fighters(quicklist * fgs, int *power, bool heal_monsters)
{
int healhp = *power, healed = 0, qi;
quicklist *ql;
@ -1658,7 +1658,7 @@ int sp_healing(struct castorder * co)
int healhp = (int)power * 200;
quicklist *fgs;
message *msg;
boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
bool use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
/* bis zu 11 Personen pro Stufe (einen HP müssen sie ja noch
* haben, sonst wären sie tot) können geheilt werden */

View File

@ -134,7 +134,7 @@ static double curse_chance(const struct curse *c, double force)
static void magicanalyse_region(region * r, unit * mage, double force)
{
attrib *a;
boolean found = false;
bool found = false;
for (a = r->attribs; a; a = a->next) {
curse *c = (curse *) a->data.v;
@ -173,7 +173,7 @@ static void magicanalyse_region(region * r, unit * mage, double force)
static void magicanalyse_unit(unit * u, unit * mage, double force)
{
attrib *a;
boolean found = false;
bool found = false;
for (a = u->attribs; a; a = a->next) {
curse *c;
@ -211,7 +211,7 @@ static void magicanalyse_unit(unit * u, unit * mage, double force)
static void magicanalyse_building(building * b, unit * mage, double force)
{
attrib *a;
boolean found = false;
bool found = false;
for (a = b->attribs; a; a = a->next) {
curse *c;
@ -251,7 +251,7 @@ static void magicanalyse_building(building * b, unit * mage, double force)
static void magicanalyse_ship(ship * sh, unit * mage, double force)
{
attrib *a;
boolean found = false;
bool found = false;
for (a = sh->attribs; a; a = a->next) {
curse *c;
@ -1581,7 +1581,7 @@ static void destroy_all_roads(region * r)
static int sp_great_drought(castorder * co)
{
unit *u;
boolean terraform = false;
bool terraform = false;
region *r = co_get_region(co);
unit *mage = co->magician.u;
int cast_level = co->level;
@ -3017,7 +3017,7 @@ static int sp_summonshadowlords(castorder * co)
return cast_level;
}
static boolean chaosgate_valid(const connection * b)
static bool chaosgate_valid(const connection * b)
{
const attrib *a = a_findc(b->from->attribs, &at_direction);
if (!a)
@ -3028,7 +3028,7 @@ static boolean chaosgate_valid(const connection * b)
}
struct region *chaosgate_move(const connection * b, struct unit *u,
struct region *from, struct region *to, boolean routing)
struct region *from, struct region *to, bool routing)
{
if (!routing) {
int maxhp = u->hp / 4;
@ -3421,7 +3421,7 @@ static int sp_analysesong_unit(castorder * co)
return cast_level;
}
static boolean can_charm(const unit * u, int maxlevel)
static bool can_charm(const unit * u, int maxlevel)
{
const skill_t expskills[] =
{ SK_ALCHEMY, SK_HERBALISM, SK_MAGIC, SK_SPY, SK_TACTICS, NOSKILL };
@ -4025,7 +4025,7 @@ static int sp_pump(castorder * co)
{
unit *u, *target;
region *rt;
boolean see = false;
bool see = false;
unit *mage = co->magician.u;
spellparameter *pa = co->par;
int cast_level = co->level;