forked from github/server
Merge branch 'ennorehling-feature/kill-maintenance' into develop
This commit is contained in:
commit
47e38d1e4a
|
@ -1085,7 +1085,6 @@ bool config_token(const char *key, const char *tok) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_config(void) {
|
void free_config(void) {
|
||||||
global.functions.maintenance = NULL;
|
|
||||||
global.functions.wage = NULL;
|
global.functions.wage = NULL;
|
||||||
free_params(&configuration);
|
free_params(&configuration);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,11 +161,9 @@ struct param;
|
||||||
void *vm_state;
|
void *vm_state;
|
||||||
int data_version; /* TODO: eliminate in favor of gamedata.version */
|
int data_version; /* TODO: eliminate in favor of gamedata.version */
|
||||||
struct _dictionary_ *inifile;
|
struct _dictionary_ *inifile;
|
||||||
|
|
||||||
struct global_functions {
|
struct global_functions {
|
||||||
int(*wage) (const struct region * r, const struct faction * f,
|
int(*wage) (const struct region * r, const struct faction * f,
|
||||||
const struct race * rc, int in_turn);
|
const struct race * rc, int in_turn);
|
||||||
int(*maintenance) (const struct unit * u);
|
|
||||||
} functions;
|
} functions;
|
||||||
} settings;
|
} settings;
|
||||||
|
|
||||||
|
|
|
@ -1980,11 +1980,6 @@ int maintenance_cost(const struct unit *u)
|
||||||
{
|
{
|
||||||
if (u == NULL)
|
if (u == NULL)
|
||||||
return MAINTENANCE;
|
return MAINTENANCE;
|
||||||
if (global.functions.maintenance) {
|
|
||||||
int retval = global.functions.maintenance(u);
|
|
||||||
if (retval >= 0)
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
return u_race(u)->maintenance * u->number;
|
return u_race(u)->maintenance * u->number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -898,9 +898,6 @@ static int parse_rules(xmlDocPtr doc)
|
||||||
(int(*)(const struct region *, const struct faction *,
|
(int(*)(const struct region *, const struct faction *,
|
||||||
const struct race *, int))fun;
|
const struct race *, int))fun;
|
||||||
}
|
}
|
||||||
else if (strcmp((const char *)propValue, "maintenance") == 0) {
|
|
||||||
global.functions.maintenance = (int(*)(const struct unit *))fun;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
log_error("unknown function for rule '%s'\n", (const char *)propValue);
|
log_error("unknown function for rule '%s'\n", (const char *)propValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,11 +349,6 @@ static void test_fishing_feeds_2_people(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 32, i_get(u->items, rtype->itype));
|
CuAssertIntEquals(tc, 32, i_get(u->items, rtype->itype));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int not_so_hungry(const unit * u)
|
|
||||||
{
|
|
||||||
return 6 * u->number;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_fishing_does_not_give_goblins_money(CuTest * tc)
|
static void test_fishing_does_not_give_goblins_money(CuTest * tc)
|
||||||
{
|
{
|
||||||
const resource_type *rtype;
|
const resource_type *rtype;
|
||||||
|
@ -374,7 +369,6 @@ static void test_fishing_does_not_give_goblins_money(CuTest * tc)
|
||||||
u_set_ship(u, sh);
|
u_set_ship(u, sh);
|
||||||
i_change(&u->items, rtype->itype, 42);
|
i_change(&u->items, rtype->itype, 42);
|
||||||
|
|
||||||
global.functions.maintenance = not_so_hungry;
|
|
||||||
scale_number(u, 2);
|
scale_number(u, 2);
|
||||||
sh->flags |= SF_FISHING;
|
sh->flags |= SF_FISHING;
|
||||||
get_food(r);
|
get_food(r);
|
||||||
|
|
Loading…
Reference in New Issue