squash some static analysis warnings.

This commit is contained in:
Enno Rehling 2016-11-19 15:19:23 +01:00
parent 14b4ae5859
commit 531da88b2a
7 changed files with 17 additions and 32 deletions

View File

@ -181,7 +181,7 @@ static int potion_power(unit *u, int amount) {
if (u->number % 10 > 0) ++use; if (u->number % 10 > 0) ++use;
amount = use; amount = use;
} }
/* Verfünffacht die HP von max. 10 Personen in der Einheit */ /* Verf<EFBFBD>nffacht die HP von max. 10 Personen in der Einheit */
u->hp += _min(u->number, 10 * amount) * unit_max_hp(u) * 4; u->hp += _min(u->number, 10 * amount) * unit_max_hp(u) * 4;
return amount; return amount;
} }
@ -241,11 +241,6 @@ static void init_potiondelay(attrib * a)
a->data.v = malloc(sizeof(potiondelay)); a->data.v = malloc(sizeof(potiondelay));
} }
static void free_potiondelay(attrib * a)
{
free(a->data.v);
}
static int age_potiondelay(attrib * a, void *owner) static int age_potiondelay(attrib * a, void *owner)
{ {
potiondelay *pd = (potiondelay *)a->data.v; potiondelay *pd = (potiondelay *)a->data.v;
@ -257,7 +252,7 @@ static int age_potiondelay(attrib * a, void *owner)
attrib_type at_potiondelay = { attrib_type at_potiondelay = {
"potiondelay", "potiondelay",
init_potiondelay, init_potiondelay,
free_potiondelay, a_finalizeeffect,
age_potiondelay, 0, 0 age_potiondelay, 0, 0
}; };

View File

@ -1022,16 +1022,15 @@ static int armor_bonus(const race *rc) {
int natural_armor(unit * du) int natural_armor(unit * du)
{ {
const race *rc = u_race(du); const race *rc = u_race(du);
int bonus, an = rc->armor; int an;
assert(rc); assert(rc);
bonus = armor_bonus(rc); an = armor_bonus(rc);
if (bonus > 0) { if (an > 0) {
int sk = effskill(du, SK_STAMINA, 0); int sk = effskill(du, SK_STAMINA, 0);
sk /= bonus; an = sk / an;
an += sk;
} }
return an; return an + rc->armor;
} }
static int rc_specialdamage(const unit *au, const unit *du, const struct weapon_type *wtype) 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) void dazzle(battle * b, troop * td)
{ {
/* Nicht kumulativ ! */ /* Nicht kumulativ ! */
if (td->fighter->person[td->index].flags & FL_DAZZLED)
return;
#ifdef TODO_RUNESWORD #ifdef TODO_RUNESWORD
if (td->fighter->weapon[WP_RUNESWORD].count > td->index) { if (td->fighter->weapon[WP_RUNESWORD].count > td->index) {
return; return;
} }
#endif #endif
if (td->fighter->person[td->index].flags & FL_COURAGE) { if (td->fighter->person[td->index].flags & (FL_COURAGE|FL_DAZZLED) {
return;
}
if (td->fighter->person[td->index].flags & FL_DAZZLED) {
return; return;
} }
@ -2497,7 +2489,7 @@ static int loot_quota(const unit * src, const unit * dst,
{ {
if (dst && src && src->faction != dst->faction) { if (dst && src && src->faction != dst->faction) {
double divisor = config_get_flt("rules.items.loot_divisor", 1); double divisor = config_get_flt("rules.items.loot_divisor", 1);
assert(divisor == 0 || divisor >= 1); assert(divisor <= 0 || divisor >= 1);
if (divisor >= 1) { if (divisor >= 1) {
double r = n / divisor; double r = n / divisor;
int x = (int)r; int x = (int)r;

View File

@ -16,7 +16,7 @@
const attrib_type at_lighthouse = { const attrib_type at_lighthouse = {
"lighthouse" "lighthouse"
/* Rest ist NULL; temporäres, nicht alterndes Attribut */ /* Rest ist NULL; tempor<EFBFBD>res, nicht alterndes Attribut */
}; };
/* update_lighthouse: call this function whenever the size of a lighthouse changes /* 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; c += u->number;
if (c > buildingcapacity(b)) if (c > buildingcapacity(b))
break; break;
if (f == NULL || u->faction == f) { if (u->faction == f) {
if (!d) if (!d)
d = distance(r, r2); d = distance(r, r2);
if (maxd < d) if (maxd < d)

View File

@ -1240,9 +1240,9 @@ static bool roadto(const region * r, direction_t dir)
if (!r || dir >= MAXDIRECTIONS || dir < 0) if (!r || dir >= MAXDIRECTIONS || dir < 0)
return false; return false;
r2 = rconnect(r, dir); r2 = rconnect(r, dir);
if (r == NULL || r2 == NULL) if (!r2) {
return false; return false;
}
if (r->attribs || r2->attribs) { if (r->attribs || r2->attribs) {
const curse_type *roads_ct = ct_find("magicstreet"); const curse_type *roads_ct = ct_find("magicstreet");
if (roads_ct != NULL) { if (roads_ct != NULL) {

View File

@ -3237,8 +3237,7 @@ static int sp_magicboost(castorder * co)
} }
effect = 6; 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: */ /* one aura boost with 200% aura now: */
effect = 200; effect = 200;
c = create_curse(mage, &mage->attribs, ct_auraboost, power, 4, effect, 1); 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 * ein mehrfaches von Stufe 1, denn in beiden Faellen gibt es nur 1
* Bauer, nur die Kosten steigen. */ * Bauer, nur die Kosten steigen. */
n = (pow(force, 1.6) * 100) / f->race->recruitcost; 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; double multp = (double)maxp / rc->recruit_multi;
n = _min(multp, n); n = _min(multp, n);
n = _max(n, 1); n = _max(n, 1);

View File

@ -185,9 +185,7 @@ plane *get_astralplane(void)
if (!rule_astralplane) { if (!rule_astralplane) {
return NULL; return NULL;
} }
if (!astralspace) {
astralspace = getplanebyname("Astralraum"); astralspace = getplanebyname("Astralraum");
}
if (!astralspace) { if (!astralspace) {
astralspace = create_new_plane(1, "Astralraum", astralspace = create_new_plane(1, "Astralraum",
TE_CENTER_X - 500, TE_CENTER_X + 500, TE_CENTER_X - 500, TE_CENTER_X + 500,

1
tolua Submodule

@ -0,0 +1 @@
Subproject commit de289b60c5009b6ac8e786f39432c08eadbb69b7