[Freeciv-Dev] Re: Windows COM client
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Using COM/DCOM is a terrible idea in case you want Freeciv to retain
portability. It's much less portable than CORBA for e.g.
IMHO you have some freedom in how you can program the client bit but
changing the whole sourcecode to use Windows specific stuff is evil (TM).
Yes, i know Microsoft licensed some corp to produce ports of COM to
Unixes, but does it work in all Unixes Freeciv now runs on? Is it free?
I understand your problem. It's always hard to understand other people's
code at first. I had a hard time when i first tried to mess with the
source. I took one look at it once and got into despair almost immediatly
Then i got one free week without anything to do: i looked at the source
for 3 days and found it wasn't that hard to understand. I was just
looking at the wrong places. The source filenames mostly give you an
indication of what they are used for, the code is readable - even if
sparsely commented, and things are usually well split up and reused.
If you really want to know what i did when i started the gtk+ client port:
* copied all the files in the xaw client to one separate dir
* #ifdef'ed most of the GUI code off and tried to strip the client to the
bare bones: 'civclient.c', 'clinet.c', 'packhand.c'.
* commented most packets on 'civclient.c' to be ignored.
Now you have the stub client so you don't need to have this trouble :-)
After that i realised these are the 3 main things to support on the client:
* main window
* map in main window
* city dialog
I designed the main window by itself without looking at the code on the
Xaw client. I looked a bit at the code of someone else which had designed
a main window on gtk+ for the Freeciv client (sorry, can't remember your
Afterwards i added support for the main map important files:
Of course i had to process map packets, etc so i uncomented the code on
those at 'packhand.c' and 'civclient.c' and ported it.
Porting the Xlib code for map drawing wasn't that hard. It was mostly a
case of changing the names of GUI drawing calls/parameters. Of course,
since this was also my first serious gtk+ program, i took some 1.5 weeks
to do it.
After porting the main map, and afterwards the city window, it's a
question of patience to port the other dialogs. I suggest porting the
city list dialog (the one when you press F1) and the help dialog/menu
Still i mostly followed the Xaw client code. This way it would be easier
to backport changes. Also i did things slightly more gtk+ish in some
places but after commiting to CVS they ended up being overwritten with
Xaw like code again by someone else *doh* :-)
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa