adonthell-devel
[Top][All Lists]
Advanced

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

Re: [Adonthell-devel] Items, take 2 (or 3)


From: Kai Sterker
Subject: Re: [Adonthell-devel] Items, take 2 (or 3)
Date: Mon, 20 Jan 2003 01:19:41 +0100

On Sun, 19 Jan 2003 11:36:30 +0100 Kai Sterker wrote:

> To tell the truth, I haven't tested the code yet, so I am not entirely
> certain whether above works without problems. But I don't see any
> reason why it shouldn't. I'll definitely try it out this evening. Then
> you'll hear from me.

Okay, here we go:

To see the new item stuff working, update your code from CVS, configure
with --enable-tools, compile and install.

Next, extract the attached tarball to src/tools/pydonthell/. It contains
the following files:

item.py         the item superclass
torch.py        torch template
make-items.py   script to create a few items required by item-test.py
item-test.py    item test

First, run 'pydonthell make-items.py' to create a couple of torch-items
(small_torch.item, large_torch.item and burnt_torch.item)

Then run 'pydonthell item-test.py' to see above items in action. Press
CTRL+C to quit.

That's it. Feel free to experiment!

Kai


P.S: I encountered one problem: SWIG does support method overloading
since a few versions, so I tried to make use of that with item_base.
However, when I called item_base.put_state ("some_item.item"), SWIG did
not recognize that "some_item.item" was of type _p_string, and so it
failed to find the corresponding overloaded method. Reason is that
we're using typemaps to pass python strings as STL strings. But SWIG's
typechecker obviously does not take this into account. Makes me wonder
whether that is fixed in 1.3.17. Guess I'll try that out soon. For now,
I just have worked around the problem by not using method overloading.

Of course, it would be much cooler if we could use overloading. It would
allow us to turn code like

    mytorch = adonthell.item_base ()
    mytorch.load ("small_torch.item")

into the much simpler 

    mytorch = adonthell.item_base ("small_torch.item")


Another problem is the time_event handler. It's not working correctly
when paused events are in its list, as you'll notice ;). Too late to fix
that though. Actually, fixing this bug might also fix some weirdnesses
encountered in Waste's Edge :).

Attachment: item-test.tar.gz
Description: GNU Zip compressed data


reply via email to

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