On 17/04/2009, William Yount <wyo...@gmail.com> wrote:
> I realize this is a very basic question, but how else to learn than to ask?
> I have downloaded the source code for learning purposes. However, I am not
> sure where to start. I assume that there is a "main" file like in most other
> programs, but I can't seem to find it. I am just trying to start from the
> beginning and see if I can follow along with the code.
I suggest you use a c source code inspection tool like cscope, or
a "find/follow function call" feature if your ide has it. It is very useful
especially when learning a new code base to trace out the code
paths to see what everything is doing and where it is defined.
I'll give you an overview to get you started, and maybe later other
people can expand on it. You could try doc/HACKING and other
readme files there, but they are pretty vague and out of date.
Freeciv is designed as a client/server program, with the server hosting
games and the client used by users to play. The directory structure in
the source tree reflects this with the client/ subdirectory holding all code
specific to the client program, and similarly for the server/ directory.
The other directories are part of both the client and server programs
and contain functions used by both (ai/, common/, utility/) and run-time
data (data/, po/), among other things.
The client tree is further split into the client core (client/) and various
gui front ends (e.g. gui-gtk-2.0/ gui-sdl/). Because some gui libraries
like to do tricky things with the main() function, like using #define to
hijack it and replace it by their own, it is defined for each gui separately
(e.g. in gui_main.c for gtk2) and is usually just a call to client_main()
(in client_main.c) back in the client core.
I think it would be great to make a wiki page that further adds to and
expands on the above, since doc/HACKING is terribly out of date. I'll
do this eventually, unless someone beats me to it. ;)
Freeciv-dev mailing list