Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] Re: (PR#13198) Changin Tech when goal is changed
Home

[Freeciv-Dev] Re: (PR#13198) Changin Tech when goal is changed

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#13198) Changin Tech when goal is changed
From: "Thomas Müller" <lists@xxxxxxxxxxx>
Date: Tue, 31 May 2005 03:07:19 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13198 >

Am Dienstag, 31. Mai 2005 01:33 schrieb Jason Dorje Short:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13198 >
>
> Thomas Müller wrote:
> > <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13198 >
> >
> > When you set Goal to X and research  is X, ther finish research on X and
> > 10
> >
> > bulbs are left over, yo get:
> >>Researching: None
> >>Goal: None
> >>Bulbs 10
> >
> > If you switch to Research B now, you get 10 Bulbs for B, thats good.
> >
> > If you set Goal to C, you get:
> >>Researching: None
> >>Goal: C
> >>Bulbs 10
> >
> > And next turn, you get
> >
> >>Researching: D
> >>Goal: C
> >>Bulbs 50
> >
> > Where D is a needed for C, and you research 50 Bulbs a turn. The 10 Bulbs
> > are lost. Its a bug, i could fix it, but i think it would be better, to
> > change the Research immideatly when you change the goal, and have "None"
> > has current researcht. This way, you would know, what you research next.
> > If there is already something you're researching, and goal changes, the
> > current research should be unchanged of course.
> >
> > I wrote a patch to achieve it, its my first patch, i hope i dont break
> > anything, it works with current cvs for me.
>
> The patch looks like it does what it says it does.  However I don't
> think this is a sufficient fix.  Because if the player doesn't set a
> goal then at the end of the turn the server will pick a tech for him to
> research.  And this probably also causes the bulbs to be lost.  So I
> think the bug needs to be fixed "at the source".
>
> -jason

As i wrote in my first email, i thought losing Bulbs when server chooses tech 
isnt a bug, now i remember why i thought this:

in void choose_random_tech(struct player *plr)
you find this line of code:
>if (plr->research->bulbs_researched >0) {
>  plr->research->bulbs_researched = 0;
>  }
So, it looked intentional too me. Althoug i agree, it would be nice, if the 
points were not lost. I made this patch, and tested it, seems to work. Even 
if the tech that is choosen randomly can be researched immideatly and you get 
"none" the next turn, the bulbs seem to be calculated correctly.

-- 
Tanken kommt sie deutlich billiger, wenn sie sich einen erheblich
kleineren Tank einbauen lassen.

--- plrhand.c.now       2005-05-31 12:04:36.000000000 +0200
+++ plrhand.c   2005-05-31 12:04:42.000000000 +0200
@@ -581,9 +581,6 @@
 void choose_random_tech(struct player *plr)
 {
   int chosen, researchable = 0;
-  if (plr->research->bulbs_researched >0) {
-    plr->research->bulbs_researched = 0;
-  }
   tech_type_iterate(i) {
     if (get_invention(plr, i) == TECH_REACHABLE) {
       researchable++;

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