adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Event system continued


From: Alexandre Courbot
Subject: Re: [Adonthell-devel] Event system continued
Date: Mon, 19 Apr 2004 10:38:36 +0200
User-agent: Mozilla Thunderbird 0.5+ (X11/20040305)

Hi,

Just a quick reply for your question:

Do we still have a grid? Or should map events be tied to a certain map object 
or area? Or should I leave map events for now, until we actually have a map 
again? ;-)

Let's leave them for now. Anyway they will most likely be tied to objects or delimited areas, since the grid will only be internal to the map.

So I changed things to add the get_type_name () directly to each class, thus recognizing 
a time_event, even when cast to event. The line in pass_instance is now 
arg->get_type_name () instead of get_type_name<A>(). That also has the 
advantage that the compiler complains if you try passing objects to python that don't 
provide a get_type_name method. With the old code, it would compile fine, but crash at 
runtime.

Good! So I suppose get_time_name is tied to an abstract class that every python passable object should inherit from, right?

The problem is the second call. The event will be copied into the listener, and 
the listener will free it at the end of its lifetime. However, since the event 
is created on python side, it has it's thisown set to 1, which means that 
python will also delete it. Crash! For now, one has to manually set evt.thisown 
to 0, but a nicer solution would be to have that done automatically. This can 
probably done with a SWIG typemap, or the %feature(shadow) thing.

Yes it is. We already did that for 0.3, I think.

Looking forward for your commit! :) Nice, once I have some map running we'll be able to do other things than just walking around!

Alex.
--
http://www.gnurou.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]