[Freeciv-Dev] (PR#5672) Changing production categories when having to mu
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
[ue80@xxxxxxxxxxxxxxxxxxxxx - Tue Sep 2 21:07:52 2003]:
> On Tue, Sep 02, 2003 at 01:39:49PM -0700, Jason Short wrote:
> >
> > [ue80@xxxxxxxxxxxxxxxxxxxxx - Mon Sep 1 18:51:48 2003]:
> >
> > > Set production in a size 1 city to settlers. Wait until you have 200
> > > shields, change the production to warrior and set the next item in the
> > > worklist to foo (foo item from improvement/wonder) You get the warrior
> > > and have ~ 190 shields for the wonder or improvement. That
shouldn't be
> > > possible. You should lose 95 shields when doing that.
> >
> [...]
> >
> > Here's a patch. It's more complicated than I would have thought since
> > an extra piece of data has to be sent all around: the city's surplus
> > from the previous turn.
> >
> > Please test. Design board, please comment.
>
> When having 600 wondershields change production to pyramids and building
> a military unit next the 400 remaining shields are penalized, but
> when changing back to a wonder you don't get the full shields. Think that
> shouldn't be.
Here is what happens:
You change from Magellan's to Pyramids. You finish building the
pyramids in between turns, and the governor chooses a harbor (an
improvement, not a wonder!) for you to build next. When this happens
the production is halved since pcity->last_built is Magellan's (which is
incorrect; it should be pyramids). Then at the beginning of the next
turn pcity->last_built is reset to be the harbor. So if you then change
production to be another wonder, production will stay halved. But if
you change it to be another improvement (including a harbor...you may
have to switch and switch back) you'll get the full production (since
last_built is the harbor...again incorrect; it should be pyramids).
It's tricky to reproduce since usually the governor will just have you
make another wonder...but if you build Darwin's it'll usually choose
something different for you, it seems.
The clean fix I think is that define_orig_production_values needs to be
called _before_ production is calculated. So the last_built values are
set to what was being produced at the end of last turn, not necessarily
what's being produced at the beginning of this turn. This makes sense
if you consider what this value means: all of the shields in the project
have been dedicated toward the production type we were building last
turn, so even if the governor changes the production (as it has to when
an improvement is completed) you should be able to change it back
without penalty.
The attached patch does this, with suitable comments. It leaves one
empty function that should eventually be removed (but this gets back
into the end-of-turn ordering discussion, which this patch shouldn't
really have to deal with IMO).
jason
production_penalties-2.diff
Description: production_penalties-2.diff
[Freeciv-Dev] (PR#5672) Changing production categories when having to much shields,
Jason Short <=
[Freeciv-Dev] (PR#5672) Changing production categories when having to much shields, Jason Short, 2003/09/05
|
|