Merge branch 'master' into develop

This commit is contained in:
Enno Rehling 2019-02-02 21:17:23 +01:00
commit 0043690650
24 changed files with 117 additions and 126 deletions

View File

@ -533,10 +533,6 @@
<arg name="weight" type="int"/>
</type>
</message>
<message name="healall" section="events">
<type>
</type>
</message>
<message name="lucky_item" section="events">
<type>
<arg name="unit" type="unit"/>

View File

@ -71,9 +71,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Magier hat
msgid "error195"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Dorthin führt kein Weg.\""
msgid "healall"
msgstr "\"Ein Hauch des Lebens liegt über der Welt und alle Wesen fühlen sich frisch und erholt.\""
msgid "build_required"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Dafür braucht die Einheit $resources($required).\""

View File

@ -71,9 +71,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - The magician al
msgid "error195"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - There is no route leading there.\""
msgid "healall"
msgstr "\"Life itself touches the world and all beings are healed.\""
msgid "build_required"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - For this, the unit needs $resources($required).\""

View File

@ -33,8 +33,9 @@ set -e
[ -z $BUILD ] && BUILD=Debug ; export BUILD
# cppcheck_tests
s/cmake-init --db=sqlite
s/build
cd process
cd Debug
scan-build make
cd ../process
make
cd $ROOT
inifile

View File

@ -90,7 +90,7 @@ void herbsearch(unit * u, int max_take)
region * r = u->region;
int herbsfound;
const item_type *whichherb;
int effsk = effskill(u, SK_HERBALISM, 0);
int effsk = effskill(u, SK_HERBALISM, NULL);
int herbs = rherbs(r);
if (effsk == 0) {
@ -275,7 +275,7 @@ int change_effect(unit * u, const item_type * effect, int delta)
bool display_potions(struct unit *u)
{
int skill = effskill(u, SK_ALCHEMY, 0);
int skill = effskill(u, SK_ALCHEMY, NULL);
int c = 0;
const potion_type *ptype;
for (ptype = potiontypes; ptype != NULL; ptype = ptype->next) {

View File

@ -86,8 +86,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define CATAPULT_INITIAL_RELOAD 4 /* erster schuss in runde 1 + rng_int() % INITIAL */
#define BASE_CHANCE 70 /* 70% Basis-<EFBFBD>berlebenschance */
#define TDIFF_CHANGE 5 /* 5% h<EFBFBD>her pro Stufe */
#define BASE_CHANCE 70 /* 70% Basis-Ueberlebenschance */
#define TDIFF_CHANGE 5 /* 5% hoeher pro Stufe */
#define DAMAGE_QUOTIENT 2 /* damage += skilldiff/DAMAGE_QUOTIENT */
#define DEBUG_SELECT /* should be disabled if select_enemy works */
@ -589,12 +589,12 @@ weapon_skill(const weapon_type * wtype, const unit * u, bool attacking)
int skill;
if (wtype == NULL) {
skill = effskill(u, SK_WEAPONLESS, 0);
skill = effskill(u, SK_WEAPONLESS, NULL);
if (skill <= 0) {
/* wenn kein waffenloser kampf, dann den rassen-defaultwert */
if (u_race(u) == get_race(RC_ORC)) {
int sword = effskill(u, SK_MELEE, 0);
int spear = effskill(u, SK_SPEAR, 0);
int sword = effskill(u, SK_MELEE, NULL);
int spear = effskill(u, SK_SPEAR, NULL);
skill = MAX(sword, spear) - 3;
if (attacking) {
skill = MAX(skill, u_race(u)->at_default);
@ -639,7 +639,7 @@ weapon_skill(const weapon_type * wtype, const unit * u, bool attacking)
/* changed: if we own a weapon, we have at least a skill of 0 */
if (!i_canuse(u, wtype->itype))
return -1;
skill = effskill(u, wtype->skill, 0);
skill = effskill(u, wtype->skill, NULL);
if (skill > 0) {
if (attacking) {
skill += u_race(u)->at_bonus;
@ -674,7 +674,7 @@ static int CavalryBonus(const unit * u, troop enemy, int type)
}
else {
/* new rule, chargers in Eressea 1.1 */
int skl = effskill(u, SK_RIDING, 0);
int skl = effskill(u, SK_RIDING, NULL);
/* only half against trolls */
if (skl > 0) {
if (type == BONUS_SKILL) {
@ -987,7 +987,7 @@ int natural_armor(unit * du)
assert(rc);
an = rc_armor_bonus(rc);
if (an > 0) {
int sk = effskill(du, SK_STAMINA, 0);
int sk = effskill(du, SK_STAMINA, NULL);
return rc->armor + sk / an;
}
return rc->armor;
@ -2357,7 +2357,7 @@ static int horse_fleeing_bonus(const unit * u)
const item_type *it_horse, *it_elvenhorse, *it_charger;
int n1 = 0, n2 = 0, n3 = 0;
item *itm;
int skl = effskill(u, SK_RIDING, 0);
int skl = effskill(u, SK_RIDING, NULL);
const resource_type *rtype;
it_horse = ((rtype = get_resourcetype(R_HORSE)) != NULL) ? rtype->itype : 0;
@ -2388,7 +2388,7 @@ static int fleechance(unit * u)
int p = flee_chance_base; /* Fluchtwahrscheinlichkeit in % */
/* Einheit u versucht, dem Get<65>mmel zu entkommen */
p += (effskill(u, SK_STEALTH, 0) * flee_chance_skill_bonus);
p += (effskill(u, SK_STEALTH, NULL) * flee_chance_skill_bonus);
p += horse_fleeing_bonus(u);
if (u_race(u) == get_race(RC_HALFLING)) {
@ -3097,7 +3097,7 @@ fighter *make_fighter(battle * b, unit * u, side * s1, bool attack)
region *r = b->region;
item *itm;
fighter *fig = NULL;
int h, i, tactics = effskill(u, SK_TACTICS, 0);
int h, i, tactics = effskill(u, SK_TACTICS, NULL);
int berserk;
int strongmen;
int speeded = 0, speed = 1;
@ -3329,17 +3329,17 @@ fighter *make_fighter(battle * b, unit * u, side * s1, bool attack)
* keine addierten boni. */
/* Zuerst mal die Spezialbehandlung gewisser Sonderf<72>lle. */
fig->magic = effskill(u, SK_MAGIC, 0);
fig->magic = effskill(u, SK_MAGIC, NULL);
if (fig->horses) {
if (!fval(r->terrain, CAVALRY_REGION) || r_isforest(r)
|| effskill(u, SK_RIDING, 0) < CavalrySkill()
|| effskill(u, SK_RIDING, NULL) < CavalrySkill()
|| u_race(u) == get_race(RC_TROLL) || fval(u, UFL_WERE))
fig->horses = 0;
}
if (fig->elvenhorses) {
if (effskill(u, SK_RIDING, 0) < 5 || u_race(u) == get_race(RC_TROLL)
if (effskill(u, SK_RIDING, NULL) < 5 || u_race(u) == get_race(RC_TROLL)
|| fval(u, UFL_WERE))
fig->elvenhorses = 0;
}

View File

@ -426,7 +426,7 @@ static int tolua_unit_effskill(lua_State * L)
unit *self = (unit *)tolua_tousertype(L, 1, 0);
const char *skname = tolua_tostring(L, 2, 0);
skill_t sk = findskill(skname);
int value = (sk == NOSKILL) ? -1 : effskill(self, sk, 0);
int value = (sk == NOSKILL) ? -1 : effskill(self, sk, NULL);
lua_pushinteger(L, value);
return 1;
}

View File

@ -952,7 +952,7 @@ void cr_output_unit(stream *out, const faction * f,
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
if (sv->level > 0) {
skill_t sk = sv->id;
int esk = effskill(u, sk, 0);
int esk = effskill(u, sk, NULL);
if (!pr) {
pr = 1;
stream_printf(out, "TALENTE\n");
@ -965,7 +965,7 @@ void cr_output_unit(stream *out, const faction * f,
/* spells that this unit can cast */
if (mage) {
int maxlevel = effskill(u, SK_MAGIC, 0);
int maxlevel = effskill(u, SK_MAGIC, NULL);
cr_output_spells(out, u, maxlevel);
for (i = 0; i != MAXCOMBATSPELLS; ++i) {

View File

@ -1015,7 +1015,7 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
}
assert(sk != NOSKILL || !"limited resource needs a required skill for making it");
skill = effskill(u, sk, 0);
skill = effskill(u, sk, NULL);
if (skill == 0) {
add_message(&u->faction->msgs,
msg_feedback(u, u->thisorder, "skill_needed", "skill", sk));
@ -1106,7 +1106,7 @@ leveled_allocation(const resource_type * rtype, region * r, allocation * alist)
if (!fval(al, AFL_DONE)) {
int req = required(al->want - al->get, al->save);
assert(al->get <= al->want && al->get >= 0);
if (effskill(al->unit, itype->construction->skill, 0)
if (effskill(al->unit, itype->construction->skill, NULL)
>= rm->level + itype->construction->minskill - 1) {
if (req) {
nreq += req;
@ -1633,7 +1633,7 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord)
}
/* Ein H<>ndler kann nur 10 G<>ter pro Talentpunkt handeln. */
k = u->number * 10 * effskill(u, SK_TRADE, 0);
k = u->number * 10 * effskill(u, SK_TRADE, NULL);
/* hat der H<>ndler bereits gehandelt, muss die Menge der bereits
* verkauften/gekauften G<EFBFBD>ter abgezogen werden */
@ -1953,7 +1953,7 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord)
/* Ein H<>ndler kann nur 10 G<>ter pro Talentpunkt verkaufen. */
i = u->number * 10 * effskill(u, SK_TRADE, 0);
i = u->number * 10 * effskill(u, SK_TRADE, NULL);
if (n > i) n = i;
if (!n) {
@ -2002,7 +2002,7 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord)
* existiert, so dass man arrays von orders machen kann. */
/* Ein H<>ndler kann nur 10 G<>ter pro Talentpunkt handeln. */
k = u->number * 10 * effskill(u, SK_TRADE, 0);
k = u->number * 10 * effskill(u, SK_TRADE, NULL);
/* hat der H<>ndler bereits gehandelt, muss die Menge der bereits
* verkauften/gekauften G<EFBFBD>ter abgezogen werden */
@ -2048,7 +2048,7 @@ static void plant(unit * u, int raw)
}
/* Skill pr<70>fen */
skill = effskill(u, SK_HERBALISM, 0);
skill = effskill(u, SK_HERBALISM, NULL);
if (skill < 6) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, u->thisorder, "plant_skills",
@ -2102,7 +2102,7 @@ static void planttrees(unit * u, int raw)
rtype = get_resourcetype(fval(r, RF_MALLORN) ? R_MALLORN_SEED : R_SEED);
/* Skill pr<70>fen */
skill = effskill(u, SK_HERBALISM, 0);
skill = effskill(u, SK_HERBALISM, NULL);
if (skill < 6) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, u->thisorder, "plant_skills",
@ -2167,7 +2167,7 @@ static void breedtrees(unit * u, int raw)
rtype = get_resourcetype(fval(r, RF_MALLORN) ? R_MALLORN_SEED : R_SEED);
/* Skill pr<70>fen */
skill = effskill(u, SK_HERBALISM, 0);
skill = effskill(u, SK_HERBALISM, NULL);
if (skill < 12) {
planttrees(u, raw);
return;
@ -2223,7 +2223,7 @@ static void breedhorses(unit * u)
cmistake(u, u->thisorder, 107, MSG_PRODUCE);
return;
}
effsk = effskill(u, SK_HORSE_TRAINING, 0);
effsk = effskill(u, SK_HORSE_TRAINING, NULL);
n = u->number * effsk;
if (n > horses) n = horses;
@ -2323,7 +2323,7 @@ static void research_cmd(unit * u, struct order *ord)
kwd = init_order_depr(ord);
assert(kwd == K_RESEARCH);
if (effskill(u, SK_HERBALISM, 0) < 7) {
if (effskill(u, SK_HERBALISM, NULL) < 7) {
cmistake(u, ord, 227, MSG_EVENT);
return;
}
@ -2397,7 +2397,7 @@ void entertain_cmd(unit * u, struct order *ord)
cmistake(u, ord, 58, MSG_INCOME);
return;
}
if (!effskill(u, SK_ENTERTAINMENT, 0)) {
if (!effskill(u, SK_ENTERTAINMENT, NULL)) {
cmistake(u, ord, 58, MSG_INCOME);
return;
}
@ -2410,7 +2410,7 @@ void entertain_cmd(unit * u, struct order *ord)
return;
}
u->wants = u->number * (entertainbase + effskill(u, SK_ENTERTAINMENT, 0)
u->wants = u->number * (entertainbase + effskill(u, SK_ENTERTAINMENT, NULL)
* entertainperlevel);
max_e = getuint();
@ -2604,7 +2604,7 @@ void tax_cmd(unit * u, struct order *ord, econ_request ** taxorders)
return;
}
if (effskill(u, SK_TAXING, 0) <= 0) {
if (effskill(u, SK_TAXING, NULL) <= 0) {
ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "error_no_tax_skill", ""));
return;
@ -2619,7 +2619,7 @@ void tax_cmd(unit * u, struct order *ord, econ_request ** taxorders)
u->wants = income(u);
}
else {
u->wants = n * effskill(u, SK_TAXING, 0) * taxperlevel;
u->wants = n * effskill(u, SK_TAXING, NULL) * taxperlevel;
}
if (u->wants > max) u->wants = max;
@ -2693,8 +2693,8 @@ void loot_cmd(unit * u, struct order *ord, econ_request ** lootorders)
}
else {
/* For player start with 20 Silver +10 every 5 level of close combat skill*/
int skm = effskill(u, SK_MELEE, 0);
int sks = effskill(u, SK_SPEAR, 0);
int skm = effskill(u, SK_MELEE, NULL);
int sks = effskill(u, SK_SPEAR, NULL);
int skbonus = ((skm > sks ? skm : sks) * 2 / 10) + 2;
u->wants = n * skbonus * 10;
if (u->wants > max) u->wants = max;

View File

@ -263,7 +263,7 @@ static int use_foolpotion(unit *u, const item_type *itype, int amount,
""));
return ECUSTOM;
}
if (effskill(u, SK_STEALTH, 0) <= effskill(target, SK_PERCEPTION, 0)) {
if (effskill(u, SK_STEALTH, NULL) <= effskill(target, SK_PERCEPTION, NULL)) {
cmistake(u, ord, 64, MSG_EVENT);
return ECUSTOM;
}

View File

@ -128,7 +128,7 @@ static void destroy_road(unit * u, int nmax, struct order *ord)
if (n != 0) {
region *r2 = rconnect(r, d);
int willdo = effskill(u, SK_ROAD_BUILDING, 0) * u->number;
int willdo = effskill(u, SK_ROAD_BUILDING, NULL) * u->number;
if (willdo > n) willdo = n;
if (willdo == 0) {
/* TODO: error message */
@ -278,7 +278,7 @@ void build_road(unit * u, int size, direction_t d)
region *rn = rconnect(r, d);
assert(u->number);
effsk = effskill(u, SK_ROAD_BUILDING, 0);
effsk = effskill(u, SK_ROAD_BUILDING, NULL);
if (!effsk) {
cmistake(u, u->thisorder, 103, MSG_PRODUCE);
return;
@ -616,7 +616,7 @@ int build(unit * u, const construction * con, int completed, int want, int skill
int made, basesk = 0;
assert(con->skill != NOSKILL);
basesk = effskill(u, con->skill, 0);
basesk = effskill(u, con->skill, NULL);
if (basesk == 0) {
return ENEEDSKILL;
}
@ -759,7 +759,7 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
assert(u->number);
assert(btype->stages && btype->stages->construction);
basesk = effskill(u, SK_BUILDING, 0);
basesk = effskill(u, SK_BUILDING, NULL);
skills = build_skill(u, basesk, 0);
if (skills == 0) {
cmistake(u, ord, 101, MSG_PRODUCE);
@ -959,13 +959,13 @@ create_ship(unit * u, const struct ship_type *newtype, int want,
order *new_order;
region * r = u->region;
if (!effskill(u, SK_SHIPBUILDING, 0)) {
if (!effskill(u, SK_SHIPBUILDING, NULL)) {
cmistake(u, ord, 100, MSG_PRODUCE);
return;
}
/* check if skill and material for 1 size is available */
if (effskill(u, cons->skill, 0) < cons->minskill) {
if (effskill(u, cons->skill, NULL) < cons->minskill) {
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
"error_build_skill_low", "value", cons->minskill));
return;
@ -1003,7 +1003,7 @@ void continue_ship(unit * u, int want)
int msize;
region * r = u->region;
if (!effskill(u, SK_SHIPBUILDING, 0)) {
if (!effskill(u, SK_SHIPBUILDING, NULL)) {
cmistake(u, u->thisorder, 100, MSG_PRODUCE);
return;
}
@ -1023,7 +1023,7 @@ void continue_ship(unit * u, int want)
cmistake(u, u->thisorder, 16, MSG_PRODUCE);
return;
}
if (effskill(u, cons->skill, 0) < cons->minskill) {
if (effskill(u, cons->skill, NULL) < cons->minskill) {
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
"error_build_skill_low", "value", cons->minskill));
return;

View File

@ -1506,7 +1506,7 @@ int read_game(gamedata *data)
struct sc_mage *mage = get_mage(u);
if (mage) {
faction *f = u->faction;
int skl = effskill(u, SK_MAGIC, 0);
int skl = effskill(u, SK_MAGIC, NULL);
if (f->magiegebiet == M_GRAY) {
f->magiegebiet = mage_get_type(mage);
log_error("faction %s had magic=gray, fixing (%s)",

View File

@ -290,7 +290,7 @@ static int ShipSpeedBonus(const unit * u)
bonus = config_get_int("movement.shipspeed.skillbonus", 0);
}
if (bonus > 0) {
int skl = effskill(u, SK_SAILING, 0);
int skl = effskill(u, SK_SAILING, NULL);
int minsk = (sh->type->cptskill + 1) / 2;
return (skl - minsk) / bonus;
}
@ -298,7 +298,7 @@ static int ShipSpeedBonus(const unit * u)
int base = 3;
int speed = 0;
int minsk = sh->type->cptskill * base;
int skl = effskill(u, SK_SAILING, 0);
int skl = effskill(u, SK_SAILING, NULL);
while (skl >= minsk) {
++speed;
minsk *= base;
@ -316,7 +316,7 @@ int crew_skill(const ship *sh) {
for (u = sh->region->units; u; u = u->next) {
if (u->ship == sh) {
n += effskill(u, SK_SAILING, 0) * u->number;
n += effskill(u, SK_SAILING, NULL) * u->number;
}
}
return n;

View File

@ -234,22 +234,22 @@ static void test_skillmod(CuTest *tc) {
test_setup();
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
set_level(u, SK_ARMORER, 5);
CuAssertIntEquals(tc, 5, effskill(u, SK_ARMORER, 0));
CuAssertIntEquals(tc, 5, effskill(u, SK_ARMORER, NULL));
a_add(&u->attribs, a = make_skillmod(SK_ARMORER, 0, 2.0, 0));
CuAssertIntEquals(tc, 10, effskill(u, SK_ARMORER, 0));
CuAssertIntEquals(tc, 10, effskill(u, SK_ARMORER, NULL));
a_remove(&u->attribs, a);
a_add(&u->attribs, a = make_skillmod(NOSKILL, 0, 2.0, 0)); /* NOSKILL means any skill */
CuAssertIntEquals(tc, 10, effskill(u, SK_ARMORER, 0));
CuAssertIntEquals(tc, 10, effskill(u, SK_ARMORER, NULL));
a_remove(&u->attribs, a);
a_add(&u->attribs, a = make_skillmod(SK_ARMORER, 0, 0, 2));
CuAssertIntEquals(tc, 7, effskill(u, SK_ARMORER, 0));
CuAssertIntEquals(tc, 7, effskill(u, SK_ARMORER, NULL));
a_remove(&u->attribs, a);
a_add(&u->attribs, a = make_skillmod(SK_ARMORER, cb_skillmod, 0, 0));
CuAssertIntEquals(tc, 8, effskill(u, SK_ARMORER, 0));
CuAssertIntEquals(tc, 8, effskill(u, SK_ARMORER, NULL));
a_remove(&u->attribs, a);
test_teardown();
@ -263,10 +263,10 @@ static void test_skill_hunger(CuTest *tc) {
set_level(u, SK_ARMORER, 6);
set_level(u, SK_SAILING, 6);
fset(u, UFL_HUNGER);
CuAssertIntEquals(tc, 3, effskill(u, SK_ARMORER, 0));
CuAssertIntEquals(tc, 5, effskill(u, SK_SAILING, 0));
CuAssertIntEquals(tc, 3, effskill(u, SK_ARMORER, NULL));
CuAssertIntEquals(tc, 5, effskill(u, SK_SAILING, NULL));
set_level(u, SK_SAILING, 2);
CuAssertIntEquals(tc, 1, effskill(u, SK_SAILING, 0));
CuAssertIntEquals(tc, 1, effskill(u, SK_SAILING, NULL));
test_teardown();
}
@ -280,21 +280,21 @@ static void test_skill_familiar(CuTest *tc) {
mag = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
fam = test_create_unit(mag->faction, test_create_region(0, 0, NULL));
set_level(fam, SK_PERCEPTION, 6);
CuAssertIntEquals(tc, 6, effskill(fam, SK_PERCEPTION, 0));
CuAssertIntEquals(tc, 6, effskill(fam, SK_PERCEPTION, NULL));
set_level(mag, SK_PERCEPTION, 6);
CuAssertIntEquals(tc, 6, effskill(mag, SK_PERCEPTION, 0));
CuAssertIntEquals(tc, 6, effskill(mag, SK_PERCEPTION, NULL));
/* make them mage and familiar to each other */
create_newfamiliar(mag, fam);
/* when they are in the same region, the mage gets half their skill as a bonus */
CuAssertIntEquals(tc, 6, effskill(fam, SK_PERCEPTION, 0));
CuAssertIntEquals(tc, 9, effskill(mag, SK_PERCEPTION, 0));
CuAssertIntEquals(tc, 6, effskill(fam, SK_PERCEPTION, NULL));
CuAssertIntEquals(tc, 9, effskill(mag, SK_PERCEPTION, NULL));
/* when they are further apart, divide bonus by distance */
r = test_create_region(3, 0, 0);
move_unit(fam, r, &r->units);
CuAssertIntEquals(tc, 7, effskill(mag, SK_PERCEPTION, 0));
CuAssertIntEquals(tc, 7, effskill(mag, SK_PERCEPTION, NULL));
test_teardown();
}

View File

@ -2215,7 +2215,7 @@ static void reshow_other(unit * u, struct order *ord, const char *s) {
if (itype->flags & ITF_POTION) {
/* we don't have the item, but it is a potion. do we know it? */
int level = potion_level(itype);
if (level > 0 && 2 * level <= effskill(u, SK_ALCHEMY, 0)) {
if (level > 0 && 2 * level <= effskill(u, SK_ALCHEMY, NULL)) {
display_potion(u, itype);
found = true;
}
@ -2658,7 +2658,7 @@ static void age_stonecircle(building *b) {
if (mage && rt && !fval(rt->terrain, FORBIDDEN_REGION)) {
curse *c = get_curse(rt->attribs, &ct_astralblock);
if (!c) {
int sk = effskill(mage, SK_MAGIC, 0);
int sk = effskill(mage, SK_MAGIC, NULL);
if (sk > 0) {
int vig = sk;
int dur = (sk + 1) / 2;
@ -2671,7 +2671,7 @@ static void age_stonecircle(building *b) {
}
}
else {
int sk = effskill(mage, SK_MAGIC, 0);
int sk = effskill(mage, SK_MAGIC, NULL);
if (c->duration < sk / 2) c->duration = sk / 2;
if (c->vigour < sk) c->vigour = sk;
}
@ -3206,7 +3206,7 @@ static int faction_getmages(faction * f, unit ** results, int numresults)
if (u->number > 0) {
struct sc_mage * mage = get_mage(u);
if (mage && mage_get_spellbook(mage)) {
int level = effskill(u, SK_MAGIC, 0);
int level = effskill(u, SK_MAGIC, NULL);
if (level > maxlevel) {
maxlevel = level;
}
@ -3720,7 +3720,7 @@ int armedmen(const unit * u, bool siege_weapons)
item *itm;
int n = 0;
if (!(u_race(u)->flags & RCF_NOWEAPONS)) {
if (effskill(u, SK_WEAPONLESS, 0) >= 1) {
if (effskill(u, SK_WEAPONLESS, NULL) >= 1) {
/* kann ohne waffen bewachen: fuer drachen */
n = u->number;
}
@ -3731,7 +3731,7 @@ int armedmen(const unit * u, bool siege_weapons)
const weapon_type *wtype = resource2weapon(itm->type->rtype);
if (wtype == NULL || (!siege_weapons && (wtype->flags & WTF_SIEGE)))
continue;
if (effskill(u, wtype->skill, 0) >= 1)
if (effskill(u, wtype->skill, NULL) >= 1)
n += itm->number;
if (n >= u->number)
break;
@ -4027,7 +4027,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
if (u2->faction == f) {
if (rings < u->number || invisible(u, u2) < u->number) {
if (skill_enabled(SK_PERCEPTION)) {
int observation = effskill(u2, SK_PERCEPTION, 0);
int observation = effskill(u2, SK_PERCEPTION, NULL);
if (observation >= stealth) {
return true;
@ -4113,7 +4113,7 @@ cansee_durchgezogen(const faction * f, const region * r, const unit * u,
if (rings && invisible(u, u2) >= u->number)
continue;
o = effskill(u2, SK_PERCEPTION, 0);
o = effskill(u2, SK_PERCEPTION, NULL);
if (o >= n) {
return true;

View File

@ -93,7 +93,7 @@ int lighthouse_view_distance(const building * b, const unit *u)
int maxd = lighthouse_range(b);
if (maxd > 0 && u && skill_enabled(SK_PERCEPTION)) {
int sk = effskill(u, SK_PERCEPTION, 0) / 3;
int sk = effskill(u, SK_PERCEPTION, NULL) / 3;
assert(u->building == b);
if (maxd > sk) maxd = sk;
}

View File

@ -509,7 +509,7 @@ int u_hasspell(const unit *u, const struct spell *sp)
spellbook * book = unit_get_spellbook(u);
spellbook_entry * sbe = book ? spellbook_get(book, sp) : 0;
if (sbe) {
return sbe->level <= effskill(u, SK_MAGIC, 0);
return sbe->level <= effskill(u, SK_MAGIC, NULL);
}
return 0;
}
@ -521,7 +521,7 @@ int get_combatspelllevel(const unit * u, int nr)
{
int level;
if (mage_get_combatspell(get_mage(u), nr, &level) != NULL) {
int maxlevel = effskill(u, SK_MAGIC, 0);
int maxlevel = effskill(u, SK_MAGIC, NULL);
if (level > maxlevel) {
return maxlevel;
}
@ -898,7 +898,7 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord)
return false;
}
/* reicht die Stufe aus? */
if (effskill(u, SK_MAGIC, 0) < level) {
if (effskill(u, SK_MAGIC, NULL) < level) {
/* die Einheit ist nicht erfahren genug für diesen Zauber */
cmistake(u, ord, 169, MSG_MAGIC);
return false;
@ -1088,7 +1088,7 @@ variant magic_resistance(unit * target)
}
assert(target->number > 0);
/* Magier haben einen Resistenzbonus vom Magietalent * 5% */
prob = frac_add(prob, frac_make(effskill(target, SK_MAGIC, 0), 20));
prob = frac_add(prob, frac_make(effskill(target, SK_MAGIC, NULL), 20));
/* Auswirkungen von Zaubern auf der Einheit */
c = get_curse(target->attribs, &ct_magicresistance);
@ -1184,10 +1184,10 @@ target_resists_magic(unit * magician, void *obj, int objtyp, int t_bonus)
skill *sv;
unit *u = (unit *)obj;
at = effskill(magician, SK_MAGIC, 0);
at = effskill(magician, SK_MAGIC, NULL);
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
int sk = eff_skill(u, sv, 0);
int sk = eff_skill(u, sv, NULL);
if (pa < sk)
pa = sk;
}
@ -1432,7 +1432,7 @@ static double regeneration(unit * u)
double potenz = 1.5;
double divisor = 2.0;
sk = effskill(u, SK_MAGIC, 0);
sk = effskill(u, SK_MAGIC, NULL);
/* Rassenbonus/-malus */
d = pow(sk, potenz) * u_race(u)->regaura / divisor;
d++;
@ -2541,7 +2541,7 @@ static castorder *cast_cmd(unit * u, order * ord)
cmistake(u, ord, 269, MSG_MAGIC);
return 0;
}
level = effskill(u, SK_MAGIC, 0);
level = effskill(u, SK_MAGIC, NULL);
init_order_depr(ord);
s = gettoken(token, sizeof(token));
@ -2674,7 +2674,7 @@ static castorder *cast_cmd(unit * u, order * ord)
}
/* Stufenangabe bei nicht Stufenvariierbaren Sprüchen abfangen */
if (!(sp->sptyp & SPELLLEVEL)) {
int ilevel = effskill(u, SK_MAGIC, 0);
int ilevel = effskill(u, SK_MAGIC, NULL);
if (ilevel != level) {
level = ilevel;
ADDMSG(&u->faction->msgs, msg_message("spellfail::nolevel",
@ -2701,7 +2701,7 @@ static castorder *cast_cmd(unit * u, order * ord)
"mage", mage));
return 0;
}
sk = effskill(mage, SK_MAGIC, 0);
sk = effskill(mage, SK_MAGIC, NULL);
if (distance(mage->region, r) > sk) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "familiar_toofar",
"mage", mage));

View File

@ -836,7 +836,7 @@ void plan_monsters(faction * f)
/* Einheiten, die Waffenlosen Kampf lernen k<>nnten, lernen es um
* zu bewachen: */
if (rc->bonus[SK_WEAPONLESS] != -99) {
if (effskill(u, SK_WEAPONLESS, 0) < 1) {
if (effskill(u, SK_WEAPONLESS, NULL) < 1) {
long_order =
create_order(K_STUDY, f->locale, "'%s'",
skillname(SK_WEAPONLESS, f->locale));

View File

@ -271,7 +271,7 @@ static int ridingcapacity(const unit * u)
** tragen nichts (siehe walkingcapacity). Ein Wagen zählt nur, wenn er
** von zwei Pferden gezogen wird */
horses = effskill(u, SK_RIDING, 0) * u->number * 2;
horses = effskill(u, SK_RIDING, NULL) * u->number * 2;
if (animals > horses) animals = horses;
if (fval(u_race(u), RCF_HORSE))
@ -298,7 +298,7 @@ int walkingcapacity(const struct unit *u)
/* Das Gewicht, welches die Pferde tragen, plus das Gewicht, welches
* die Leute tragen */
horses = effskill(u, SK_RIDING, 0) * u->number * 4;
horses = effskill(u, SK_RIDING, NULL) * u->number * 4;
pferde_fuer_wagen = (animals < horses) ? animals : horses;
if (fval(u_race(u), RCF_HORSE)) {
animals += u->number;
@ -376,7 +376,7 @@ static int canwalk(unit * u)
get_transporters(u->items, &animals, &acap, &vehicles, &vcap);
effsk = effskill(u, SK_RIDING, 0);
effsk = effskill(u, SK_RIDING, NULL);
maxwagen = effsk * u->number * 2;
if (u_race(u) == get_race(RC_TROLL)) {
int trolls = u->number / 4;
@ -406,7 +406,7 @@ static int canwalk(unit * u)
bool canfly(unit * u)
{
if (i_get(u->items, it_find("pegasus")) >= u->number && effskill(u, SK_RIDING, 0) >= 4)
if (i_get(u->items, it_find("pegasus")) >= u->number && effskill(u, SK_RIDING, NULL) >= 4)
return true;
if (fval(u_race(u), RCF_FLY))
@ -420,7 +420,7 @@ bool canfly(unit * u)
bool canswim(unit * u)
{
if (i_get(u->items, it_find("dolphin")) >= u->number && effskill(u, SK_RIDING, 0) >= 4)
if (i_get(u->items, it_find("dolphin")) >= u->number && effskill(u, SK_RIDING, NULL) >= 4)
return true;
if (u_race(u)->flags & RCF_FLY)
@ -441,7 +441,7 @@ bool canswim(unit * u)
static int walk_mode(const unit * u)
{
int horses = 0, maxhorses, unicorns = 0, maxunicorns;
int skill = effskill(u, SK_RIDING, 0);
int skill = effskill(u, SK_RIDING, NULL);
item *itm;
const item_type *it_horse, *it_elvenhorse, *it_charger;
const resource_type *rtype;
@ -1980,11 +1980,11 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
for (u2 = current_point->units; u2; u2 = u2->next) {
if (u2->ship == sh && !alliedunit(harbourmaster, u->faction, HELP_GUARD)) {
if (effskill(harbourmaster, SK_PERCEPTION, 0) > effskill(u2, SK_STEALTH, 0)) {
if (effskill(harbourmaster, SK_PERCEPTION, NULL) > effskill(u2, SK_STEALTH, NULL)) {
for (itm = u2->items; itm; itm = itm->next) {
const luxury_type *ltype = resource2luxury(itm->type->rtype);
if (ltype != NULL && itm->number > 0) {
int st = itm->number * effskill(harbourmaster, SK_TRADE, 0) / 50;
int st = itm->number * effskill(harbourmaster, SK_TRADE, NULL) / 50;
if (st > itm->number) st = itm->number;
if (st > 0) {

View File

@ -563,7 +563,7 @@ report_resources(const region * r, resource_report * result, int size,
int maxskill = 0;
for (u = r->units; visible != res->amount && u != NULL; u = u->next) {
if (u->faction == viewer) {
int s = effskill(u, skill, 0);
int s = effskill(u, skill, NULL);
if (s > maxskill) {
maxskill = s;
visible = raw->visible(res, maxskill);
@ -622,7 +622,7 @@ static void spskill(sbstring *sbp, const struct locale * lang,
}
}
effsk = eff_skill(u, sv, 0);
effsk = eff_skill(u, sv, NULL);
sbs_strcat(sbp, str_itoa(effsk));
if (u->faction->options & WANT_OPTION(O_SHOWSKCHANGE)) {
@ -812,7 +812,7 @@ void bufunit(const faction * f, const unit * u, const faction *fv,
if (book) {
selist *ql = book->spells;
int qi, header, maxlevel = effskill(u, SK_MAGIC, 0);
int qi, header, maxlevel = effskill(u, SK_MAGIC, NULL);
sbs_printf(sbp, ". Aura %d/%d", get_spellpoints(u), max_spellpoints(u, NULL));
for (header = 0, qi = 0; ql; selist_advance(&ql, &qi, 1)) {

View File

@ -474,7 +474,7 @@ report_effect(region * r, unit * mage, message * seen, message * unseen)
* Spezielle V. fuer Katzen, Trolle, Elfen, Daemonen, Insekten, Zwerge?
*/
static const race *select_familiar(const race * magerace, magic_t magiegebiet)
static const race *select_familiar(const race * magerace, int level, magic_t magiegebiet)
{
const race *retval;
int rnd = rng_int() % 100;
@ -493,7 +493,7 @@ static const race *select_familiar(const race * magerace, magic_t magiegebiet)
}
assert(magerace->familiars[0]);
if (rnd >= 70) {
if (rnd >= 100 - (level * 5)) {
retval = magerace->familiars[magiegebiet];
assert(retval);
}
@ -501,7 +501,7 @@ static const race *select_familiar(const race * magerace, magic_t magiegebiet)
retval = magerace->familiars[0];
}
if (!retval || rnd < 3) {
if (!retval || rnd < level) {
race_list *familiarraces = get_familiarraces();
unsigned int maxlen = listlen(familiarraces);
if (maxlen > 0) {
@ -557,7 +557,7 @@ static int sp_summon_familiar(castorder * co)
cmistake(caster, co->order, 199, MSG_MAGIC);
return 0;
}
rc = select_familiar(caster->_race, caster->faction->magiegebiet);
rc = select_familiar(caster->_race, cast_level, caster->faction->magiegebiet);
if (rc == NULL) {
log_error("could not find suitable familiar for %s.\n", caster->faction->race->_name);
return 0;
@ -2509,7 +2509,7 @@ static int sp_fumblecurse(castorder * co)
target = pa->param[0]->data.u;
duration = cast_level - effskill(target, SK_MAGIC, 0);
duration = cast_level - effskill(target, SK_MAGIC, NULL);
if (duration < 2) {
int rx = rng_int() % 3;
if (duration < rx) duration = rx;
@ -3191,7 +3191,7 @@ static int sp_bloodsacrifice(castorder * co)
unit *caster = co_get_caster(co);
int cast_level = co->level;
int aura;
int skill = effskill(caster, SK_MAGIC, 0);
int skill = effskill(caster, SK_MAGIC, NULL);
int hp = (int)(co->force * 8);
if (hp <= 0) {
@ -3530,11 +3530,11 @@ static int sp_charmingsong(castorder * co)
}
/* Magieresistensbonus fuer hoehere Talentwerte */
for (i = 0; i < MAXSKILLS; i++) {
int sk = effskill(target, i, 0);
int sk = effskill(target, i, NULL);
if (tb < sk)
tb = sk;
}
tb -= effskill(mage, SK_MAGIC, 0);
tb -= effskill(mage, SK_MAGIC, NULL);
if (tb > 0) {
resist_bonus += tb * 15;
}
@ -4077,7 +4077,7 @@ static int sp_pump(castorder * co)
return cast_level / 2;
}
set_observer(rt, mage->faction, effskill(target, SK_PERCEPTION, 0), 2);
set_observer(rt, mage->faction, effskill(target, SK_PERCEPTION, NULL), 2);
return cast_level;
}

View File

@ -138,14 +138,14 @@ int spy_cmd(unit * u, struct order *ord)
msg_feedback(u, u->thisorder, "feedback_unit_not_found", ""));
return 0;
}
if (effskill(u, SK_SPY, 0) < 1) {
if (effskill(u, SK_SPY, NULL) < 1) {
cmistake(u, u->thisorder, 39, MSG_EVENT);
return 0;
}
/* Die Grundchance fuer einen erfolgreichen Spionage-Versuch ist 10%.
* Fuer jeden Talentpunkt, den das Spionagetalent das Tarnungstalent
* des Opfers uebersteigt, erhoeht sich dieses um 5%*/
spy = effskill(u, SK_SPY, 0) - effskill(target, SK_STEALTH, r);
spy = effskill(u, SK_SPY, NULL) - effskill(target, SK_STEALTH, r);
spychance = 0.1 + fmax(spy * 0.05, 0.0);
if (chance(spychance)) {
@ -159,7 +159,7 @@ int spy_cmd(unit * u, struct order *ord)
/* der Spion kann identifiziert werden, wenn das Opfer bessere
* Wahrnehmung als das Ziel Tarnung + Spionage/2 hat */
observe = effskill(target, SK_PERCEPTION, r)
- (effskill(u, SK_STEALTH, 0) + effskill(u, SK_SPY, 0) / 2);
- (effskill(u, SK_STEALTH, NULL) + effskill(u, SK_SPY, NULL) / 2);
if (invisible(u, target) >= u->number) {
if (observe > 0) observe = 0;
@ -168,8 +168,8 @@ int spy_cmd(unit * u, struct order *ord)
/* Anschliessend wird - unabhaengig vom Erfolg - gewuerfelt, ob der
* Spionageversuch bemerkt wurde. Die Wahrscheinlich dafuer ist (100 -
* SpionageSpion*5 + WahrnehmungOpfer*2)%. */
observechance = 1.0 - (effskill(u, SK_SPY, 0) * 0.05)
+ (effskill(target, SK_PERCEPTION, 0) * 0.02);
observechance = 1.0 - (effskill(u, SK_SPY, NULL) * 0.05)
+ (effskill(target, SK_PERCEPTION, NULL) * 0.02);
if (chance(observechance)) {
ADDMSG(&target->faction->msgs, msg_message("spydetect",
@ -231,7 +231,7 @@ int setstealth_cmd(unit * u, struct order *ord)
if (isdigit(*(const unsigned char *)s)) {
/* Tarnungslevel setzen */
int level = atoi((const char *)s);
if (level > effskill(u, SK_STEALTH, 0)) {
if (level > effskill(u, SK_STEALTH, NULL)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_lowstealth", ""));
return 0;
}
@ -342,7 +342,7 @@ static int top_skill(region * r, faction * f, ship * sh, skill_t sk)
for (u = r->units; u; u = u->next) {
if (u->ship == sh && u->faction == f) {
int s = effskill(u, sk, 0);
int s = effskill(u, sk, NULL);
if (value < s) value = s;
}
}
@ -455,7 +455,7 @@ int sabotage_cmd(unit * u, struct order *ord)
u2 = ship_owner(sh);
if (u2->faction != u->faction) {
skdiff =
effskill(u, SK_SPY, 0) - top_skill(u->region, u2->faction, sh, SK_PERCEPTION);
effskill(u, SK_SPY, NULL) - top_skill(u->region, u2->faction, sh, SK_PERCEPTION);
}
if (try_destruction(u, u2, sh, skdiff)) {
sink_ship(sh);

View File

@ -102,7 +102,7 @@ static int max_skill(region * r, struct faction * f, skill_t sk)
for (u = r->units; u; u = u->next) {
if (u->faction == f) {
int effsk = effskill(u, sk, 0);
int effsk = effskill(u, sk, NULL);
if (effsk > w) {
w = effsk;
}
@ -189,7 +189,7 @@ void steal_cmd(unit * u, struct order *ord, econ_request ** stealorders)
assert(u->region == u2->region);
effsk = effskill(u, SK_STEALTH, 0);
effsk = effskill(u, SK_STEALTH, NULL);
n = effsk - max_skill(r, f, SK_PERCEPTION);
if (n <= 0) {

View File

@ -510,7 +510,7 @@ static bool cb_msg_teach(void *el, void *arg) {
if (feedback) {
ADDMSG(&ut->faction->msgs, msg_message("teach_teacher",
"teacher student skill level", ut, u, sk,
effskill(u, sk, 0)));
effskill(u, sk, NULL)));
}
ADDMSG(&u->faction->msgs, msg_message("teach_student",
"teacher student skill", ut, u, sk));
@ -691,7 +691,7 @@ int study_cmd(unit * u, order * ord)
}
}
if (sk == SK_ALCHEMY) {
maxalchemy = effskill(u, SK_ALCHEMY, 0);
maxalchemy = effskill(u, SK_ALCHEMY, NULL);
if (!has_skill(u, SK_ALCHEMY)) {
int amax = skill_limit(u->faction, SK_ALCHEMY);
if (count_skill(u->faction, SK_ALCHEMY) + u->number > amax) {
@ -780,7 +780,7 @@ int study_cmd(unit * u, order * ord)
if (sk == SK_ALCHEMY) {
faction *f = u->faction;
int skill = effskill(u, SK_ALCHEMY, 0);
int skill = effskill(u, SK_ALCHEMY, NULL);
if (skill > maxalchemy) {
show_potions(f, skill);
}