forked from github/server
fix signature of callback
This commit is contained in:
parent
d1686849e0
commit
68c448b3fb
|
@ -29,7 +29,7 @@
|
||||||
"recruit.allow_merge": true,
|
"recruit.allow_merge": true,
|
||||||
"study.expensivemigrants": true,
|
"study.expensivemigrants": true,
|
||||||
"study.speedup": 2,
|
"study.speedup": 2,
|
||||||
"study.from_use": 2,
|
"study.from_use": 0.4,
|
||||||
"world.era": 3,
|
"world.era": 3,
|
||||||
"rules.migrants.max": 0,
|
"rules.migrants.max": 0,
|
||||||
"rules.reserve.twophase": true,
|
"rules.reserve.twophase": true,
|
||||||
|
|
|
@ -1938,7 +1938,7 @@ static double produceexp_chance(void) {
|
||||||
return global.producexpchance;
|
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))) {
|
if (n != 0 && playerrace(u_race(u))) {
|
||||||
double chance = produceexp_chance();
|
double chance = produceexp_chance();
|
||||||
|
|
|
@ -163,7 +163,7 @@ extern "C" {
|
||||||
int effskill(const struct unit *u, skill_t sk, const struct region *r);
|
int effskill(const struct unit *u, skill_t sk, const struct region *r);
|
||||||
int SkillCap(skill_t sk);
|
int SkillCap(skill_t sk);
|
||||||
void produceexp(struct unit *u, skill_t sk, int n);
|
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);
|
void set_level(struct unit *u, skill_t id, int level);
|
||||||
int get_level(const struct unit *u, skill_t id);
|
int get_level(const struct unit *u, skill_t id);
|
||||||
|
|
|
@ -352,14 +352,16 @@ static void test_age_familiar(CuTest *tc) {
|
||||||
|
|
||||||
static CuTest *g_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);
|
CuAssertIntEquals(g_tc, SK_ALCHEMY, sk);
|
||||||
CuAssertDblEquals(g_tc, global.producexpchance / u->number, chance, 0.01);
|
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);
|
CuAssertIntEquals(g_tc, SK_ALCHEMY, sk);
|
||||||
CuAssertDblEquals(g_tc, 2 * global.producexpchance / u->number, chance, 0.01);
|
CuAssertDblEquals(g_tc, 2 * global.producexpchance / u->number, chance, 0.01);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_produceexp(CuTest *tc) {
|
static void test_produceexp(CuTest *tc) {
|
||||||
|
|
Loading…
Reference in New Issue