Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] Re: (PR#13723) barbarian creation starts invalid revolutio
Home

[Freeciv-Dev] Re: (PR#13723) barbarian creation starts invalid revolutio

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#13723) barbarian creation starts invalid revolution
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Aug 2005 11:31:06 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Per I. Mathisen wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13723 >
> 
> On Sat, 20 Aug 2005, Jason Short wrote:
> 
>>The attached patch fixes the crash in the simplest way.This should
>>probably apply to 2.0 also.Note this does change the behavior since
>>the revolution now won't end until the AI sets a government.But maybe
>>that's the intent.
>>
>>Per, please comment.
> 
> 
> At least for 2.1, we should set
> 
>    barbarians->government = nation->init_government;

...and for 2.0 we should use game.default_government.  These patches 
make the needed changes.

-jason

Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.99
diff -p -u -r1.99 barbarian.c
--- server/barbarian.c  18 Aug 2005 06:44:28 -0000      1.99
+++ server/barbarian.c  22 Aug 2005 18:12:01 -0000
@@ -153,8 +153,8 @@ static struct player *create_barbarian_p
 
   sz_strlcpy(barbarians->username, ANON_USER_NAME);
   barbarians->is_connected = FALSE;
-  barbarians->government = game.government_when_anarchy;
-  barbarians->revolution_finishes = 1;
+  barbarians->government = nation->init_government;
+  assert(barbarians->revolution_finishes < 0);
   barbarians->capital = FALSE;
   barbarians->economic.gold = 100;
 
Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.157.2.5
diff -p -u -r1.157.2.5 player.c
--- common/player.c     19 Apr 2005 22:05:57 -0000      1.157.2.5
+++ common/player.c     22 Aug 2005 18:13:34 -0000
@@ -92,6 +92,7 @@ void player_init(struct player *plr)
   sz_strlcpy(plr->username, ANON_USER_NAME);
   plr->is_male = TRUE;
   plr->government=game.default_government;
+  plr->target_government = game.default_government;
   plr->nation = NO_NATION_SELECTED;
   plr->team = TEAM_NONE;
   plr->is_started = FALSE;
Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.79.2.2
diff -p -u -r1.79.2.2 barbarian.c
--- server/barbarian.c  9 Dec 2004 16:28:10 -0000       1.79.2.2
+++ server/barbarian.c  22 Aug 2005 18:13:35 -0000
@@ -125,8 +125,8 @@ static struct player *create_barbarian_p
 
   sz_strlcpy(barbarians->username, ANON_USER_NAME);
   barbarians->is_connected = FALSE;
-  barbarians->government = game.government_when_anarchy; 
-  barbarians->revolution_finishes = 1;
+  barbarians->government = game.default_government;
+  assert(barbarians->revolution_finishes < 0);
   barbarians->capital = FALSE;
   barbarians->economic.gold = 100;
 

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