forked from github/server
fix some cppcheck warnings
This commit is contained in:
parent
9e64f66409
commit
810bf3b40a
|
@ -3999,7 +3999,7 @@ void force_leave(region *r, battle *b) {
|
|||
void do_battle(region * r)
|
||||
{
|
||||
battle *b = NULL;
|
||||
bool fighting = false;
|
||||
bool fighting;
|
||||
ship *sh;
|
||||
|
||||
fighting = start_battle(r, &b);
|
||||
|
|
|
@ -530,33 +530,6 @@ attrib_type at_target = {
|
|||
NO_READ
|
||||
};
|
||||
|
||||
unit *utarget(const unit * u)
|
||||
{
|
||||
attrib *a;
|
||||
if (!fval(u, UFL_TARGET))
|
||||
return NULL;
|
||||
a = a_find(u->attribs, &at_target);
|
||||
assert(a || !"flag set, but no target found");
|
||||
return (unit *)a->data.v;
|
||||
}
|
||||
|
||||
void usettarget(unit * u, const unit * t)
|
||||
{
|
||||
attrib *a = a_find(u->attribs, &at_target);
|
||||
if (!a && t)
|
||||
a = a_add(&u->attribs, a_new(&at_target));
|
||||
if (a) {
|
||||
if (!t) {
|
||||
a_remove(&u->attribs, a);
|
||||
freset(u, UFL_TARGET);
|
||||
}
|
||||
else {
|
||||
a->data.v = (void *)t;
|
||||
fset(u, UFL_TARGET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************/
|
||||
/* at_siege */
|
||||
/*********************/
|
||||
|
|
|
@ -141,12 +141,6 @@ extern "C" {
|
|||
struct building *usiege(const struct unit *u);
|
||||
void usetsiege(struct unit *u, const struct building *b);
|
||||
|
||||
struct unit *utarget(const struct unit *u);
|
||||
void usettarget(struct unit *u, const struct unit *b);
|
||||
|
||||
struct unit *utarget(const struct unit *u);
|
||||
void usettarget(struct unit *u, const struct unit *b);
|
||||
|
||||
const char *uprivate(const struct unit *u);
|
||||
void usetprivate(struct unit *u, const char *c);
|
||||
|
||||
|
|
|
@ -320,11 +320,12 @@ int walkingcapacity(const struct unit *u)
|
|||
|
||||
/* Genug Trolle, um die Restwagen zu ziehen? */
|
||||
wagen_mit_trollen = u->number / 4;
|
||||
if (wagen_mit_trollen > wagen_ohne_pferde) wagen_mit_trollen = wagen_ohne_pferde;
|
||||
if (wagen_mit_trollen > wagen_ohne_pferde) {
|
||||
wagen_mit_trollen = wagen_ohne_pferde;
|
||||
}
|
||||
|
||||
/* Wagenkapazität hinzuzählen */
|
||||
n += wagen_mit_trollen * vcap;
|
||||
wagen_ohne_pferde -= wagen_mit_trollen;
|
||||
}
|
||||
|
||||
n += animals * acap;
|
||||
|
|
|
@ -144,9 +144,9 @@ void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, c
|
|||
*s = 0;
|
||||
}
|
||||
|
||||
unsigned int str_hash(const char *s)
|
||||
int str_hash(const char *s)
|
||||
{
|
||||
unsigned int key = 0;
|
||||
int key = 0;
|
||||
assert(s);
|
||||
while (*s) {
|
||||
key = key * 37 + *s++;
|
||||
|
|
|
@ -26,7 +26,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
void str_replace(char *buffer, size_t size, const char *tmpl, const char *var, const char *value);
|
||||
unsigned int str_hash(const char *s);
|
||||
int str_hash(const char *s);
|
||||
size_t str_slprintf(char * dst, size_t size, const char * format, ...);
|
||||
size_t str_strlcpy(char *dst, const char *src, size_t len);
|
||||
size_t str_strlcat(char *dst, const char *src, size_t len);
|
||||
|
|
Loading…
Reference in New Issue