[Freeciv-Dev] Re: (PR#4102) contact and intelligence
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients:; |
Subject: |
[Freeciv-Dev] Re: (PR#4102) contact and intelligence |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Tue, 29 Apr 2003 11:08:36 -0700 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
On Tue, 29 Apr 2003, ChrisK@xxxxxxxx wrote:
> > We now give away some information through the meet dialog which we
> > previously only could get through the intelligence dialog.
...
> > To avoid a situation where players open a meet dialog just check on the
> > other player's progress, this information should also be available in the
> > intelligence dialog.
...
> just allow full intelligence?
Ok. Here is the patch that does this.
- Per
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.168
diff -u -r1.168 civclient.c
--- client/civclient.c 17 Apr 2003 20:06:35 -0000 1.168
+++ client/civclient.c 29 Apr 2003 18:05:57 -0000
@@ -850,9 +850,7 @@
**************************************************************************/
bool can_intel_with_player(struct player *pplayer)
{
- return (pplayer->is_alive
- && pplayer != game.player_ptr
- && player_has_embassy(game.player_ptr, pplayer));
+ return could_intel_with_player(game.player_ptr, pplayer);
}
/**************************************************************************
Index: common/diptreaty.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/diptreaty.c,v
retrieving revision 1.15
diff -u -r1.15 diptreaty.c
--- common/diptreaty.c 17 Apr 2003 20:06:36 -0000 1.15
+++ common/diptreaty.c 29 Apr 2003 18:05:58 -0000
@@ -44,6 +44,19 @@
&& pplayer->is_connected);
}
+/**************************************************************************
+ Returns TRUE iff pplayer could do diplomatic meetings with aplayer.
+**************************************************************************/
+bool could_intel_with_player(struct player *pplayer, struct player *aplayer)
+{
+ return (pplayer->is_alive
+ && aplayer->is_alive
+ && pplayer != aplayer
+ && (pplayer->diplstates[aplayer->player_no].contact_turns_left > 0
+ || aplayer->diplstates[pplayer->player_no].contact_turns_left > 0
+ || player_has_embassy(pplayer, aplayer)));
+}
+
/****************************************************************
...
*****************************************************************/
Index: common/diptreaty.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/diptreaty.h,v
retrieving revision 1.10
diff -u -r1.10 diptreaty.h
--- common/diptreaty.h 17 Apr 2003 20:06:36 -0000 1.10
+++ common/diptreaty.h 29 Apr 2003 18:05:58 -0000
@@ -46,6 +46,7 @@
};
bool could_meet_with_player(struct player *pplayer, struct player *aplayer);
+bool could_intel_with_player(struct player *pplayer, struct player *aplayer);
void init_treaty(struct Treaty *ptreaty,
struct player *plr0, struct player *plr1);
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.267
diff -u -r1.267 plrhand.c
--- server/plrhand.c 17 Apr 2003 20:06:36 -0000 1.267
+++ server/plrhand.c 29 Apr 2003 18:05:58 -0000
@@ -18,6 +18,7 @@
#include <assert.h>
#include <stdarg.h>
+#include "diptreaty.h"
#include "events.h"
#include "fcintl.h"
#include "government.h"
@@ -1134,7 +1135,7 @@
if (info_level < min_info_level)
info_level = min_info_level;
- if (info_level >= INFO_MEETING) {
+ if (info_level > INFO_MINIMUM) {
packet->gold = plr->economic.gold;
for (i = A_NONE; i < game.num_tech_types; i++) {
packet->inventions[i] = plr->research.inventions[i].state + '0';
@@ -1192,7 +1193,7 @@
packet->luxury = 0;
packet->bulbs_researched= 0;
packet->techs_researched= 0;
- packet->researching = A_UNSET;
+ packet->researching = A_NONE;
packet->future_tech = 0;
packet->revolution = 0;
@@ -1247,12 +1248,12 @@
static enum plr_info_level player_info_level(struct player *plr,
struct player *receiver)
{
- if (plr == receiver)
+ if (plr == receiver) {
return INFO_FULL;
- if (receiver && player_has_embassy(receiver, plr))
+ }
+ if (receiver && could_intel_with_player(receiver, plr)) {
return INFO_EMBASSY;
- if (receiver && find_treaty(plr, receiver))
- return INFO_MEETING;
+ }
return INFO_MINIMUM;
}
@@ -1327,6 +1328,8 @@
|| is_barbarian(pplayer1) || is_barbarian(pplayer2)) {
return;
}
+ pplayer1->diplstates[player2].contact_turns_left = game.contactturns;
+ pplayer2->diplstates[player1].contact_turns_left = game.contactturns;
/* FIXME: Always declaring war for the AI is a kludge until AI
diplomacy is implemented. */
@@ -1347,10 +1350,8 @@
}
if (player_has_embassy(pplayer1, pplayer2)
|| player_has_embassy(pplayer2, pplayer1)) {
- return;
+ return; /* Avoid sending too much info over the network */
}
- pplayer1->diplstates[player2].contact_turns_left = game.contactturns;
- pplayer2->diplstates[player1].contact_turns_left = game.contactturns;
send_player_info(pplayer1, pplayer1);
send_player_info(pplayer2, pplayer2);
}
Index: server/plrhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.h,v
retrieving revision 1.53
diff -u -r1.53 plrhand.h
--- server/plrhand.h 17 Apr 2003 20:06:36 -0000 1.53
+++ server/plrhand.h 29 Apr 2003 18:05:58 -0000
@@ -22,7 +22,7 @@
struct connection;
struct conn_list;
-enum plr_info_level { INFO_MINIMUM, INFO_MEETING, INFO_EMBASSY, INFO_FULL };
+enum plr_info_level { INFO_MINIMUM, INFO_EMBASSY, INFO_FULL };
void server_player_init(struct player *pplayer, bool initmap);
void server_remove_player(struct player *pplayer);
|
|