adonthell-devel
[Top][All Lists]
Advanced

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

Re: [Adonthell-devel] v0.3 code update underway


From: Kai Sterker
Subject: Re: [Adonthell-devel] v0.3 code update underway
Date: Sat, 30 Apr 2016 18:57:49 +0200

First batch of changes committed after I managed to play through from start to finish with not obvious problems.

If you can, please give it a try. For instructions, see http://savannah.nongnu.org/cvs/?group=adonthell
You'll want the "adonthell-0.3" and "wastesedge" modules.

I have not yet tried it with Python 2.x, only 3.4 and 3.5. Should have an older Python on my old MacBook, so I'll test that next.

The one thing I also have not yet tried is the in-game python console. Guess that might not be working yet.

At any rate, it's amazing that even after such a long time, there's still stuff in there that made me smile :-).

Up next: more testing and implementing other stuff from my TODO list.

Kai

On Thu, Apr 28, 2016 at 12:22 AM, Kai Sterker <address@hidden> wrote:
Good news, everyone!

I've been able to play for a bit, however more thorough testing is required.


Turns out on Python side, there was another incompatibility that needed addressing:

[*] Previously, the division operator (/) would perform integer division if both operands were integers. That was something we relied upon. Well, no more with Python 3. Luckily, since Python 2.2 there's the floor division operator (//) that will still do the correct thing.

[*] More of a concern is another change in SWIGs behaviour, though. Previously, when calling a wrapped C++ method such as connect_callback(PyObject *callback, PyObject *args = NULL) on Python side with only a single argument, args would indeed be NULL. Right now they get set to Py_None. That in turn leads to issues when actually calling the callback, since Py_None is not a valid argument tuple. I've not yet figured out what is causing this change in behaviour. For now I am setting args to NULL if they come as Py_None, but I am not sure if I fixed all possible locations yet. The better thing would be to find the root cause and restore the expected behaviour.


Other than that, my TODO list just keeps growing, as other areas that may need changes come to mind.
[*] I.e. using the proper directories for configuration and savegames on Linux systems instead of stuffing everything into ~/.adonthell.

[*] And then, just today, gcc 6.1 was released. A couple days after I finally got my hands on 5.3 :-(. To make matters worse, it'll enable C++-14 by default, so there definitely will be more changes required. (And I've yet to try and compile with C++-11 turned on!)


But we'll be getting there eventually. Weekend is near and then there are some holidays over the next couple weeks as well, so time should be plenty for once. It's actually a quite fun little project for a change. Just hope I am not boring you with these little progress updates.

And yes, I should be able to commit the first part of the work this weekend.

Regards,

Kai

P.S: An invaluable resource for the upgrade to Python 3 is http://python3porting.com/, should somebody ever get into a similar situation.


On Wed, Apr 27, 2016 at 11:57 AM, Kai Sterker <address@hidden> wrote:
Actually, that is an easy one. With SWIG 3.x, integers are no longer converted to booleans automatically.

There appears to be a define (SWIG_PYTHON_LEGACY_BOOL) to restore the old behaviour, but it might be better to change the Python scripts and use the True/False boolean types present since Python 2.2.1.

I don't think limiting us to Python newer than 2.2 in this day and age would be big restriction (2.2.1 was released in April 2002).

Tonight will see the beast fully running again (I hope!) :-)

Kai

P.S.: I am also thinking of adding a bit of a version check to the configure script, to make sure SWIG and Python are compatible. Here's an incomplete list I came across right now. Need to check newer Pythons and then the details for the 2.x series, but it's a start:
   swig version:            2.0.3   2.0.4

A. python 2.x                 +       +
B. python 3.1                 +       +
C. python 3.2                 -       +


reply via email to

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