> > Great. Would you be interested in sharing how the code needs to be
> > cleaned up? Perhaps I can help with making the changed necessary to
> > making this work.
> >
> >   - Andreas
> Have a look at the source code and the attached patches. At the moment all
> player slots are statically allocated. I did try to change this to a player
> list. Therefore I first renamed some functions (to player_id() and
> player_by_name()). After that I wanted to do all at once, but this did not
> work. At that time I also got the feeling that small steps are needed. But
> as the player definition and also the map definition are one of the basic
> data of freeciv it is interconnected with all the code.
> At the end I through about this roadmap:
> 1) implement players as pointer
> 2) add player_list
> 3) make the required changes to the player struct (step by step)
> 4) increase the number of players
> Do not expect the patches to apply cleanly or even to work. They are based
> on the svn from 2010-04-21 patch 'Add utilities to make safe operations on
> UTF-8 strings.'. I do not have the svn ID as I import the svn into a git
> repo.

Some additional ideas how to do this (I pondered this a long time) :

- if the number of player is increased, the player struct should be defined as 

- some data in the struct is saved for each player (diplstat), thus old player 
*must not* be removed; else one cannot access this data using the player id 
(= index of the player in the corresponding list)

- as result, the player struct should be divided into two parts; one with the 
basic data (name) and one with all the data only needed if the player is 

- speclist.h should be used for the list of players and also the additional 
data per player (player->diplstat)

- there should be functions to add a player (to the list of players and also 
to the diplstat of *each* player) and to kill a player (remove the variable 
data part and set the diplstat to a defined state)

- the network protocol and the client have to be checked (can they handle the 

My TODO list is at the moment as follows (no guarantee and no deadline; I 
could even stop ...):

short time:
- bug fixes and small changes (gtk client)

long time:
- merge longturn
- check enums / code cleanup

far away:
- save ruleset in one file and use it to send the ruleset to the clients
- savegame cleanup (and save ruleset in savegame)

far far away:
- mapimg (save an image of the map for each turn; this is at the moment at the 
end of the list, but a nice project; once upon a time parts of it were 
working ...)

- loyal citizens
- more players
- larger maps
- ...


> I have to do other things at the moment and freeciv is only a tool to
> distract me ... (but the original task has to be done!)
> Matthias
Matthias Pfafferodt - http://www.mapfa.de
Matthias.Pfafferodt <at> mapfa.de

Freeciv-dev mailing list

Reply via email to