Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: [freeciv-ai] Re: Recovering pupeteer
Home

[Freeciv-Dev] Re: [freeciv-ai] Re: Recovering pupeteer

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [freeciv-ai] Re: Recovering pupeteer
From: nikodimka <nikodimka@xxxxxxxxx>
Date: Wed, 17 Mar 2004 09:30:52 -0800 (PST)

> If it is implemented as a separate client, why does it modify 28 files?

I have created a very long answer, but my mail
has crashed so I'm not sure if you'll get it.
So I repeat it here somewhat shorter:

the puppeteer patch includes:

o a small patch to gui-gtk to to show units' IDs on
  the canvas as shown names for cities
o some code extending agents functionality:
  agents now recieve tile change notifications 
  as they do for cities and units
o some small fixes of the build process to 
  include puppeteer
o simple historian agent 
o puppeteer agent. Not client! Agent.

the following is the puppeteer agent overview:

client/puppeteer/puppeteer.c

this is the main puppeteer file.
it has 
the initializatiuon code, 
the agent registration code
socket manipulation code
the call to the bison grammar entry point: yyparse()

client/puppeteer/parser.y:

this is where the bison grammar for the puppeteer
commands appears. 
you can find such clauses as 

LX_CAT LX_LP LX_ID LX_ID LX_RP { cat_tile_by_xy($3, $4); }
in the grammar. this should be read as:
command of the form "cat ( 15 33 )" to be executed buy
the cat_tile_by_xy() function.
(this function lives in execute.c and contains the
code which prints the full info on one tile located
at the given coordinates)

client/puppeteer/scanner.l:

this is the lexical scanner for the bison grammar.
it knows how to tell names from numbers from special 
commands etc.

client/puppeteer/execute.c:

this is where the command processing
really goes on. I have a lot of functions here:

e.g. ls_tiles() executes command "ls tiles"
printing out the list of known tiles.
exec_irrigate(int id) orders unit to irrigate etc.

also the file includes such function triples as:
exec_city_remove(int id);
exec_city_change(int id);
exec_city_new(int id);

for cities, units and tiles to react on agent 
notifications .

the rest are the .h header files.

nikodimka


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com


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