adonthell-devel
[Top][All Lists]
Advanced

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

Re: [Adonthell-devel] Saving/Loading todos


From: Kai Sterker
Subject: Re: [Adonthell-devel] Saving/Loading todos
Date: Tue, 12 Jun 2012 16:11:08 +0200

On Tue, Jun 12, 2012 at 11:18 AM, Chris Frey <address@hidden> wrote:

Didn't imagine that this was complicated as it is :-). Thought all the
logic was in group.cc, but seems it isn't the case. But we should get
it working nevertheless ...


> When I try to add specie as a new savegame object, it gets stuck at this
> point, and SWIG complains that it doesn't know what rpg::specie* is,
> or, if I don't add a GET_TYPE_NAME() macro, it doesn't know what a
> python::script* is.

When does this happen? I tried by doing just that and added stubs for
load/save that did not do anything.

So I assume it must happen during loading specie objects and actually
instanciating the underlying Python classes. From looking at py_rpg.i,
specie is already made known to SWIG and so is group. They do lack the
GET_TYPE_NAME() (GET_TYPE_NAME_VIRTUAL in case of group) macros
however, which are used by pass_instance.


> When it fails during runtime, SWIG shows a list of the types it knows,
> and things like rpg::character are not listed.

It could be that the rpg Python module is not loaded at that point, or
fails loading for some reason. (Maybe because it cannot find some of
the scripts due to incomplete searchpaths.)

Unfortunately, I do not have time to dig deeper into this, as I'll be
leaving soon, but I would try the following:

Make sure group and specie have the GET_TYPE_NAME macro properly defined.

            GET_TYPE_NAME(rpg::specie);
            GET_TYPE_NAME_VIRTUAL(rpg::group);

That's important, because pass_instance is actually called from within
group. Next, define PYTHONVERBOSE environment variable (value should
not matter). And see if this gives more clues when a module fails
loading. Post the output to the list if you can't make anything of it.

If you can identify any modules not properly found, you could use
PYTHONPATH to make sure Python knows where to look for them, at least
as a workaround until we get down to the underlying problem.


Also, if the above yields nothing, actually try uncommenting

        // rpg::specie human("Human");
        // human.get_state("groups/human.specie");

in worldtest. That was in there before and worked fine. If that works,
then it should be possible to get the serializer stuff working too.
Step through with a debugger to see what is different from the
non-working case.

Hope that helps!

Kai

P.S.: Will leave my laptop at home, this time. So if you have more
questions like that, include at least the output you get, or
stacktraces when things crash and burn. Won't be able to try anything
myself.



reply via email to

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