Well I've been fooling with it all night, and I've yet
to succeed in making it work right.  The
affect_enchant part works fine (go figure :P), but I'm
not exactly sure what you mean to do for the other
part.  I understand why my logic is flawed, just not
too sure what to do.  I haven't touched any code in 3
years, and this is the first project I'm tackling.
-Matt Foltz

> The second major problem you have is that your logic
> is completely wrong.
> 
> for (each affect on the object)
>       if ( this affect is the right one )
>               modify it
>               return
>       else
>               create a new affect and add it to the object
> 
> The code as is will work correctly in exactly one
> case: the obj index
> has one affect, and it is not the one you're
> changing.  In all other
> cases, it will do the wrong thing.
> 
> You should not be creating a new affect for each
> non-match you see.  You
> should create exactly one new affect if no matching
> affect was found.
> 
> Since your for loop returns if it finds the right
> one, the code after
> the for loop will never get run if the affect is
> found.  This is where
> you want the code to create a new affect.
> 
> 
> Dennis
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

Reply via email to