Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9828) RFC: remove unnecessary dataio functions

[Freeciv-Dev] (PR#9828) RFC: remove unnecessary dataio functions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9828) RFC: remove unnecessary dataio functions
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Aug 2004 17:06:15 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: >

Lots of times arrays in the packets code are implemented as


   type EFFECT            = effect(struct impr_effect)

     EFFECT effects[255];





this is just ugly: it makes it hard to change anything because you never 
get any warning when things break (this has happened to me several 
times).  And it conceals the dataio code that actually is necessary 
(although I'm not quite sure which that is).

packets.def should be able to handle this.  And in fact it can: you just 
have to split up the array.  In the new code, the dataio.c code is 
removed and packets.def becomes


     SINT32 effect_field1[255];
     BOOL effect_field2[255];
     UINT8 effect_field3[255];

and the packet-sending and packet-receiving code is changed to 
initialize each packet.

The delta generator _should_ have support for multi-field arrays.  But 
since it does not, I think the latter way to do it is quite a bit better.

Note that in the effects patch, Vasco made an entirely new packet to 
send the effects data rather than use dataio code.  IMO this is inferior 
to using split arrays (as above).  But it does show how the dataio 
system is hard to use.


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9828) RFC: remove unnecessary dataio functions, Jason Short <=