[Freeciv-Dev] (PR#16332) Support for long-turn diplomacy
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#16332) Support for long-turn diplomacy |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Sat, 8 Apr 2006 12:05:47 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16332 >
This patch makes it possible to run diplomacy between players in long-turn
games by allowing diplomacy dialogs to stay open with players who are not
connected and players who disconnect. When a player reconnects, they are
greeted with the diplomacy dialog and any treatises suggested previously,
even if both players party to it have been disconnected before this.
As requested on the forums.
- Per
Index: server/connecthand.c
===================================================================
--- server/connecthand.c (revision 11822)
+++ server/connecthand.c (working copy)
@@ -322,15 +322,6 @@
}
notify_if_first_access_level_is_available();
- /* Cancel diplomacy meetings */
- if (!pplayer->is_connected) { /* may be still true if multiple connections */
- players_iterate(other_player) {
- if (find_treaty(pplayer, other_player)) {
- handle_diplomacy_cancel_meeting_req(pplayer, other_player->player_no);
- }
- } players_iterate_end;
- }
-
if (game.info.is_new_game
&& !pplayer->is_connected /* eg multiple controllers */
&& !pplayer->ai.control /* eg created AI player */
Index: server/diplhand.c
===================================================================
--- server/diplhand.c (revision 11822)
+++ server/diplhand.c (working copy)
@@ -702,7 +702,7 @@
/**************************************************************************
Send information on any on-going diplomatic meetings for connection's
- player. (For re-connection in multi-connect case.)
+ player. For re-connections.
**************************************************************************/
void send_diplomatic_meetings(struct connection *dest)
{
@@ -711,18 +711,29 @@
if (!pplayer) {
return;
}
- players_iterate(other_player) {
- struct Treaty *ptreaty = find_treaty(pplayer, other_player);
+ players_iterate(other) {
+ struct Treaty *ptreaty = find_treaty(pplayer, other);
if (ptreaty) {
- dsend_packet_diplomacy_init_meeting(dest, pplayer->player_no,
- other_player->player_no);
+ assert(pplayer != other);
+ dsend_packet_diplomacy_init_meeting(dest, other->player_no,
+ pplayer->player_no);
clause_list_iterate(ptreaty->clauses, pclause) {
- dsend_packet_diplomacy_create_clause(dest, pplayer->player_no,
- other_player->player_no,
- pclause->type,
- pclause->from->player_no);
+ dsend_packet_diplomacy_create_clause(dest,
+ other->player_no,
+ pclause->from->player_no,
+ pclause->type,
+ pclause->value);
} clause_list_iterate_end;
+ if (ptreaty->plr0 == pplayer) {
+ dsend_packet_diplomacy_accept_treaty(dest, other->player_no,
+ ptreaty->accept0,
+ ptreaty->accept1);
+ } else {
+ dsend_packet_diplomacy_accept_treaty(dest, other->player_no,
+ ptreaty->accept1,
+ ptreaty->accept0);
+ }
}
} players_iterate_end;
}
Index: common/diptreaty.c
===================================================================
--- common/diptreaty.c (revision 11822)
+++ common/diptreaty.c (working copy)
@@ -53,9 +53,7 @@
&& (player_has_embassy(aplayer, pplayer)
|| player_has_embassy(pplayer, aplayer)
|| pplayer->diplstates[aplayer->player_no].contact_turns_left > 0
- || aplayer->diplstates[pplayer->player_no].contact_turns_left >
0)
- && (aplayer->is_connected || aplayer->ai.control)
- && (pplayer->is_connected || pplayer->ai.control));
+ || aplayer->diplstates[pplayer->player_no].contact_turns_left >
0));
}
/**************************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#16332) Support for long-turn diplomacy,
Per I. Mathisen <=
|
|