forked from github/server
Merge pull request #382 from ennorehling/develop
coverity scan fixes / help
This commit is contained in:
commit
a2ac68197d
|
@ -2898,11 +2898,12 @@ static void expandloot(region * r, request * lootorders)
|
|||
if (!norders)
|
||||
return;
|
||||
|
||||
for (i = 0; i != norders && rmoney(r) > TAXFRACTION * 2; i++) {
|
||||
for (i = 0; i != norders && startmoney > TAXFRACTION * 2; i++) {
|
||||
change_money(oa[i].unit, TAXFRACTION);
|
||||
oa[i].unit->n += TAXFRACTION;
|
||||
/*Looting destroys double the money*/
|
||||
rsetmoney(r, rmoney(r) - TAXFRACTION * 2);
|
||||
startmoney = startmoney - TAXFRACTION * 2;
|
||||
rsetmoney(r, startmoney);
|
||||
looted = looted + TAXFRACTION * 2;
|
||||
}
|
||||
free(oa);
|
||||
|
|
|
@ -187,6 +187,7 @@ resource_type *rt_get_or_create(const char *name) {
|
|||
else {
|
||||
rtype->_name = _strdup(name);
|
||||
rt_register(rtype);
|
||||
return rt_find(name);
|
||||
}
|
||||
}
|
||||
return rtype;
|
||||
|
|
|
@ -2978,7 +2978,7 @@ spellbook * get_spellbook(const char * name)
|
|||
spellbook * result;
|
||||
void * match;
|
||||
|
||||
if (cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0)) {
|
||||
if (cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0) > 0) {
|
||||
cb_get_kv(match, &result, sizeof(result));
|
||||
}
|
||||
else {
|
||||
|
@ -2990,9 +2990,11 @@ spellbook * get_spellbook(const char * name)
|
|||
log_error("cb_insert failed although cb_find returned nothing for spellbook=%s", name);
|
||||
assert(!"should not happen");
|
||||
}
|
||||
cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0);
|
||||
result = 0;
|
||||
if (cb_find_prefix(&cb_spellbooks, name, strlen(name), &match, 1, 0) > 0) {
|
||||
cb_get_kv(match, &result, sizeof(result));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue