[CF-Devel] Function weirdness
crossfire-devel at archives.real-time.com
crossfire-devel at archives.real-time.com
Thu Dec 18 12:53:26 CST 2003
I think there's something weird with this function (from server/apply.c):
static void eat_item(object *op,char *item, int nrof)
{
object *prev;
prev = op;
op=op->below;
while(op!=NULL) {
if (strcmp(op->arch->name,item)==0) {
if (op->nrof >= nrof) {
decrease_ob_nr(op,nrof);
return;
} else {
decrease_ob_nr(op,op->nrof); <<<<<<<<
nrof -= op->nrof; <<<<<<<<
}
op=prev;
}
prev = op;
op=op->below;
}
}
Since decrease_ob_nr will remove the item and more important set op->nrof to 0
(check decrease_ob_nr, object.c:1655), it seems that nrof will not get decreased
in this case...
I suggest inverting the 2 lines :)
Nicolas 'Ryo'
_______________________________________________
crossfire-devel mailing list
crossfire-devel at lists.real-time.com
https://mailman.real-time.com/mailman/listinfo/crossfire-devel
More information about the crossfire
mailing list