Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2002:
[Freeciv-Dev] Re: no end turn when player splits
Home

[Freeciv-Dev] Re: no end turn when player splits

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: Freeciv Developers ML <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: no end turn when player splits
From: Davide Pagnin <nightmare@xxxxxxxxxx>
Date: 31 Oct 2002 01:51:03 +0100

On Tue, 2002-10-29 at 17:57, Per I. Mathisen wrote:
> In game "endofturnbug.sav.gz" in incoming, an AI player has just split.
> End turn ceases to work.

That savegame is 'strange', seems that someone has played by hand with
that a little bit, anyway there seems to be many little or big problems
in the split_player function inside server/plrhand.c

NOTE: I've uploaded a new savegame called noendturn.sav.gz, it is more
'sane' and you can test the various problems and bugs and the patch that
fixes them all.@

> 
> Missing initialization of something in split player function?
> 
> Reported by Pawel_Sokolowski on #freeciv
> 
>   - Per
> 

The patch I'm submitting fixes the main problem:
- pplayer->turn_done = TRUE;
(pplayer is the player that has lost its capital and that has been
victim of a civil war, thus no reason to ending its turn!)

The second problem, which is 'cosmetic'
-  pplayer->revolution = 1;
+  cplayer->revolution = 1;
cplayer is a new AI player, thus its 'revolution' will end up really
soon, but IT IS important not to set pplayer revolution at that point!

This is needed at least in a special case,
if pplayer->government==anarchy AND pplayer->revolution==0,
without this change, the player is prompted to choose a new
government but the government isn't really changed!:
-  pplayer->government = game.government_when_anarchy;
-  pplayer->revolution = 1;
+  if (pplayer->government != game.government_when_anarchy) {
+    pplayer->government = game.government_when_anarchy;
+    pplayer->revolution = 1;
+  }
There are other possible solution, so fell free to suggest other, but
take care of the special case I have spoken above.

Those are not needed, because pplayer government is set to anarchy!:
-  pplayer->economic.tax = PLAYER_DEFAULT_TAX_RATE;
-  pplayer->economic.science = PLAYER_DEFAULT_SCIENCE_RATE;
-  pplayer->economic.luxury = PLAYER_DEFAULT_LUXURY_RATE;



        Happy review!
        Ciao, Davide

Attachment: noendturnfix.patch
Description: Text Data


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