forked from github/server
remove the functions struct from settings (next: remove wage, too)
This commit is contained in:
parent
8cfcffc4aa
commit
8d8173def3
|
@ -811,8 +811,8 @@ minimum_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
|||
* die Bauern wenn f == NULL. */
|
||||
int wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||
{
|
||||
if (global.functions.wage) {
|
||||
return global.functions.wage(r, f, rc, in_turn);
|
||||
if (global.wage) {
|
||||
return global.wage(r, f, rc, in_turn);
|
||||
}
|
||||
return default_wage(r, f, rc, in_turn);
|
||||
}
|
||||
|
|
|
@ -796,7 +796,7 @@ bool config_token(const char *key, const char *tok) {
|
|||
}
|
||||
|
||||
void free_config(void) {
|
||||
global.functions.wage = NULL;
|
||||
global.wage = NULL;
|
||||
free_params(&configuration);
|
||||
++config_cache_key;
|
||||
}
|
||||
|
|
|
@ -110,10 +110,8 @@ extern "C" {
|
|||
typedef struct settings {
|
||||
struct attrib *attribs;
|
||||
void *vm_state;
|
||||
struct global_functions {
|
||||
int(*wage) (const struct region * r, const struct faction * f,
|
||||
const struct race * rc, int in_turn);
|
||||
} functions;
|
||||
} settings;
|
||||
|
||||
void set_param(struct param **p, const char *key, const char *value);
|
||||
|
|
|
@ -907,7 +907,7 @@ static int parse_rules(xmlDocPtr doc)
|
|||
}
|
||||
assert(propValue != NULL);
|
||||
if (strcmp((const char *)propValue, "wage") == 0) {
|
||||
global.functions.wage =
|
||||
global.wage =
|
||||
(int(*)(const struct region *, const struct faction *,
|
||||
const struct race *, int))fun;
|
||||
}
|
||||
|
|
|
@ -1452,7 +1452,7 @@ static void test_immigration(CuTest * tc)
|
|||
{
|
||||
region *r;
|
||||
double inject[] = { 1 };
|
||||
int (*old_wage)(const region*, const faction*, const race*, int) = global.functions.wage;
|
||||
int (*old_wage)(const region*, const faction*, const race*, int) = global.wage;
|
||||
|
||||
test_setup();
|
||||
r = test_create_region(0, 0, 0);
|
||||
|
@ -1472,10 +1472,10 @@ static void test_immigration(CuTest * tc)
|
|||
|
||||
random_source_inject_array(inject, 2);
|
||||
|
||||
global.functions.wage = low_wage;
|
||||
global.wage = low_wage;
|
||||
immigration();
|
||||
CuAssertIntEquals(tc, 2, rpeasants(r));
|
||||
global.functions.wage = old_wage;
|
||||
global.wage = old_wage;
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue