From 68c448b3fbc805ccc3df93c9d93d125b8af0a1ae Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 12 Sep 2015 16:29:57 +0200 Subject: [PATCH] fix signature of callback --- conf/e4/config.json | 2 +- src/kernel/unit.c | 2 +- src/kernel/unit.h | 2 +- src/kernel/unit.test.c | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/conf/e4/config.json b/conf/e4/config.json index 894f6e3f9..831b973a8 100644 --- a/conf/e4/config.json +++ b/conf/e4/config.json @@ -29,7 +29,7 @@ "recruit.allow_merge": true, "study.expensivemigrants": true, "study.speedup": 2, - "study.from_use": 2, + "study.from_use": 0.4, "world.era": 3, "rules.migrants.max": 0, "rules.reserve.twophase": true, diff --git a/src/kernel/unit.c b/src/kernel/unit.c index df97d2f41..e44c024dd 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1938,7 +1938,7 @@ static double produceexp_chance(void) { return global.producexpchance; } -void produceexp_ex(struct unit *u, skill_t sk, int n, void(*learn)(unit *, skill_t, double)) +void produceexp_ex(struct unit *u, skill_t sk, int n, bool (*learn)(unit *, skill_t, double)) { if (n != 0 && playerrace(u_race(u))) { double chance = produceexp_chance(); diff --git a/src/kernel/unit.h b/src/kernel/unit.h index 7a2f3e80f..3aef7bd0f 100644 --- a/src/kernel/unit.h +++ b/src/kernel/unit.h @@ -163,7 +163,7 @@ extern "C" { int effskill(const struct unit *u, skill_t sk, const struct region *r); int SkillCap(skill_t sk); void produceexp(struct unit *u, skill_t sk, int n); - void produceexp_ex(struct unit *u, skill_t sk, int n, void(*learn)(unit *, skill_t, double)); + void produceexp_ex(struct unit *u, skill_t sk, int n, bool (*learn)(unit *, skill_t, double)); void set_level(struct unit *u, skill_t id, int level); int get_level(const struct unit *u, skill_t id); diff --git a/src/kernel/unit.test.c b/src/kernel/unit.test.c index 7106db7c2..93c1cb95d 100644 --- a/src/kernel/unit.test.c +++ b/src/kernel/unit.test.c @@ -352,14 +352,16 @@ static void test_age_familiar(CuTest *tc) { static CuTest *g_tc; -static void cb_learn_one(unit *u, skill_t sk, double chance) { +static bool cb_learn_one(unit *u, skill_t sk, double chance) { CuAssertIntEquals(g_tc, SK_ALCHEMY, sk); CuAssertDblEquals(g_tc, global.producexpchance / u->number, chance, 0.01); + return false; } -static void cb_learn_two(unit *u, skill_t sk, double chance) { +static bool cb_learn_two(unit *u, skill_t sk, double chance) { CuAssertIntEquals(g_tc, SK_ALCHEMY, sk); CuAssertDblEquals(g_tc, 2 * global.producexpchance / u->number, chance, 0.01); + return false; } static void test_produceexp(CuTest *tc) {