Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] Re: (PR#9899) Assertion failed: cont > 0, file improvement
Home

[Freeciv-Dev] Re: (PR#9899) Assertion failed: cont > 0, file improvement

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bh@xxxxxxxxxxxxxxxxxxx, brett.albertson@xxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9899) Assertion failed: cont > 0, file improvement.c, line 289
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 1 Sep 2004 22:22:15 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9899 >

Benoit Hudson wrote:

> Question: why does dio take an int* rather than returning int?  If we
> just made it return int, everything would be peachy.

The dio functions can conceivably handle any type, not just scalars. 
See dio_get_effect.  However some types are hard-coded in the python 
code and this I do not understand.

> Enums pose a special problem all their own.  I don't see how we can do
> anything with them but:
>         int tmp;
>         dio(&tmp);
>         myenum = tmp
> solution.

Indeed.  However this can be done "automatically" by making the field in 
the packet struct an int.  For instance packets.def has

   type CLAUSE          = uint8(enum clause_type)

meaning the packet struct uses the enum clause_type, and we have a 
problem.  However if this were

   type CLAUSE           = uint8(uint8)

then there would be no cast needed later, but the conversion would be 
done automatically when the packet struct was filled out.

jason




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