[CF-Devel] devourers
gros
gros at magellan.fpms.ac.be
Wed May 9 08:25:56 CDT 2001
Le Mercredi 9 Mai 2001 03:01, vous avez écrit :
>
> void update_priest_flag (object *god, object *exp_ob, uint32 flag) {
>
>
>
> if(QUERY_FLAG(god,flag)&&!QUERY_FLAG(exp_ob,flag))
>
> SET_FLAG(exp_ob,flag);
>
> else if(QUERY_FLAG(exp_ob,flag)&&!QUERY_FLAG(god,flag))
>
> {
>
> if (!(QUERY_FLAG(arch_to_object(exp_ob->arch),flag)))
>
> CLEAR_FLAG(exp_ob,flag);
>
> };
>
> }
>
>
Err, arch_to_object should not be used, as that ends up creating a nice
>
memory leak (one for each functiion call).
>
>
What you really want to be doing is something like:
>
>
if (!(QUERY_FLAG(exp_ob->arch->clone,flag)))
>
The correct patch is then:
void update_priest_flag (object *god, object *exp_ob, uint32 flag) {
if(QUERY_FLAG(god,flag)&&!QUERY_FLAG(exp_ob,flag))
SET_FLAG(exp_ob,flag);
else if(QUERY_FLAG(exp_ob,flag)&&!QUERY_FLAG(god,flag))
{
if (!(QUERY_FLAG(&(exp_ob->arch->clone),flag)))
{
CLEAR_FLAG(exp_ob,flag);
};
};
}
>
>
Theres already enough memory leaks out there - we don't want to be adding
>
more.
True. Sorry for forgetting I was in C and not in Java.
Commander Gros
Ad Dwarvam Aeternam !
More information about the crossfire
mailing list