[airstrike] Changes in the Airstrike message handling
Ulf Ekström
uekstrom at gmail.com
Thu Jan 6 18:44:07 EST 2005
Hi
Eero Tamminen wrote:
> Hi
> I have done the following changes in the Airstrike message handling:
> * Sprite message handling functions return an int instead of a message
> * AI message handling functions return an int instead of a message
> * The new message handling return values are:
> MSG_RET_UNKNOWN = 0,
> MSG_RET_ACK,
> MSG_RET_YES,
> MSG_RET_NO
Maybe YES and ACK can be unified to YES?
> * Corresponding message functions have now been removed
> (msg_unknown() has been replaced with msg_none() for the scheduler)
> * I've replaced the msg_ask() and msg_is_true() message functions with
> a single sprite_ask() function for querying about sprite capabilities. It
> will ask the sprite (e.g. MSG_HAS_AI, MSG_ACCEPT_BONUSES) and will check
> whether the return value is MSG_RET_YES. It's currently in msg_types.h,
> but might be moved to sprite.h (except that it knowns about message
> internals...)
ok, nice.
> Now, if one wants to query e.g. biplane for it's target (which will in turn
> ask it's AI for that information), there needs to be a new messages like:
> msg_t msg_set_target_pointer(sprite_t **target);
> sprite_t **msg_get_target_pointer(msg_t msg);
> The caller getting it's pointer back modified (to point to the target)
> should then do referencing etc. required stuff.
>
> The reason for this change is that this way we don't get dangling pointers
> so easily or at least it will be a bit more explicit (you have a specific
> message for it :-)).
Yup, I think this is the right way. I will start adding and fixing
stuff on sunday.
I will probably be in #airstrike on irc.freenode.net if anyone likes to join in.
Ulf
More information about the airstrike
mailing list