Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: civserver segfault with new research system (PR#1221)
Home

[Freeciv-Dev] Re: civserver segfault with new research system (PR#1221)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx, Juha Litola <slave@xxxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: civserver segfault with new research system (PR#1221)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Jan 2002 14:56:03 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Jan 14, 2002 at 05:27:11AM -0800, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > 
> > And here is the patch. Please test since I added another assert since
> 
> Oy-voy-voy!  Just look what happens if tech_leakage = 2 and you have an
> embassy with one player who happens to possess some technologies.  The
> cost for all these technologies will be 0!!!
> 
> >   case 2:
> >     {
> >       int players = 0, players_with_tech = 0;
> > 
> >       /* Find out how many players have tech */
> >       players_iterate(other) {
> >               if (!player_has_embassy(pplayer, other)) {
> >         continue;
> >       }
> > 
> >       players++;
> >       if (get_invention(other, tech) == TECH_KNOWN) {
> >         players_with_tech++;
> >       }
> >       } players_iterate_end;
> >  
> >       if (players > 0) {
> >       /* The player has an embassy with at least one other player */
> >       cost = ((players - players_with_tech) * cost) / players;
> >       }
> >     }
> >     break;
> 
> Well, actually not 0 but 1, but it's the same thing.
> You probably want to initialise players to 1 
> (and then remove if(players > 0) condition).
> 
> But even so, leakage mode number 2 makes little sense.

I agree with you. However the idea for all isn't from me. We have the
following choices:
 - keep it, fix it and wait for the original authors answer
 - disable it
 - remove it

> Much more sensible IMO is to have
> 
> int players = get_num_human_and_ai_players();
> cost *= (players - players_with_tech_and_embassy) / players;
> 
> That is the only difference from mode 1 is that only those with whom we
> have embassy count towards players_with_tech.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "I heard if you play the NT-4.0-CD backwards, you get a satanic message."
 "That's nothing, if you play it forward, it installs NT-4.0"


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