[Freeciv-Dev] Re: (PR#10034) no contact with adjacent player
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10034 >
Marko Lindqvist wrote:
> - AFAICT player_no for new player was not set ( -> others actually
> gained contact with undefined player) This affects barbarian creation as
> well.
> - Added assert() to make_contact()
> - ai_data_init() was called twice; in server_init_player() and
> split_player()
> - If original player had odd gold amount, one piece was lost during
> civil war. Now original player gets one gold more than created one in
> case of civil war.
> - Removed comment which no longer made sense
- Added comment about players_iterate()
- Somewhat unrelated comment fixes
- Initialize diplstate.contact_turns_left = 0
- Initialize diplomatic states as DS_NO_CONTACT instead of DS_NEUTRAL.
Second possibility was to leave diplstate as DS_NEUTRAL and to make
contact_turns_left = game.contactturns as if all other players have
fresh contact with created player.
Note that created player most likely makes contacts with other players
when cities and units of original player are divided between them.
- Caz
btw. I wonder if all things are really made in correct order in
civil_war() (or more accurately: this seems bug prune, small changes in
other parts of freeciv might easily break this.)
For instance, new player initialization has been going for some time
before 'game.nplayers++;' I don't know if it's possible to move this
upwards, but those function calls with what someone might consider
illegal player_no...
Second; ai_data_init(), assess_danger_player() are called in
split_players() - but cities and units are divided only later (original
player still thinks that he has all cities and units, new player has no
cities nor units).
diff -Nurd -X.diff_ignore freeciv/server/plrhand.c freeciv/server/plrhand.c
--- freeciv/server/plrhand.c 2004-09-11 18:08:18.828125000 +0300
+++ freeciv/server/plrhand.c 2004-09-11 23:45:58.984375000 +0300
@@ -1548,6 +1548,7 @@
if (initmap) {
player_map_allocate(pplayer);
}
+ pplayer->player_no = pplayer-game.players;
ai_data_init(pplayer);
}
@@ -1625,6 +1626,8 @@
check_city_workers(pplayer1);
check_city_workers(pplayer2);
return;
+ } else {
+ assert(pplayer_get_diplstate(pplayer2, pplayer1)->type != DS_NO_CONTACT);
}
if (player_has_embassy(pplayer1, pplayer2)
|| player_has_embassy(pplayer2, pplayer1)) {
@@ -1809,7 +1812,6 @@
/* make a new player */
server_player_init(cplayer, TRUE);
- ai_data_init(cplayer);
/* select a new name and nation for the copied player. */
/* Rebel will always be an AI player */
@@ -1822,21 +1824,22 @@
cplayer->revolution_finishes = game.turn + 1;
cplayer->capital = TRUE;
- /* This should probably be DS_NEUTRAL when AI knows about diplomacy,
- * but for now AI players are always at war.
- */
+ /* cplayer is not yet part of players_iterate which goes only
+ to game.nplayers. */
players_iterate(other_player) {
- cplayer->diplstates[other_player->player_no].type = DS_NEUTRAL;
+ cplayer->diplstates[other_player->player_no].type = DS_NO_CONTACT;
cplayer->diplstates[other_player->player_no].has_reason_to_cancel = 0;
cplayer->diplstates[other_player->player_no].turns_left = 0;
- other_player->diplstates[cplayer->player_no].type = DS_NEUTRAL;
+ cplayer->diplstates[other_player->player_no].contact_turns_left = 0;
+ other_player->diplstates[cplayer->player_no].type = DS_NO_CONTACT;
other_player->diplstates[cplayer->player_no].has_reason_to_cancel = 0;
other_player->diplstates[cplayer->player_no].turns_left = 0;
+ other_player->diplstates[cplayer->player_no].contact_turns_left = 0;
/* Send so that other_player sees updated diplomatic info;
- * cplayer and pplayer will be sent later anyway
+ * pplayer will be sent later anyway
*/
- if (other_player != cplayer && other_player != pplayer) {
+ if (other_player != pplayer) {
send_player_info(other_player, other_player);
}
}
@@ -1844,7 +1847,9 @@
/* Split the resources */
- cplayer->economic.gold = pplayer->economic.gold/2;
+ cplayer->economic.gold = pplayer->economic.gold;
+ cplayer->economic.gold /= 2;
+ pplayer->economic.gold -= cplayer->economic.gold;
/* Copy the research */
@@ -1877,7 +1882,6 @@
pplayer->government = game.government_when_anarchy;
pplayer->revolution_finishes = game.turn + 1;
}
- pplayer->economic.gold = cplayer->economic.gold;
pplayer->research.bulbs_researched = 0;
pplayer->embassy = 0; /* all embassies destroyed */
@@ -1917,16 +1921,13 @@
* The capture of a capital is not a sure fire way to throw
and empire into civil war. Some governments are more susceptible
than others, here are the base probabilities:
- * Anarchy 90%
+Anarchy 90%
Despotism 80%
Monarchy 70%
-Fundamentalism 60% (In case it gets implemented one day)
+Fundamentalism 60% (Only in civ2 ruleset)
Communism 50%
- Republic 40%
-Democracy 30%
- * Note: In the event that Fundamentalism is added, you need to
-update the array government_civil_war[G_LAST] in player.c
- * [ SKi: That would now be data/default/governments.ruleset. ]
+Republic 40%
+Democracy 30%
* In addition each city in revolt adds 5%, each city in rapture
subtracts 5% from the probability of a civil war.
* If you have at least 1 turns notice of the impending loss of
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Jason Short, 2004/09/10
- [Freeciv-Dev] (PR#10034) no contact with adjacent player, Brett Albertson, 2004/09/10
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Marko Lindqvist, 2004/09/11
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Marko Lindqvist, 2004/09/11
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Jason Short, 2004/09/11
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Marko Lindqvist, 2004/09/11
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player,
Marko Lindqvist <=
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Jason Short, 2004/09/11
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Marko Lindqvist, 2004/09/12
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Marko Lindqvist, 2004/09/12
- [Freeciv-Dev] Re: (PR#10034) no contact with adjacent player, Marko Lindqvist, 2004/09/18
|
|