configuration type-fixes: int to bool where appropriate (possibly incomplete)

rename some rules to make it more obvious that they are flags or other integer values.
This commit is contained in:
Enno Rehling 2015-09-11 10:04:08 +02:00
parent 1a9dd531c5
commit cf08cdf3fb
23 changed files with 118 additions and 121 deletions

View File

@ -19,7 +19,7 @@
"seed.population.max": 8, "seed.population.max": 8,
"rules.ship.damage_drift": 0.00, "rules.ship.damage_drift": 0.00,
"rules.reserve.twophase": true, "rules.reserve.twophase": true,
"rules.give.max_men": "-1", "rules.give.max_men": -1,
"rules.check_overload": false, "rules.check_overload": false,
"rules.limit.faction": 2500, "rules.limit.faction": 2500,
"rules.maxskills.magic": 5, "rules.maxskills.magic": 5,

View File

@ -7,9 +7,9 @@
"game.name": "E3", "game.name": "E3",
"database.gameid": 7, "database.gameid": 7,
"NewbieImmunity": 4, "NewbieImmunity": 4,
"modules.astralspace": 0, "modules.astralspace": false,
"modules.wormholes": 0, "modules.wormholes": false,
"modules.markets": 1, "modules.markets": true,
"magic.regeneration": 0.75, "magic.regeneration": 0.75,
"magic.power": 0.5, "magic.power": 0.5,
"resource.factor": 0.25, "resource.factor": 0.25,
@ -19,55 +19,54 @@
"nmr.timeout": 5, "nmr.timeout": 5,
"nmr.removenewbie": 0, "nmr.removenewbie": 0,
"GiveRestriction": 3, "GiveRestriction": 3,
"hunger.long": 0, "hunger.long": false,
"hunger.demon.skill": 1, "hunger.demon.skill": true,
"hunger.damage": "1d9+9", "hunger.damage": "1d9+9",
"hunger.demons": 1, "hunger.demons": true,
"init_spells": 0, "init_spells": 0,
"recruit.allow_merge": 1, "recruit.allow_merge": true,
"study.expensivemigrants": 1, "study.expensivemigrants": true,
"study.speedup": 2, "study.speedup": 2,
"world.era": 3, "world.era": 3,
"seed.population.min": 8, "seed.population.min": 8,
"seed.population.max": 8, "seed.population.max": 8,
"rules.migrants": 0, "rules.migrants.max": 0,
"rules.reserve.twophase": 1, "rules.reserve.twophase": true,
"rules.owners.force_leave": 0, "rules.owners.force_leave": false,
"rules.monsters.attack_chance": 0.0, "rules.monsters.attack_chance": 0.0,
"rules.transfermen": 0, "rules.transfermen": false,
"rules.stealth.faction": 1, "rules.stealth.faction": true,
"rules.stealth.anon_battle": 0, "rules.stealth.anon_battle": false,
"rules.check_overload": 0, "rules.check_overload": false,
"rules.combat.goblinbonus": 3, "rules.combat.goblinbonus": 3,
"rules.ship.damage_drift": 0.00, "rules.ship.damage_drift": 0.00,
"rules.alliances": 1, "rules.alliances": true,
"rules.combat.herospeed": 3, "rules.combat.herospeed": 3,
"rules.combat.demon_vampire": 5, "rules.combat.demon_vampire": 5,
"rules.combat.skill_bonus": 0, "rules.combat.skill_bonus": 0,
"rules.combat.nat_armor": 1, "rules.combat.nat_armor": 1,
"rules.items.loot_divisor": 2, "rules.items.loot_divisor": 2,
"rules.items.give_divisor": 2, "rules.items.give_divisor": 2,
"rules.move.owner_leave": 1, "rules.move.owner_leave": true,
"rules.region_owners": 1, "rules.region_owners": true,
"rules.cavalry.skill": 2, "rules.cavalry.skill": 2,
"rules.cavalry.mode": 1, "rules.cavalry.mode": 1,
"rules.magic.multipotion": 1, "rules.magic.multipotion": 1,
"rules.magic.wol_effect": 5, "rules.magic.wol_effect": 5,
"rules.magic.factionlist": 1, "rules.magic.factionlist": 1,
"rules.magic.wol_type": 2, "rules.magic.wol_type": 2,
"rules.magic.blessed_harvest": 1, "rules.blessed_harvest.flags": 1,
"rules.magic.elfpower": 1, "rules.magic.elfpower": true,
"rules.magic.playerschools": "gwyrrd illaun draig cerddor", "rules.magic.playerschools": "gwyrrd illaun draig cerddor",
"rules.build.other_buildings": 1, "rules.build.other_buildings": true,
"rules.economy.taxation": 1, "rules.economy.taxation": 1,
"rules.economy.food": 2, "rules.food.flags": 2,
"rules.economy.wages": 1,
"rules.economy.roqf": 5, "rules.economy.roqf": 5,
"rules.economy.herbrot": 0, "rules.economy.herbrot": 0,
"rules.region_owner_pay_building": "market harbour lighthouse", "rules.region_owner_pay_building": "market harbour lighthouse",
"rules.dwarf_castles": 1, "rules.dwarf_castles": true,
"rules.limit.faction": 250, "rules.limit.faction": 250,
"rules.economy.grow": 1, "rules.grow.formula": 1,
"rules.tactics.formula": 1, "rules.tactics.formula": 1,
"rules.help.mask": "fight guard money give", "rules.help.mask": "fight guard money give",
"movement.shipspeed.skillbonus": 6, "movement.shipspeed.skillbonus": 6,

View File

@ -7,9 +7,9 @@
"game.name": "Deveron", "game.name": "Deveron",
"database.gameid": 7, "database.gameid": 7,
"NewbieImmunity": 4, "NewbieImmunity": 4,
"modules.astralspace": 0, "modules.astralspace": false,
"modules.wormholes": 0, "modules.wormholes": false,
"modules.markets": 1, "modules.markets": true,
"magic.regeneration": 0.75, "magic.regeneration": 0.75,
"magic.power": 0.5, "magic.power": 0.5,
"resource.factor": 0.25, "resource.factor": 0.25,
@ -19,52 +19,51 @@
"nmr.timeout": 5, "nmr.timeout": 5,
"nmr.removenewbie": 0, "nmr.removenewbie": 0,
"GiveRestriction": 3, "GiveRestriction": 3,
"hunger.long": 0, "hunger.long": false,
"hunger.demon.skill": 1, "hunger.demon.skill": true,
"hunger.damage": "1d9+9", "hunger.damage": "1d9+9",
"hunger.demons": 1, "hunger.demons": true,
"init_spells": 0, "init_spells": 0,
"recruit.allow_merge": 1, "recruit.allow_merge": true,
"study.expensivemigrants": 1, "study.expensivemigrants": true,
"study.speedup": 2, "study.speedup": 2,
"world.era": 3, "world.era": 3,
"rules.migrants": 0, "rules.migrants.max": 0,
"rules.reserve.twophase": 1, "rules.reserve.twophase": true,
"rules.owners.force_leave": 0, "rules.owners.force_leave": false,
"rules.transfermen": 0, "rules.transfermen": false,
"rules.stealth.faction": 1, "rules.stealth.faction": true,
"rules.stealth.anon_battle": 0, "rules.stealth.anon_battle": false,
"rules.check_overload": 0, "rules.check_overload": false,
"rules.combat.goblinbonus": 3, "rules.combat.goblinbonus": 3,
"rules.ship.damage_drift": 0.00, "rules.ship.damage_drift": 0.00,
"rules.alliances": 1, "rules.alliances": true,
"rules.combat.herospeed": 3, "rules.combat.herospeed": 3,
"rules.combat.demon_vampire": 5, "rules.combat.demon_vampire": 5,
"rules.combat.skill_bonus": 0, "rules.combat.skill_bonus": 0,
"rules.combat.nat_armor": 1, "rules.combat.nat_armor": true,
"rules.items.loot_divisor": 2, "rules.items.loot_divisor": 2,
"rules.items.give_divisor": 2, "rules.items.give_divisor": 2,
"rules.move.owner_leave": 1, "rules.move.owner_leave": true,
"rules.region_owners": 1, "rules.region_owners": true,
"rules.cavalry.skill": 2, "rules.cavalry.skill": 2,
"rules.cavalry.mode": 1, "rules.cavalry.mode": 1,
"rules.magic.multipotion": 1, "rules.magic.multipotion": true,
"rules.magic.wol_effect": 5, "rules.magic.wol_effect": 5,
"rules.magic.factionlist": 1, "rules.magic.factionlist": true,
"rules.magic.wol_type": 2, "rules.magic.wol_type": 2,
"rules.magic.blessed_harvest": 1, "rules.blessed_harvest.flags": 1,
"rules.magic.elfpower": 1, "rules.magic.elfpower": true,
"rules.magic.playerschools": "gwyrrd illaun draig cerddor", "rules.magic.playerschools": "gwyrrd illaun draig cerddor",
"rules.build.other_buildings": 1, "rules.build.other_buildings": 1,
"rules.economy.taxation": 1, "rules.economy.taxation": 1,
"rules.economy.food": 2, "rules.food.flags": 2,
"rules.economy.wages": 1,
"rules.economy.roqf": 5, "rules.economy.roqf": 5,
"rules.economy.herbrot": 0, "rules.economy.herbrot": 0,
"rules.region_owner_pay_building": "market harbour lighthouse", "rules.region_owner_pay_building": "market harbour lighthouse",
"rules.dwarf_castles": 1, "rules.dwarf_castles": true,
"rules.limit.faction": 250, "rules.limit.faction": 250,
"rules.economy.grow": 1, "rules.grow.formula": 1,
"rules.tactics.formula": 1, "rules.tactics.formula": 1,
"rules.help.mask": "fight guard money give", "rules.help.mask": "fight guard money give",
"movement.shipspeed.skillbonus": 6, "movement.shipspeed.skillbonus": 6,

View File

@ -28,7 +28,7 @@ function setup()
eressea.free_game() eressea.free_game()
eressea.settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0") eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.encounters", "0") eressea.settings.set("rules.encounters", "0")
eressea.settings.set("rules.peasants.growth", "1") eressea.settings.set("rules.peasants.growth", "1")
eressea.settings.set("study.random_progress", "0") eressea.settings.set("study.random_progress", "0")
@ -92,7 +92,7 @@ function test_demon_food()
local u = unit.create(f, r, 1) local u = unit.create(f, r, 1)
local p = r:get_resource("peasant") local p = r:get_resource("peasant")
r:set_resource("peasant", 2000) r:set_resource("peasant", 2000)
eressea.settings.set("rules.economy.food", "0") eressea.settings.set("rules.food.flags", "0")
eressea.settings.set("rules.peasants.growth", "0") eressea.settings.set("rules.peasants.growth", "0")
process_orders() process_orders()
assert_not_nil(u) assert_not_nil(u)
@ -460,7 +460,7 @@ function test_work()
end end
function test_upkeep() function test_upkeep()
eressea.settings.set("rules.economy.food", "0") eressea.settings.set("rules.food.flags", "0")
local r = region.create(0, 0, "plain") local r = region.create(0, 0, "plain")
local f = faction.create("noreply10@eressea.de", "human", "de") local f = faction.create("noreply10@eressea.de", "human", "de")
local u = unit.create(f, r, 5) local u = unit.create(f, r, 5)
@ -782,7 +782,7 @@ function test_food_is_consumed()
u:add_item("money", 100) u:add_item("money", 100)
u:clear_orders() u:clear_orders()
u:add_order("LERNEN Reiten") -- don't work u:add_order("LERNEN Reiten") -- don't work
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
process_orders() process_orders()
assert_equal(100, u:get_item("money")) assert_equal(100, u:get_item("money"))
end end
@ -794,7 +794,7 @@ function test_food_can_override()
u:add_item("money", 100) u:add_item("money", 100)
u:clear_orders() u:clear_orders()
u:add_order("LERNEN Reiten") -- don't work u:add_order("LERNEN Reiten") -- don't work
eressea.settings.set("rules.economy.food", "0") eressea.settings.set("rules.food.flags", "0")
process_orders() process_orders()
assert_equal(90, u:get_item("money")) assert_equal(90, u:get_item("money"))
end end
@ -921,7 +921,7 @@ module("tests.recruit", package.seeall, lunit.testcase)
function setup() function setup()
eressea.free_game() eressea.free_game()
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.peasants.growth", "0") eressea.settings.set("rules.peasants.growth", "0")
end end
@ -962,7 +962,7 @@ module("tests.report", package.seeall, lunit.testcase)
function setup() function setup()
eressea.free_game() eressea.free_game()
eressea.settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
end end
local function find_in_report(f, pattern, extension) local function find_in_report(f, pattern, extension)
@ -1062,7 +1062,7 @@ module("tests.parser", package.seeall, lunit.testcase)
function setup() function setup()
eressea.free_game() eressea.free_game()
eressea.settings.set("rules.economy.food", "4") -- FOOD_IS_FREE eressea.settings.set("rules.food.flags", "4") -- FOOD_IS_FREE
eressea.settings.set("rules.encounters", "0") eressea.settings.set("rules.encounters", "0")
eressea.settings.set("rules.move.owner_leave", "0") eressea.settings.set("rules.move.owner_leave", "0")
end end

View File

@ -22,7 +22,7 @@ end
function setup() function setup()
eressea.free_game() eressea.free_game()
eressea.settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.ship.storms", "0") eressea.settings.set("rules.ship.storms", "0")
end end

View File

@ -6,7 +6,7 @@ function setup()
eressea.free_game() eressea.free_game()
eressea.settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0") eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
end end
function test_guard_unarmed() function test_guard_unarmed()

View File

@ -7,7 +7,7 @@ function setup()
eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0") eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
end end
function test_shapeshift() function test_shapeshift()

View File

@ -18,7 +18,7 @@ end
function setup() function setup()
eressea.game.reset() eressea.game.reset()
set_rule('rules.economy.food', '4') set_rule('rules.food.flags', '4')
set_rule('rules.magic.playerschools', '') set_rule('rules.magic.playerschools', '')
local r = region.create(0,0, "plain") local r = region.create(0,0, "plain")
@ -28,7 +28,7 @@ function setup()
end end
function teardown() function teardown()
set_rule('rules.economy.food') set_rule('rules.food.flags')
set_rule('rules.magic.playerschools') set_rule('rules.magic.playerschools')
set_rule('rules.stealth.faction') set_rule('rules.stealth.faction')
end end

View File

@ -17,14 +17,14 @@ function setup()
eressea.game.reset() eressea.game.reset()
settings = {} settings = {}
set_rule("rules.move.owner_leave", "1") set_rule("rules.move.owner_leave", "1")
set_rule("rules.economy.food", "4") set_rule("rules.food.flags", "4")
set_rule("rules.ship.drifting", "0") set_rule("rules.ship.drifting", "0")
set_rule("rules.ship.storms", "0") set_rule("rules.ship.storms", "0")
end end
function teardown() function teardown()
set_rule("rules.move.owner_leave") set_rule("rules.move.owner_leave")
set_rule("rules.economy.food") set_rule("rules.food.flags")
set_rule("rules.ship.drifting") set_rule("rules.ship.drifting")
set_rule("rules.ship.storms") set_rule("rules.ship.storms")
end end
@ -221,7 +221,7 @@ function test_xmastree()
end end
function test_fishing() function test_fishing()
eressea.settings.set("rules.economy.food", "0") eressea.settings.set("rules.food.flags", "0")
local r = region.create(0,0, "ocean") local r = region.create(0,0, "ocean")
local r2 = region.create(1,0, "plain") local r2 = region.create(1,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de") local f = faction.create("noreply@eressea.de", "human", "de")

View File

@ -8,7 +8,7 @@ function setup()
eressea.free_game() eressea.free_game()
eressea.settings.set("magic.regeneration.enable", "0") eressea.settings.set("magic.regeneration.enable", "0")
eressea.settings.set("magic.fumble.enable", "0") eressea.settings.set("magic.fumble.enable", "0")
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
r = region.create(0, 0, "plain") r = region.create(0, 0, "plain")
f = faction.create("spell_payment@eressea.de", "elf", "de") f = faction.create("spell_payment@eressea.de", "elf", "de")

View File

@ -7,7 +7,7 @@ local u
function setup() function setup()
eressea.game.reset() eressea.game.reset()
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
local r = region.create(0,0, "plain") local r = region.create(0,0, "plain")
f = faction.create("stealth1@eressea.de", "human", "de") f = faction.create("stealth1@eressea.de", "human", "de")

View File

@ -15,7 +15,7 @@ function setup()
f = _G.faction.create("noreply@eressea.de", "human", "de") f = _G.faction.create("noreply@eressea.de", "human", "de")
u = _G.unit.create(f, r, 1) u = _G.unit.create(f, r, 1)
u:clear_orders() u:clear_orders()
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0") eressea.settings.set("NewbieImmunity", "0")
end end

View File

@ -5,7 +5,7 @@ module("tests.eressea.pool", package.seeall, lunit.testcase )
function setup() function setup()
eressea.game.reset() eressea.game.reset()
eressea.config.reset() eressea.config.reset()
eressea.settings.set("rules.economy.food", "0") eressea.settings.set("rules.food.flags", "0")
eressea.settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.magic.playerschools", "") eressea.settings.set("rules.magic.playerschools", "")
conf = [[{ conf = [[{

View File

@ -17,7 +17,7 @@ function setup()
eressea.game.reset() eressea.game.reset()
eressea.config.reset(); eressea.config.reset();
eressea.settings.set('rules.magic.playerschools', '') eressea.settings.set('rules.magic.playerschools', '')
eressea.settings.set("rules.economy.food", "4") eressea.settings.set("rules.food.flags", "4")
eressea.settings.set('study.random_progress', '0') eressea.settings.set('study.random_progress', '0')
eressea.config.parse(conf) eressea.config.parse(conf)
end end

View File

@ -3210,7 +3210,7 @@ side * find_side(battle * b, const faction * f, const group * g, unsigned int fl
if (s->faction == f && s->group == g) { if (s->faction == f && s->group == g) {
unsigned int s1flags = flags | SIDE_HASGUARDS; unsigned int s1flags = flags | SIDE_HASGUARDS;
unsigned int s2flags = s->flags | SIDE_HASGUARDS; unsigned int s2flags = s->flags | SIDE_HASGUARDS;
if (rule_anon_battle && s->stealthfaction != stealthfaction) { if (rule_anon_battle!=0 && s->stealthfaction != stealthfaction) {
continue; continue;
} }
if (s1flags == s2flags) { if (s1flags == s2flags) {

View File

@ -611,7 +611,7 @@ int count_maxmigrants(const faction * f)
static int migrants = -1; static int migrants = -1;
if (migrants < 0) { if (migrants < 0) {
migrants = get_param_int(global.parameters, "rules.migrants", INT_MAX); migrants = get_param_int(global.parameters, "rules.migrants.max", INT_MAX);
} }
if (migrants == INT_MAX) { if (migrants == INT_MAX) {
int x = 0; int x = 0;
@ -1404,19 +1404,19 @@ int cmp_current_owner(const building * b, const building * a)
return -1; return -1;
} }
int rule_stealth_faction(void) bool rule_stealth_faction(void)
{ {
static int gamecookie = -1; static int gamecookie = -1;
static int rule = -1; static int rule = -1;
if (rule < 0 || gamecookie != global.cookie) { if (rule < 0 || gamecookie != global.cookie) {
rule = get_param_int(global.parameters, "rules.stealth.faction", 0xFF); rule = get_param_int(global.parameters, "rules.stealth.faction", 1);
gamecookie = global.cookie; gamecookie = global.cookie;
assert(rule >= 0); assert(rule >= 0);
} }
return rule; return rule!=0;
} }
int rule_region_owners(void) bool rule_region_owners(void)
{ {
static int gamecookie = -1; static int gamecookie = -1;
static int rule = -1; static int rule = -1;
@ -1425,7 +1425,7 @@ int rule_region_owners(void)
gamecookie = global.cookie; gamecookie = global.cookie;
assert(rule >= 0); assert(rule >= 0);
} }
return rule; return rule!=0;
} }
int rule_auto_taxation(void) int rule_auto_taxation(void)
@ -1447,7 +1447,7 @@ int rule_blessed_harvest(void)
static int rule = -1; static int rule = -1;
if (rule < 0 || gamecookie != global.cookie) { if (rule < 0 || gamecookie != global.cookie) {
rule = rule =
get_param_int(global.parameters, "rules.magic.blessed_harvest", get_param_int(global.parameters, "rules.blessed_harvest.flags",
HARVEST_WORK); HARVEST_WORK);
gamecookie = global.cookie; gamecookie = global.cookie;
assert(rule >= 0); assert(rule >= 0);
@ -1479,7 +1479,7 @@ int rule_faction_limit(void)
return rule; return rule;
} }
int rule_transfermen(void) bool rule_transfermen(void)
{ {
static int gamecookie = -1; static int gamecookie = -1;
static int rule = -1; static int rule = -1;
@ -1488,7 +1488,7 @@ int rule_transfermen(void)
gamecookie = global.cookie; gamecookie = global.cookie;
assert(rule >= 0); assert(rule >= 0);
} }
return rule; return rule!=0;
} }
static int static int

View File

@ -151,18 +151,26 @@ extern "C" {
int cmp_current_owner(const struct building *b, int cmp_current_owner(const struct building *b,
const struct building *bother); const struct building *bother);
#define TAX_ORDER 0x00 bool rule_transfermen(void);
#define TAX_OWNER 0x01 bool rule_region_owners(void);
int rule_auto_taxation(void); bool rule_stealth_faction(void);
int rule_transfermen(void); int rule_alliance_limit(void);
int rule_region_owners(void); int rule_faction_limit(void);
int rule_stealth_faction(void);
#define HARVEST_WORK 0x00 #define HARVEST_WORK 0x00
#define HARVEST_TAXES 0x01 #define HARVEST_TAXES 0x01
int rule_blessed_harvest(void); int rule_blessed_harvest(void);
#define TAX_ORDER 0x00
#define TAX_OWNER 0x01
int rule_auto_taxation(void);
#define GIVE_SELF 1
#define GIVE_PEASANTS 2
#define GIVE_LUXURIES 4
#define GIVE_HERBS 8
#define GIVE_GOODS 16
#define GIVE_ONDEATH 32
#define GIVE_ALLITEMS (GIVE_GOODS|GIVE_HERBS|GIVE_LUXURIES)
#define GIVE_DEFAULT (GIVE_SELF|GIVE_PEASANTS|GIVE_LUXURIES|GIVE_HERBS|GIVE_GOODS)
int rule_give(void); int rule_give(void);
int rule_alliance_limit(void);
int rule_faction_limit(void);
#define COUNT_MONSTERS 0x01 #define COUNT_MONSTERS 0x01
#define COUNT_MIGRANTS 0x02 #define COUNT_MIGRANTS 0x02
@ -296,15 +304,6 @@ extern "C" {
void free_gamedata(void); void free_gamedata(void);
#define GIVE_SELF 1
#define GIVE_PEASANTS 2
#define GIVE_LUXURIES 4
#define GIVE_HERBS 8
#define GIVE_GOODS 16
#define GIVE_ONDEATH 32
#define GIVE_ALLITEMS (GIVE_GOODS|GIVE_HERBS|GIVE_LUXURIES)
#define GIVE_DEFAULT (GIVE_SELF|GIVE_PEASANTS|GIVE_LUXURIES|GIVE_HERBS|GIVE_GOODS)
extern struct attrib_type at_guard; extern struct attrib_type at_guard;
extern struct helpmode helpmodes[]; extern struct helpmode helpmodes[];
extern const char *parameters[]; extern const char *parameters[];

View File

@ -858,7 +858,7 @@ bool can_leave(unit * u)
rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0); rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0);
} }
if (rule_leave && u->building && u == building_owner(u->building)) { if (rule_leave!=0 && u->building && u == building_owner(u->building)) {
return false; return false;
} }
return true; return true;

View File

@ -793,7 +793,7 @@ void demographics(void)
if (plant_rules < 0) { if (plant_rules < 0) {
plant_rules = plant_rules =
get_param_int(global.parameters, "rules.economy.grow", 0); get_param_int(global.parameters, "rules.grow.formula", 0);
} }
for (dmd = r->land->demands; dmd; dmd = dmd->next) { for (dmd = r->land->demands; dmd; dmd = dmd->next) {
if (dmd->value > 0 && dmd->value < MAXDEMAND) { if (dmd->value > 0 && dmd->value < MAXDEMAND) {

View File

@ -213,14 +213,14 @@ static void free_mage(attrib * a)
free(mage); free(mage);
} }
int FactionSpells(void) bool FactionSpells(void)
{ {
static int rules_factionspells = -1; static int rules_factionspells = -1;
if (rules_factionspells < 0) { if (rules_factionspells < 0) {
rules_factionspells = rules_factionspells =
get_param_int(global.parameters, "rules.magic.factionlist", 0); get_param_int(global.parameters, "rules.magic.factionlist", 0);
} }
return rules_factionspells; return rules_factionspells!=0;
} }
void read_spells(struct quicklist **slistp, magic_t mtype, void read_spells(struct quicklist **slistp, magic_t mtype,

View File

@ -346,23 +346,23 @@ extern "C" {
extern void create_newclone(struct unit *mage, struct unit *familiar); extern void create_newclone(struct unit *mage, struct unit *familiar);
extern struct unit *has_clone(struct unit *mage); extern struct unit *has_clone(struct unit *mage);
extern const char *spell_info(const struct spell *sp, const char *spell_info(const struct spell *sp,
const struct locale *lang); const struct locale *lang);
extern const char *spell_name(const struct spell *sp, const char *spell_name(const struct spell *sp,
const struct locale *lang); const struct locale *lang);
extern const char *curse_name(const struct curse_type *ctype, const char *curse_name(const struct curse_type *ctype,
const struct locale *lang); const struct locale *lang);
extern struct message *msg_unitnotfound(const struct unit *mage, struct message *msg_unitnotfound(const struct unit *mage,
struct order *ord, const struct spllprm *spobj); struct order *ord, const struct spllprm *spobj);
extern int FactionSpells(void); bool FactionSpells(void);
extern void write_spells(struct quicklist *slist, struct storage *store); void write_spells(struct quicklist *slist, struct storage *store);
extern void read_spells(struct quicklist **slistp, magic_t mtype, void read_spells(struct quicklist **slistp, magic_t mtype,
struct storage *store); struct storage *store);
extern struct spellbook * get_spellbook(const char * name); struct spellbook * get_spellbook(const char * name);
extern void free_spellbooks(void); void free_spellbooks(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -121,7 +121,7 @@ void get_food(region * r)
if (food_rules < 0 || gamecookie != global.cookie) { if (food_rules < 0 || gamecookie != global.cookie) {
gamecookie = global.cookie; gamecookie = global.cookie;
food_rules = get_param_int(global.parameters, "rules.economy.food", 0); food_rules = get_param_int(global.parameters, "rules.food.flags", 0);
} }
if (food_rules & FOOD_IS_FREE) { if (food_rules & FOOD_IS_FREE) {

View File

@ -32,7 +32,7 @@ void test_upkeep_default(CuTest * tc)
u2 = test_create_unit(f2, r); u2 = test_create_unit(f2, r);
assert(r && u1 && u2); assert(r && u1 && u2);
set_param(&global.parameters, "rules.economy.food", "0"); set_param(&global.parameters, "rules.food.flags", "0");
i_change(&u1->items, i_silver, 20); i_change(&u1->items, i_silver, 20);
get_food(r); get_food(r);
// since u1 and u2 are not allied, u1 should not help u2 with upkeep // since u1 and u2 are not allied, u1 should not help u2 with upkeep
@ -60,7 +60,7 @@ void test_upkeep_hunger_damage(CuTest * tc)
u1 = test_create_unit(f1, r); u1 = test_create_unit(f1, r);
assert(r && u1); assert(r && u1);
set_param(&global.parameters, "rules.economy.food", "0"); set_param(&global.parameters, "rules.food.flags", "0");
u1->hp = 100; u1->hp = 100;
get_food(r); get_food(r);
// since u1 and u2 are not allied, u1 should not help u2 with upkeep // since u1 and u2 are not allied, u1 should not help u2 with upkeep
@ -86,7 +86,7 @@ void test_upkeep_from_pool(CuTest * tc)
u2 = test_create_unit(u1->faction, r); u2 = test_create_unit(u1->faction, r);
assert(r && u1 && u2); assert(r && u1 && u2);
set_param(&global.parameters, "rules.economy.food", "0"); set_param(&global.parameters, "rules.food.flags", "0");
i_change(&u1->items, i_silver, 30); i_change(&u1->items, i_silver, 30);
get_food(r); get_food(r);
CuAssertIntEquals(tc, 10, i_get(u1->items, i_silver)); CuAssertIntEquals(tc, 10, i_get(u1->items, i_silver));
@ -122,7 +122,7 @@ void test_upkeep_from_friend(CuTest * tc)
u2 = test_create_unit(f2, r); u2 = test_create_unit(f2, r);
assert(r && u1 && u2); assert(r && u1 && u2);
set_param(&global.parameters, "rules.economy.food", "0"); set_param(&global.parameters, "rules.food.flags", "0");
i_change(&u1->items, i_silver, 30); i_change(&u1->items, i_silver, 30);
get_food(r); get_food(r);
CuAssertIntEquals(tc, 10, i_get(u1->items, i_silver)); CuAssertIntEquals(tc, 10, i_get(u1->items, i_silver));
@ -151,7 +151,7 @@ void test_upkeep_free(CuTest * tc)
u = test_create_unit(test_create_faction(test_create_race("human")), r); u = test_create_unit(test_create_faction(test_create_race("human")), r);
assert(r && u); assert(r && u);
set_param(&global.parameters, "rules.economy.food", "4"); // FOOD_IS_FREE set_param(&global.parameters, "rules.food.flags", "4"); // FOOD_IS_FREE
get_food(r); get_food(r);
CuAssertIntEquals(tc, 0, i_get(u->items, i_silver)); CuAssertIntEquals(tc, 0, i_get(u->items, i_silver));
CuAssertIntEquals(tc, 0, fval(u, UFL_HUNGER)); CuAssertIntEquals(tc, 0, fval(u, UFL_HUNGER));