Note I'm also not familiar with this part of the code. I had a quick
look and more places test the whether the returned location is equal to the
requested location.
Don't forget, WML can also teleport the unit during the moveto event.
> 1.
> We could add another bool parameter to these methods. I don't like that
much
> because we then have two return values, a "real" one and an output
> parameter. Not really intuitive.
This could be made a pointer with a default of 0 so the parameter is
optional. I don't think this is too ugly.
That works
> 2.
> We could add the ambush information to the return value by making a
> structure or something out of it, that contains the location and the
bool.
> Doesn't look very elegant to me either.
Looks ugly to me.
Ugly? I think this is probably the cleanest and best solution (probably
because I prefer return values instead of in/out parameters). I believe if
you define the struct with a constructor based on location, you could just
return location and the struct would be implicitly constructed. However, if
you don't want to define a new struct you could return an
std::pair<location,bool>.
> 3.
> We could use a global variable for this. Urgh. Don't like that.
Globals are the root of all evil
Right, that would be just asking for trouble.
--
Patrick a.k.a. Sapient
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev