coverity warnings

This commit is contained in:
Enno Rehling 2017-02-14 16:23:40 +01:00
parent aa230cc191
commit 08e14f3095
2 changed files with 10 additions and 6 deletions

View File

@ -132,8 +132,12 @@ static void dict_upgrade(attrib **alist, attrib *abegin) {
ak = a_add(alist, a_new(&at_keys)); ak = a_add(alist, a_new(&at_keys));
} }
} }
if (ak) {
ak->data.v = keys; ak->data.v = keys;
if (keys) {
keys[0] = n + i; keys[0] = n + i;
}
}
} }
attrib_type at_dict = { attrib_type at_dict = {

View File

@ -2707,7 +2707,7 @@ static void expandloot(region * r, request * lootorders)
{ {
unit *u; unit *u;
unsigned int i; unsigned int i;
int looted = 0; int m, looted = 0;
int startmoney = rmoney(r); int startmoney = rmoney(r);
expandorders(r, lootorders); expandorders(r, lootorders);
@ -2724,9 +2724,9 @@ static void expandloot(region * r, request * lootorders)
free(g_requests); free(g_requests);
/* Lowering morale by 1 depending on the looted money (+20%) */ /* Lowering morale by 1 depending on the looted money (+20%) */
m = region_get_morale(r);
if (m && startmoney>0) {
if (rng_int() % 100 < 20 + (looted * 80) / startmoney) { if (rng_int() % 100 < 20 + (looted * 80) / startmoney) {
int m = region_get_morale(r);
if (m) {
/*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/ /*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/
region_set_morale(r, m - 1, -1); region_set_morale(r, m - 1, -1);
} }