Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [Patch] Watchtower version 2
Home

[Freeciv-Dev] Re: [Patch] Watchtower version 2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Patch] Watchtower version 2
From: Bert Buchholz <bertbuchholz@xxxxxx>
Date: Wed, 29 Aug 2001 04:38:39 +0200

On Mon, Aug 27, 2001 at 03:16:48PM +0100, Gregory Berkolaiko wrote:
>  --- Bert Buchholz <bertbuchholz@xxxxxx> wrote: 
> > Okay, here the second version of my watchtower patch, I hope I included
> > everything that was discussed so far, but after all, I'm just a German.
> > ;-)
> 
> What do you mean "just a German"?

Err, well, nothing really, it's just one of my incredibly stupid, not
funny jokes (this is my speciality, making jokes that are not funny!).

> Anyway, the patch is much better but not there yet.
> 
> Problems:
> 1. Upgrading part is not handled correctly.

I suppose you mean this part from upgrade_unit()? Hmm, I can't see
anything wrong with it.

 ___
´punit->type = to_unit;

 if (map_get_tile(punit->x, punit->y)->special & S_FORTRESS
     && unit_profits_of_watchtower(punit))
   unfog_area(pplayer, punit->x, punit->y, get_watchtower_vision(punit));
 else
   unfog_area(pplayer,punit->x,punit->y, get_unit_type(to_unit)->vision_range);

 fog_area(pplayer,punit->x,punit->y,range);
`---

If it's a ground unit and in a fortress, it's vision_range will be
calculated by get_watchtower_vision(), otherwise it gets the
vision_range of it's new type, then it's old v_r is fogged. I looked
really carefully, but I still don't know what you mean. Maybe another
hint? Am I getting on your nerves already? :-)

> 2. Do freetext search for vision_range.  Most hits are irrelevant but
> some are useful, e.g. waking up sentried units when enemy appears in the
> range.

Thanks, it's incredible how much you can overlook if you're not really
into that code. :-) One part I found was the waking up from sentry and
2nd cancelling patrol. I hope, there are no more, I think I went through
all of them, but well you know, after all, I'm just a... ah, you know
that one? Shit! ;-)

> 3. In
>   +  /* Enhace vision if unit steps into a fortress, only if its a
>   +     groundunit */
> the bit about groundunit is redundant ;)

Oh my... :-)

> > - A unit gets killed inside a fortress (vr reduced)
> make sure "gets disbanded" is handled in the "gets killed" case (I think
> it does)

Yes, it does, I checked. It's remove_unit_sight_points() which is called
in both cases.

> > Another issue: Having in mind this change of visionrange-"calculation"
> > to a somewhat more fine grained version, it might be useful to replace
> > every 
> > 
> > unfog_area(unit_owner(punit), punit->x, punit->y,
> >                get_unit_type(punit->type)->vision_range);
> > 
> > with something like
> > 
> > unfog_area(unit_owner(punit), punit->x, punit->y,
> >                get_vision_range(punit));
> >                ^^^^^^^^^^^^^^^^^^^^^^^
> I think this is how the things should be done.
> Unfortunately you will also need to pass coordinates x,y to
> get_vision_range, not just get them from punit.

Yes, I see, the coords must be passes as well.

But I leave it out in this version, maybe later. I think (as others)
that code should be extended slowly step by step.

Bert


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