[Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Dec 04, 2001 at 05:08:56PM +0000, Gregory Berkolaiko wrote:
> >
> > Hey, what do you mean by "separation"?
>
> Encapsulation. Or in another way: no global variables. The goto code
> is a good example: consider the global warmap is gone. Now all access
> is done through functions/macros. These can be either of the form:
> "get_cost_of_field(x,y)" (which would be a 1:1 mapping to the current
> direct access) or to something like
> "get_path_into_struct(start_x,start_y,end_x,end_y, various unit
> attributes (like type, current, fuel, owner), struct path *result)"
> This struct contains the path to take and the costs at the various
> steps. This is what I want to achieve. And what I implemented (and if
> I would have more time I would really be pushing this (into the CVS)).
send me your code, let's see if I can finish it.
> > I thought you want to remove seacost field from warmap and do
> everything
> > on one map (well, I agree it's more unification than separation)...
>
> Separation between parts of the code. Each part (AI, server, gotohand
> in this example) have a clean interface which is exposed. And a global
> warmap variable isn't a clean interface as may already known.
agreed
> > No I want runtime info. You see warmap is generated once and then
> used
> > all over and then once again generated and many times used... I want
> to
> > know which access corresponds to which generation.
>
> You can do a search-and-replace and replace
> "warmap\.(sea)?cost[.*?][.*?]" with "get_warmap(\1,\2,\3)".
suppose I write a get_warmap_cost function
what I don't know how to do is to print the file:line info of the code
that called get_warmap_cost
Any comments on the below?
> > generate_warmap tell you answer to the question
> > "where unit A can go from where it is now"?
> >
> > if you want an answer to the question
> > "where unit A can go from city C which is over there"
> > you'd have to access _really_generate_warmap directly.
> >
> > Example:
> > http://www.freeciv.org/lxr/source/server/settlers.c?v=cvs#L960
> >
> > There punit wants to know where ferryboat can take him by sea from
> mycity
> > (ferryboat is somewhere far away).
> >
> > Two lines below punit want to know where it can go by land: another
> > place where land- and sea- warmaps must coexist.
G.
________________________________________________________________
Nokia 5510 looks weird sounds great.
Go to http://uk.promotions.yahoo.com/nokia/ discover and win it!
The competition ends 16 th of December 2001.
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), (continued)
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/02
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/02
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068),
Gregory Berkolaiko <=
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Petr Baudis, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/05
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), vze2zq63, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Petr Baudis, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Ross W. Wetmore, 2001/12/05
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raahul Kumar, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Ross W. Wetmore, 2001/12/05
|
|