forked from github/server
add a config_token function to look for a token inside a list
This commit is contained in:
parent
a4cb5e2906
commit
edcd79d044
|
@ -731,7 +731,7 @@ static bool maintain(building * b, bool first)
|
|||
return false;
|
||||
}
|
||||
/* If the owner is the region owner, check if dontpay flag is set for the building where he is in */
|
||||
if (check_param(global.parameters, "rules.region_owner_pay_building", b->type->_name)) {
|
||||
if (config_token("rules.region_owner_pay_building", b->type->_name)) {
|
||||
if (fval(u->building, BLD_DONTPAY)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -591,7 +591,7 @@ static unit *building_owner_ex(const building * bld, const struct faction * last
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!heir && check_param(global.parameters, "rules.region_owner_pay_building", bld->type->_name)) {
|
||||
if (!heir && config_token("rules.region_owner_pay_building", bld->type->_name)) {
|
||||
if (rule_region_owners()) {
|
||||
u = building_owner(largestbuilding(bld->region, &cmp_taxes, false));
|
||||
}
|
||||
|
|
|
@ -1587,6 +1587,10 @@ double config_get_flt(const char *key, double def) {
|
|||
return get_param_flt(global.parameters, key, def);
|
||||
}
|
||||
|
||||
bool config_token(const char *key, const char *tok) {
|
||||
return !!check_param(global.parameters, key, tok);
|
||||
}
|
||||
|
||||
/** releases all memory associated with the game state.
|
||||
* call this function before calling read_game() to load a new game
|
||||
* if you have a previously loaded state in memory.
|
||||
|
|
|
@ -279,6 +279,7 @@ extern "C" {
|
|||
const char *config_get(const char *key);
|
||||
int config_get_int(const char *key, int def);
|
||||
double config_get_flt(const char *key, double def);
|
||||
bool config_token(const char *key, const char *tok);
|
||||
|
||||
bool ExpensiveMigrants(void);
|
||||
int NMRTimeout(void);
|
||||
|
|
|
@ -1397,7 +1397,7 @@ static void prepare_reports(void)
|
|||
}
|
||||
|
||||
/* Region owner get always the Lighthouse report */
|
||||
if (bt_lighthouse && check_param(global.parameters, "rules.region_owner_pay_building", bt_lighthouse->_name)) {
|
||||
if (bt_lighthouse && config_token("rules.region_owner_pay_building", bt_lighthouse->_name)) {
|
||||
for (b = rbuildings(r); b; b = b->next) {
|
||||
if (b && b->type == bt_lighthouse) {
|
||||
u = building_owner(b);
|
||||
|
|
Loading…
Reference in New Issue