Follow-up Comment #10, patch #2851 (project wesnoth):

I think that we agree on the what, but not the naming of things.

I like your example of class methods listening to the global event.  It is
perfect.  While not being a WML aficionado, I think that the context should be
more general than unit type.  The context should be the smallest enclosing wml
tag that makes sense.  Then people can attach event handlers to wml regions,
castles etc.

I don't think that we need approach it as a function calling a function.  I
was thinking of something along the following lines.
1. The die event is fired.
2. Do I have any global die event handlers?  If yes run them.
3. What scope/wml class am I in[Necrophage]?  Do I have handlers for
[Necrophage].  If so run them.

It is a considerable departure.  Either the handler itself needs to know how
to determine its wml scope/wml class or the handler launcher does.  I'd stick
it in the handler itself.  Currently it only does a string match on the event
name.  It could match based on more refined information.  This would change
step 2 above into Can you handle this (event, context)? 

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?2851>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to