forked from github/server
coverity scan CID 22576: arguments in wrong order
I believe that was a false positive, and will try to aquelch it by naming the arguments better.
This commit is contained in:
parent
4384183ab8
commit
4f25831407
|
@ -943,7 +943,7 @@ void move_unit(unit * u, region * r, unit ** ulist)
|
||||||
/* ist mist, aber wegen nicht skalierender attribute notwendig: */
|
/* ist mist, aber wegen nicht skalierender attribute notwendig: */
|
||||||
#include "alchemy.h"
|
#include "alchemy.h"
|
||||||
|
|
||||||
void transfermen(unit * u, unit * u2, int n)
|
void transfermen(unit * u, unit * dst, int n)
|
||||||
{
|
{
|
||||||
const attrib *a;
|
const attrib *a;
|
||||||
int hp = u->hp;
|
int hp = u->hp;
|
||||||
|
@ -954,22 +954,22 @@ void transfermen(unit * u, unit * u2, int n)
|
||||||
assert(n > 0);
|
assert(n > 0);
|
||||||
/* "hat attackiert"-status wird uebergeben */
|
/* "hat attackiert"-status wird uebergeben */
|
||||||
|
|
||||||
if (u2) {
|
if (dst) {
|
||||||
skill *sv, *sn;
|
skill *sv, *sn;
|
||||||
skill_t sk;
|
skill_t sk;
|
||||||
ship *sh;
|
ship *sh;
|
||||||
|
|
||||||
assert(u2->number + n > 0);
|
assert(dst->number + n > 0);
|
||||||
|
|
||||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
||||||
int weeks, level = 0;
|
int weeks, level = 0;
|
||||||
|
|
||||||
sv = unit_skill(u, sk);
|
sv = unit_skill(u, sk);
|
||||||
sn = unit_skill(u2, sk);
|
sn = unit_skill(dst, sk);
|
||||||
|
|
||||||
if (sv == NULL && sn == NULL)
|
if (sv == NULL && sn == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (sn == NULL && u2->number == 0) {
|
if (sn == NULL && dst->number == 0) {
|
||||||
/* new unit, easy to solve */
|
/* new unit, easy to solve */
|
||||||
level = sv->level;
|
level = sv->level;
|
||||||
weeks = sv->weeks;
|
weeks = sv->weeks;
|
||||||
|
@ -983,12 +983,12 @@ void transfermen(unit * u, unit * u2, int n)
|
||||||
}
|
}
|
||||||
if (sn && sn->level) {
|
if (sn && sn->level) {
|
||||||
dlevel +=
|
dlevel +=
|
||||||
(sn->level + 1 - sn->weeks / (sn->level + 1.0)) * u2->number;
|
(sn->level + 1 - sn->weeks / (sn->level + 1.0)) * dst->number;
|
||||||
level += sn->level * u2->number;
|
level += sn->level * dst->number;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlevel = dlevel / (n + u2->number);
|
dlevel = dlevel / (n + dst->number);
|
||||||
level = level / (n + u2->number);
|
level = level / (n + dst->number);
|
||||||
if (level <= dlevel) {
|
if (level <= dlevel) {
|
||||||
/* apply the remaining fraction to the number of weeks to go.
|
/* apply the remaining fraction to the number of weeks to go.
|
||||||
* subtract the according number of weeks, getting closer to the
|
* subtract the according number of weeks, getting closer to the
|
||||||
|
@ -1007,15 +1007,15 @@ void transfermen(unit * u, unit * u2, int n)
|
||||||
}
|
}
|
||||||
if (level) {
|
if (level) {
|
||||||
if (sn == NULL)
|
if (sn == NULL)
|
||||||
sn = add_skill(u2, sk);
|
sn = add_skill(dst, sk);
|
||||||
sn->level = (unsigned char)level;
|
sn->level = (unsigned char)level;
|
||||||
sn->weeks = (unsigned char)weeks;
|
sn->weeks = (unsigned char)weeks;
|
||||||
assert(sn->weeks > 0 && sn->weeks <= sn->level * 2 + 1);
|
assert(sn->weeks > 0 && sn->weeks <= sn->level * 2 + 1);
|
||||||
assert(u2->number != 0 || (sn->level == sv->level
|
assert(dst->number != 0 || (sn->level == sv->level
|
||||||
&& sn->weeks == sv->weeks));
|
&& sn->weeks == sv->weeks));
|
||||||
}
|
}
|
||||||
else if (sn) {
|
else if (sn) {
|
||||||
remove_skill(u2, sk);
|
remove_skill(dst, sk);
|
||||||
sn = NULL;
|
sn = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1023,32 +1023,32 @@ void transfermen(unit * u, unit * u2, int n)
|
||||||
while (a && a->type == &at_effect) {
|
while (a && a->type == &at_effect) {
|
||||||
effect_data *olde = (effect_data *)a->data.v;
|
effect_data *olde = (effect_data *)a->data.v;
|
||||||
if (olde->value)
|
if (olde->value)
|
||||||
change_effect(u2, olde->type, olde->value);
|
change_effect(dst, olde->type, olde->value);
|
||||||
a = a->next;
|
a = a->next;
|
||||||
}
|
}
|
||||||
sh = leftship(u);
|
sh = leftship(u);
|
||||||
if (sh != NULL)
|
if (sh != NULL)
|
||||||
set_leftship(u2, sh);
|
set_leftship(dst, sh);
|
||||||
u2->flags |=
|
dst->flags |=
|
||||||
u->flags & (UFL_LONGACTION | UFL_NOTMOVING | UFL_HUNGER | UFL_MOVED |
|
u->flags & (UFL_LONGACTION | UFL_NOTMOVING | UFL_HUNGER | UFL_MOVED |
|
||||||
UFL_ENTER);
|
UFL_ENTER);
|
||||||
if (u->attribs) {
|
if (u->attribs) {
|
||||||
transfer_curse(u, u2, n);
|
transfer_curse(u, dst, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scale_number(u, u->number - n);
|
scale_number(u, u->number - n);
|
||||||
if (u2) {
|
if (dst) {
|
||||||
set_number(u2, u2->number + n);
|
set_number(dst, dst->number + n);
|
||||||
hp -= u->hp;
|
hp -= u->hp;
|
||||||
u2->hp += hp;
|
dst->hp += hp;
|
||||||
/* TODO: Das ist schnarchlahm! und gehoert nicht hierhin */
|
/* TODO: Das ist schnarchlahm! und gehoert nicht hierhin */
|
||||||
a = a_find(u2->attribs, &at_effect);
|
a = a_find(dst->attribs, &at_effect);
|
||||||
while (a && a->type == &at_effect) {
|
while (a && a->type == &at_effect) {
|
||||||
attrib *an = a->next;
|
attrib *an = a->next;
|
||||||
effect_data *olde = (effect_data *)a->data.v;
|
effect_data *olde = (effect_data *)a->data.v;
|
||||||
int e = get_effect(u, olde->type);
|
int e = get_effect(u, olde->type);
|
||||||
if (e != 0)
|
if (e != 0)
|
||||||
change_effect(u2, olde->type, -e);
|
change_effect(dst, olde->type, -e);
|
||||||
a = an;
|
a = an;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ extern "C" {
|
||||||
|
|
||||||
void set_level(struct unit *u, skill_t id, int level);
|
void set_level(struct unit *u, skill_t id, int level);
|
||||||
int get_level(const struct unit *u, skill_t id);
|
int get_level(const struct unit *u, skill_t id);
|
||||||
extern void transfermen(struct unit *u, struct unit *u2, int n);
|
extern void transfermen(struct unit *src, struct unit *dst, int n);
|
||||||
|
|
||||||
int eff_skill(const struct unit *u, const struct skill *sv, const struct region *r);
|
int eff_skill(const struct unit *u, const struct skill *sv, const struct region *r);
|
||||||
int effskill_study(const struct unit *u, skill_t sk, const struct region *r);
|
int effskill_study(const struct unit *u, skill_t sk, const struct region *r);
|
||||||
|
|
Loading…
Reference in New Issue