[Freeciv-Dev] (PR#13910) A_UNSET isn't used
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13910 >
> [jdorje - Wed Sep 07 16:40:00 2005]:
>
> > [mstefek - Wed Sep 07 08:42:52 2005]:
> >
> > > [jdorje - Wed Sep 07 08:23:01 2005]:
> > >
> > > When I finish researching the target and there is no goal set, the
new
> > > research target is supposed to be changed to unset.
> > >
> > > Instead, in the development version the server picks another tech
> for me
> > > to research.
> > >
> > > -jason
> > >
> > Your patch in #13385 in update_tech():
> >
> > + /* At the end of the turn an unset tech target will lead to one being
> > + * picked randomly. You can't save bulbs over between turns. */
> > + if (research->researching == A_UNSET) {
> > + choose_random_tech(plr);
> > + }
> > + assert(research->researching != A_UNSET);
> >
> > The server basically interates over cities and increases
> > bulbs_researched, when bulbs_researched >= total_bulbs_required it call
> > tech_researched, which changes the value of target to UNSET if there's
> > no goal. However if there is at least one city with positive science to
> > iterate over then a tech will be choosen randomly in update_tech().
> >
> > I suggest reverting that part of 13385.
A patch is attached.
> Hmm, the tech code is becoming too complicated for me to understand...
>
> That check was supposed to be done at the end of the turn, right before
> research is accumulated for the next turn. On the end-turn in which the
> tech is actually researched it's supposed to be changed to A_UNSET and
> bulbs from the rest of the end-turn can then be carried over if it's
> changed during the following turn.
There is already such a such in end_phase(). This is done before
iterating over cities to count bulbs. This sounds odd, but is perfectly ok.
> This is all part of Per's design,
> the purpose of which is to allow the player to choose all techs after
> building Darwin's even if no goal is set.
This is not so easy.
--
mateusz
Index: server/techtools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/techtools.c,v
retrieving revision 1.23
diff -u -r1.23 techtools.c
--- server/techtools.c 5 Sep 2005 04:21:55 -0000 1.23
+++ server/techtools.c 8 Sep 2005 06:35:24 -0000
@@ -460,25 +460,20 @@
int excessive_bulbs;
struct player_research *research = get_player_research(plr);
- /* At the end of the turn an unset tech target will lead to one being
- * picked randomly. You can't save bulbs over between turns. */
- if (research->researching == A_UNSET) {
- choose_random_tech(plr);
- }
- assert(research->researching != A_UNSET);
-
/* count our research contribution this turn */
plr->bulbs_last_turn += bulbs;
research->bulbs_researched += bulbs;
-
- excessive_bulbs =
+
+ if (research->researching != A_UNSET) {
+ excessive_bulbs =
(research->bulbs_researched - total_bulbs_required(plr));
- if (excessive_bulbs >= 0) {
- tech_researched(plr);
- if (research->researching != A_UNSET) {
- update_tech(plr, 0);
+ if (excessive_bulbs >= 0) {
+ tech_researched(plr);
+ if (research->researching != A_UNSET) {
+ update_tech(plr, 0);
+ }
}
}
}
|
|