diff --git a/src/alchemy.c b/src/alchemy.c index 7eac102fb..cd33feadb 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -181,7 +181,7 @@ static int potion_power(unit *u, int amount) { if (u->number % 10 > 0) ++use; amount = use; } - /* Verfünffacht die HP von max. 10 Personen in der Einheit */ + /* Verf�nffacht die HP von max. 10 Personen in der Einheit */ u->hp += _min(u->number, 10 * amount) * unit_max_hp(u) * 4; return amount; } @@ -241,11 +241,6 @@ static void init_potiondelay(attrib * a) a->data.v = malloc(sizeof(potiondelay)); } -static void free_potiondelay(attrib * a) -{ - free(a->data.v); -} - static int age_potiondelay(attrib * a, void *owner) { potiondelay *pd = (potiondelay *)a->data.v; @@ -257,7 +252,7 @@ static int age_potiondelay(attrib * a, void *owner) attrib_type at_potiondelay = { "potiondelay", init_potiondelay, - free_potiondelay, + a_finalizeeffect, age_potiondelay, 0, 0 }; diff --git a/src/battle.c b/src/battle.c index b5d767535..3cf7b685a 100644 --- a/src/battle.c +++ b/src/battle.c @@ -1022,16 +1022,15 @@ static int armor_bonus(const race *rc) { int natural_armor(unit * du) { const race *rc = u_race(du); - int bonus, an = rc->armor; + int an; assert(rc); - bonus = armor_bonus(rc); - if (bonus > 0) { + an = armor_bonus(rc); + if (an > 0) { int sk = effskill(du, SK_STAMINA, 0); - sk /= bonus; - an += sk; + an = sk / an; } - return an; + return an + rc->armor; } static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_type *wtype) @@ -2042,19 +2041,12 @@ int hits(troop at, troop dt, weapon * awp) void dazzle(battle * b, troop * td) { /* Nicht kumulativ ! */ - if (td->fighter->person[td->index].flags & FL_DAZZLED) - return; - #ifdef TODO_RUNESWORD if (td->fighter->weapon[WP_RUNESWORD].count > td->index) { return; } #endif - if (td->fighter->person[td->index].flags & FL_COURAGE) { - return; - } - - if (td->fighter->person[td->index].flags & FL_DAZZLED) { + if (td->fighter->person[td->index].flags & (FL_COURAGE|FL_DAZZLED) { return; } @@ -2497,7 +2489,7 @@ static int loot_quota(const unit * src, const unit * dst, { if (dst && src && src->faction != dst->faction) { double divisor = config_get_flt("rules.items.loot_divisor", 1); - assert(divisor == 0 || divisor >= 1); + assert(divisor <= 0 || divisor >= 1); if (divisor >= 1) { double r = n / divisor; int x = (int)r; diff --git a/src/lighthouse.c b/src/lighthouse.c index dd1183558..d962b9b76 100644 --- a/src/lighthouse.c +++ b/src/lighthouse.c @@ -16,7 +16,7 @@ const attrib_type at_lighthouse = { "lighthouse" - /* Rest ist NULL; temporäres, nicht alterndes Attribut */ + /* Rest ist NULL; tempor�res, nicht alterndes Attribut */ }; /* update_lighthouse: call this function whenever the size of a lighthouse changes @@ -127,7 +127,7 @@ bool check_leuchtturm(region * r, faction * f) c += u->number; if (c > buildingcapacity(b)) break; - if (f == NULL || u->faction == f) { + if (u->faction == f) { if (!d) d = distance(r, r2); if (maxd < d) diff --git a/src/move.c b/src/move.c index 0888b6fde..b6a908837 100644 --- a/src/move.c +++ b/src/move.c @@ -1240,9 +1240,9 @@ static bool roadto(const region * r, direction_t dir) if (!r || dir >= MAXDIRECTIONS || dir < 0) return false; r2 = rconnect(r, dir); - if (r == NULL || r2 == NULL) + if (!r2) { return false; - + } if (r->attribs || r2->attribs) { const curse_type *roads_ct = ct_find("magicstreet"); if (roads_ct != NULL) { diff --git a/src/spells.c b/src/spells.c index ed17b8f42..57b1da3a5 100644 --- a/src/spells.c +++ b/src/spells.c @@ -3237,8 +3237,7 @@ static int sp_magicboost(castorder * co) } effect = 6; - c = create_curse(mage, &mage->attribs, ct_magicboost, power, 10, effect, 1); - + create_curse(mage, &mage->attribs, ct_magicboost, power, 10, effect, 1); /* one aura boost with 200% aura now: */ effect = 200; c = create_curse(mage, &mage->attribs, ct_auraboost, power, 4, effect, 1); @@ -4031,7 +4030,7 @@ static int sp_recruit(castorder * co) * ein mehrfaches von Stufe 1, denn in beiden Faellen gibt es nur 1 * Bauer, nur die Kosten steigen. */ n = (pow(force, 1.6) * 100) / f->race->recruitcost; - if (rc->recruit_multi != 0) { + if (rc->recruit_multi > 0) { double multp = (double)maxp / rc->recruit_multi; n = _min(multp, n); n = _max(n, 1); diff --git a/src/teleport.c b/src/teleport.c index c7e775345..74176f6af 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -185,9 +185,7 @@ plane *get_astralplane(void) if (!rule_astralplane) { return NULL; } - if (!astralspace) { - astralspace = getplanebyname("Astralraum"); - } + astralspace = getplanebyname("Astralraum"); if (!astralspace) { astralspace = create_new_plane(1, "Astralraum", TE_CENTER_X - 500, TE_CENTER_X + 500, diff --git a/tolua b/tolua new file mode 160000 index 000000000..de289b60c --- /dev/null +++ b/tolua @@ -0,0 +1 @@ +Subproject commit de289b60c5009b6ac8e786f39432c08eadbb69b7