Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-12 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> You forgot to change the main mandatory capability.
> 
In 2.1, I'm expecting that to change with a new (+2.1g) release
tomorrow.  Since there's no possibility of backward compatibility,
both ReportFreezeFix and CF can go away, too.

In 2.2, I thought +test was added after discussion, but I see that
nobody actually did it  There's no expectation that different
source development versions will interoperate.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-12 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> [wsimpson - Jeu. Oct. 11 23:03:37 2007]:
> 
> Committed S2_1 revision 13744.
> Committed S2_2 revision 13745.
> 

You forgot to change the main mandatory capability.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-11 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Committed S2_1 revision 13744.
Committed S2_2 revision 13745.

Here's the slightly different S2_2 patch for posterity.

trunk looks problematic

Index: server/cityhand.c
===
--- server/cityhand.c   (revision 13744)
+++ server/cityhand.c   (working copy)
@@ -397,19 +397,3 @@
 
   send_city_info(pplayer, pcity);
 }
-
-/***
-  Tell the client the cost of inciting a revolt or bribing a unit.
-  Only send result back to the requesting connection, not all
-  connections for that player.
-***/
-void handle_city_incite_inq(struct connection *pc, int city_id)
-{
-  struct player *pplayer = pc->player;
-  struct city *pcity = game_find_city_by_number(city_id);
-
-  if (pplayer && pcity) {
-dsend_packet_city_incite_info(pc, city_id,
- city_incite_cost(pplayer, pcity));
-  }
-}
Index: server/diplomats.c
===
--- server/diplomats.c  (revision 13744)
+++ server/diplomats.c  (working copy)
@@ -209,8 +209,8 @@
 
   Only send back to the originating connection, if there is one. (?)
 /
-void spy_get_sabotage_list(struct player *pplayer, struct unit *pdiplomat,
-  struct city *pcity)
+void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat,
+   struct city *pcity)
 {
   struct packet_city_sabotage_list packet;
 
@@ -225,10 +225,7 @@
 
   packet.diplomat_id = pdiplomat->id;
   packet.city_id = pcity->id;
-  lsend_packet_city_sabotage_list(player_reply_dest(pplayer), &packet);
-
-  /* this may cause a diplomatic incident */
-  maybe_cause_incident(SPY_GET_SABOTAGE_LIST, pplayer, NULL, pcity);
+  send_packet_city_sabotage_list(pc, &packet);
 }
 
 /**
@@ -391,8 +388,9 @@
struct unit *pvictim)
 {
   struct player *uplayer;
-  int diplomat_id;
   struct tile *victim_tile;
+  int bribe_cost;
+  int diplomat_id;
   bool vet = FALSE;
   struct unit *gained_unit = NULL;
   
@@ -406,13 +404,6 @@
 
   freelog (LOG_DEBUG, "bribe-unit: unit: %d", pdiplomat->id);
 
-  /* Update bribe cost. */
-  if (pvictim->bribe_cost == -1) {
-freelog (LOG_ERROR, "Bribe cost -1 in diplomat_bribe by %s",
-pplayer->name);
-pvictim->bribe_cost = unit_bribe_cost (pvictim);
-  }
-
   /* Check for unit from a bribable government. */
   if (get_player_bonus(uplayer, EFT_UNBRIBABLE_UNITS)) {
 notify_player(pplayer, pdiplomat->tile,
@@ -421,8 +412,11 @@
 return;
   }
 
+  /* Get bribe cost, ignoring any previously saved value. */
+  bribe_cost = unit_bribe_cost(pvictim);
+
   /* If player doesn't have enough gold, can't bribe. */
-  if (pplayer->economic.gold < pvictim->bribe_cost) {
+  if (pplayer->economic.gold < bribe_cost) {
 notify_player(pplayer, pdiplomat->tile,
 E_MY_DIPLOMAT_FAILED,
 _("You don't have enough gold to"
@@ -480,7 +474,7 @@
   pplayer->name);
 
   /* This costs! */
-  pplayer->economic.gold -= pvictim->bribe_cost;
+  pplayer->economic.gold -= bribe_cost;
 
   /* This may cause a diplomatic incident */
   maybe_cause_incident(DIPLOMAT_BRIBE, pplayer, pvictim, NULL);
@@ -693,7 +687,7 @@
 return;
   }
 
-  /* Get incite cost. */
+  /* Get incite cost, ignoring any previously saved value. */
   revolt_cost = city_incite_cost(pplayer, pcity);
 
   /* If player doesn't have enough gold, can't incite a revolt. */
@@ -1306,7 +1300,6 @@
 case DIPLOMAT_MOVE:
 case DIPLOMAT_EMBASSY:
 case DIPLOMAT_INVESTIGATE:
-case SPY_GET_SABOTAGE_LIST:
   return; /* These are not considered offences */
 case DIPLOMAT_ANY_ACTION:
 case SPY_POISON:
Index: server/diplomats.h
===
--- server/diplomats.h  (revision 13744)
+++ server/diplomats.h  (working copy)
@@ -21,8 +21,8 @@
  struct city *pcity);
 void diplomat_investigate(struct player *pplayer, struct unit *pdiplomat,
  struct city *pcity);
-void spy_get_sabotage_list(struct player *pplayer, struct unit *pdiplomat,
-  struct city *pcity);
+void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat,
+   struct city *pcity);
 void spy_poison(struct player *pplayer, struct unit *pdiplomat, 
struct city *pcity);
 void spy_sabotage_unit(struct player *pplayer, struct unit *pdiplomat,
Index: server/unithand.c
===
--- server/unithand.c   (revision 13744)
+++ server/unithand.c   (worki

Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-11 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Pepeto _ wrote:
>  All looks work well now. Thank
> you for your fast work.
> 
Thank you for your initial report and rapid testing!

Admittedly, my first patch was "fast" trying to be done before the
release.  It just followed the (incorrect) path of the original code.

But your report actually was about multiple, related problems.  The
second, more comprehensive patch required a deeper understanding.
This was more than just bad variable initialization and coding errors.

Note that one message was renamed _answer.  The new messages should be
usable for future client designs that implement diplomat/spy menu item
lists instead of "popup" dialogs.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-11 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> [wsimpson - Jeu. Oct. 11 15:57:47 2007]:
> 
> Pepeto _ wrote:
> 
> > maybe_cause_incident() removed in void spy_send_sabotage_list(): is it
> > normal?
> > 
> Yes, it was special cased in maybe_cause_incident(), and now the symbol
> will no longer exist.   It's a dialog/support query, not a unit action.
> 
> 
> 

Ok, I tested it succinctly. I didn't find annoying effect. The observers
are not spammed by the diplomat popup. All looks work well now. Thank
you for your fast work.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-11 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Pepeto _ wrote:

> maybe_cause_incident() removed in void spy_send_sabotage_list(): is it
> normal?
> 
Yes, it was special cased in maybe_cause_incident(), and now the symbol
will no longer exist.   It's a dialog/support query, not a unit action.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-11 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

maybe_cause_incident() removed in void spy_send_sabotage_list(): is it
normal?


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-11 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Forgot to attach the proposed patch:

Index: server/cityhand.c
===
--- server/cityhand.c   (revision 13743)
+++ server/cityhand.c   (working copy)
@@ -411,19 +411,3 @@
 
   send_city_info(pplayer, pcity);
 }
-
-/***
-  Tell the client the cost of inciting a revolt or bribing a unit.
-  Only send result back to the requesting connection, not all
-  connections for that player.
-***/
-void handle_city_incite_inq(struct connection *pc, int city_id)
-{
-  struct player *pplayer = pc->player;
-  struct city *pcity = find_city_by_id(city_id);
-
-  if (pplayer && pcity) {
-dsend_packet_city_incite_info(pc, city_id,
- city_incite_cost(pplayer, pcity));
-  }
-}
Index: server/diplomats.c
===
--- server/diplomats.c  (revision 13743)
+++ server/diplomats.c  (working copy)
@@ -208,8 +208,8 @@
 
   Only send back to the originating connection, if there is one. (?)
 /
-void spy_get_sabotage_list(struct player *pplayer, struct unit *pdiplomat,
-  struct city *pcity)
+void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat,
+   struct city *pcity)
 {
   struct packet_city_sabotage_list packet;
 
@@ -224,10 +224,7 @@
 
   packet.diplomat_id = pdiplomat->id;
   packet.city_id = pcity->id;
-  lsend_packet_city_sabotage_list(player_reply_dest(pplayer), &packet);
-
-  /* this may cause a diplomatic incident */
-  maybe_cause_incident(SPY_GET_SABOTAGE_LIST, pplayer, NULL, pcity);
+  send_packet_city_sabotage_list(pc, &packet);
 }
 
 /**
@@ -390,8 +387,9 @@
struct unit *pvictim)
 {
   struct player *uplayer;
-  int diplomat_id;
   struct tile *victim_tile;
+  int bribe_cost;
+  int diplomat_id;
   bool vet = FALSE;
   struct unit *gained_unit = NULL;
   
@@ -405,13 +403,6 @@
 
   freelog (LOG_DEBUG, "bribe-unit: unit: %d", pdiplomat->id);
 
-  /* Update bribe cost. */
-  if (pvictim->bribe_cost == -1) {
-freelog (LOG_ERROR, "Bribe cost -1 in diplomat_bribe by %s",
-pplayer->name);
-pvictim->bribe_cost = unit_bribe_cost (pvictim);
-  }
-
   /* Check for unit from a bribable government. */
   if (get_player_bonus(uplayer, EFT_UNBRIBABLE_UNITS)) {
 notify_player(pplayer, pdiplomat->tile,
@@ -420,8 +411,11 @@
 return;
   }
 
+  /* Get bribe cost, ignoring any previously saved value. */
+  bribe_cost = unit_bribe_cost(pvictim);
+
   /* If player doesn't have enough gold, can't bribe. */
-  if (pplayer->economic.gold < pvictim->bribe_cost) {
+  if (pplayer->economic.gold < bribe_cost) {
 notify_player(pplayer, pdiplomat->tile,
 E_MY_DIPLOMAT_FAILED,
 _("You don't have enough gold to"
@@ -478,7 +472,7 @@
   pplayer->name);
 
   /* This costs! */
-  pplayer->economic.gold -= pvictim->bribe_cost;
+  pplayer->economic.gold -= bribe_cost;
 
   /* This may cause a diplomatic incident */
   maybe_cause_incident(DIPLOMAT_BRIBE, pplayer, pvictim, NULL);
@@ -691,7 +685,7 @@
 return;
   }
 
-  /* Get incite cost. */
+  /* Get incite cost, ignoring any previously saved value. */
   revolt_cost = city_incite_cost(pplayer, pcity);
 
   /* If player doesn't have enough gold, can't incite a revolt. */
@@ -1298,7 +1292,6 @@
 case DIPLOMAT_MOVE:
 case DIPLOMAT_EMBASSY:
 case DIPLOMAT_INVESTIGATE:
-case SPY_GET_SABOTAGE_LIST:
   return; /* These are not considered offences */
 case DIPLOMAT_ANY_ACTION:
 case SPY_POISON:
Index: server/diplomats.h
===
--- server/diplomats.h  (revision 13743)
+++ server/diplomats.h  (working copy)
@@ -21,8 +21,8 @@
  struct city *pcity);
 void diplomat_investigate(struct player *pplayer, struct unit *pdiplomat,
  struct city *pcity);
-void spy_get_sabotage_list(struct player *pplayer, struct unit *pdiplomat,
-  struct city *pcity);
+void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat,
+   struct city *pcity);
 void spy_poison(struct player *pplayer, struct unit *pdiplomat, 
struct city *pcity);
 void spy_sabotage_unit(struct player *pplayer, struct unit *pdiplomat,
Index: server/unithand.c
===
--- server/unithand.c   (revision 13743)
+++ server/unithand.c   (working copy)
@@ -166,28 +166,67 @@
   }
 }
 
-/***
-  Tell the c

Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-11 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Eliminated both city incite cost and unit bribe cost variables.  The
incite cost was never properly initialized in either the client or
server.  The bribe cost was -1 in the server and 0 in the client.

Pass them as a parameter instead.

The spy sabotage list seems to have been "lsend_" to the player's
connections (observers), potentially popping up dialogs at random
intervals.  The comments say "Only send back to the originating
connection, if there is one. (?)" -- but, the code didn't match.

Therefore, I've merged the 3 seemingly related behaviors into a
joint query packet on a single connection, which should facilitate it
being sent by either observers or actual players without interference.

Lightly tested as a spy.  Observers not tested.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> [wsimpson - Mer. Oct. 10 21:22:15 2007]:
> 
> You're correct, I was concentrating on the network and dialog
> compatibility issues, and forgot to look at the cost itself.
> 
> I don't think it should be saved at all!  It really exists for
> the client side, and I'm not sure it's needed there, either.
> 
> Note that the incite code doesn't save the cost on the server
> side.  I'll make the bribe code match later tonight.
> 

I totally agree with you. I think the incite cost was fixed earlier
after someone saw that adding units in the city didn't increase the cost.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

You're correct, I was concentrating on the network and dialog
compatibility issues, and forgot to look at the cost itself.

I don't think it should be saved at all!  It really exists for
the client side, and I'm not sure it's needed there, either.

Note that the incite code doesn't save the cost on the server
side.  I'll make the bribe code match later tonight.

I've tested bribing on GTK2 only.  If anybody has an issue with
the revised dialogs on other platforms, they should speak soon!



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

I note too that the first reported problem is still not fixed in your
patch: unit bribe cost should be recalculated when the server receive
the packet for bribe unit. Because some hacked client could send
directly DIPLOMAT_BRIBE without DIPLOMAT_BRIBE_QUERY.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> [wsimpson - Mer. Oct. 10 18:37:12 2007]:
> 
> Here's a simple 2.1b6 replacement, untested.  It simply checks whether
> the diplomat can actually execute the desired command.
> 
> Please check against your favorite clients.
> 
> 

Sorry, I won't have time before some days to try it. The patch looks
good. I note that you abandoned the idea of the hande-per-connection.

When you will do the commit, don't forget to change the mandatory
capability.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Here's a simple 2.1b6 replacement, untested.  It simply checks whether
the diplomat can actually execute the desired command.

Please check against your favorite clients.

Index: server/cityhand.c
===
--- server/cityhand.c   (revision 13743)
+++ server/cityhand.c   (working copy)
@@ -411,19 +411,3 @@
 
   send_city_info(pplayer, pcity);
 }
-
-/***
-  Tell the client the cost of inciting a revolt or bribing a unit.
-  Only send result back to the requesting connection, not all
-  connections for that player.
-***/
-void handle_city_incite_inq(struct connection *pc, int city_id)
-{
-  struct player *pplayer = pc->player;
-  struct city *pcity = find_city_by_id(city_id);
-
-  if (pplayer && pcity) {
-dsend_packet_city_incite_info(pc, city_id,
- city_incite_cost(pplayer, pcity));
-  }
-}
Index: server/diplomats.c
===
--- server/diplomats.c  (revision 13743)
+++ server/diplomats.c  (working copy)
@@ -1297,6 +1297,8 @@
   break;
 case DIPLOMAT_MOVE:
 case DIPLOMAT_EMBASSY:
+case DIPLOMAT_BRIBE_QUERY:
+case DIPLOMAT_INCITE_QUERY:
 case DIPLOMAT_INVESTIGATE:
 case SPY_GET_SABOTAGE_LIST:
   return; /* These are not considered offences */
Index: server/unithand.c
===
--- server/unithand.c   (revision 13743)
+++ server/unithand.c   (working copy)
@@ -167,27 +167,13 @@
 }
 
 /***
-  Tell the client the cost of inciting a revolt or bribing a unit.
-  Only send result back to the requesting connection, not all
-  connections for that player.
-***/
-void handle_unit_bribe_inq(struct connection *pc, int unit_id)
-{
-  struct player *pplayer = pc->player;
-  struct unit *punit = find_unit_by_id(unit_id);
-
-  if (pplayer && punit) {
-punit->bribe_cost = unit_bribe_cost(punit);
-dsend_packet_unit_bribe_info(pc, unit_id, punit->bribe_cost);
-  }
-}
-
-/***
 ...
 ***/
-void handle_unit_diplomat_action(struct player *pplayer, int diplomat_id,
-enum diplomat_actions action_type,
-int target_id, int value)
+void handle_unit_diplomat_action(struct player *pplayer,
+int diplomat_id,
+int target_id,
+int value,
+enum diplomat_actions action_type)
 {
   struct unit *pdiplomat = player_find_unit_by_id(pplayer, diplomat_id);
   struct unit *pvictim = find_unit_by_id(target_id);
@@ -205,6 +191,35 @@
diplomat_bribe(pplayer, pdiplomat, pvictim);
   }
   break;
+case DIPLOMAT_BRIBE_QUERY:
+  if(pvictim && diplomat_can_do_action(pdiplomat, DIPLOMAT_BRIBE,
+  pvictim->tile)) {
+   pvictim->bribe_cost = unit_bribe_cost(pvictim);
+   /* Only send result back to the requesting connection,
+  not all connections for that player. */
+   dlsend_packet_unit_diplomat_popup_dialog(player_reply_dest(pplayer),
+diplomat_id, target_id,
+pvictim->bribe_cost,
+action_type);
+  }
+  break;
+case DIPLOMAT_INCITE:
+  if(pcity && diplomat_can_do_action(pdiplomat, DIPLOMAT_INCITE,
+pcity->tile)) {
+   diplomat_incite(pplayer, pdiplomat, pcity);
+  }
+  break;
+case DIPLOMAT_INCITE_QUERY:
+  if(pcity && diplomat_can_do_action(pdiplomat, DIPLOMAT_INCITE,
+pcity->tile)) {
+   /* Only send result back to the requesting connection,
+  not all connections for that player. */
+   dlsend_packet_unit_diplomat_popup_dialog(player_reply_dest(pplayer),
+diplomat_id, target_id,
+city_incite_cost(pplayer, 
pcity),
+action_type);
+  }
+  break;
 case SPY_SABOTAGE_UNIT:
   if(pvictim && diplomat_can_do_action(pdiplomat, SPY_SABOTAGE_UNIT,
   pvictim->tile)) {
@@ -236,12 +251,6 @@
diplomat_embassy(pplayer, pdiplomat, pcity);
   }
   break;
-case DIPLOMAT_INCITE:
-  if(pcity && diplomat_can_do_action(pdiplomat, DIPLOMAT_INCITE,
-   

[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> [wsimpson - Mer. Oct. 10 11:55:32 2007]:
> 
> Pepeto _ wrote:
> > Sounds a good idea. This packets could be considered as diplomat
actions.
> > 
> Looks quickly doable for 2.1.  Writing patch now.

Good news!

> Waste of time for 2.0, as nobody found this cheat in a decade, it's not
> important enough, and there's not likely another 2.0 release before 2.1.

Didn't I find it?

> > PS: Why do the PACKET_UNIT_BRIBE_INQ and the PACKET_CITY_INCITE_INQ have
> > the handle-per-conn flag? Do observers need to access such datas?
> > 
> Probably, as that's part of the observation.  Should be added to
> DIPLOMAT_ACTION.

Quite strange, but ok.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread William Allen Simpson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Pepeto _ wrote:
> Sounds a good idea. This packets could be considered as diplomat actions.
> 
Looks quickly doable for 2.1.  Writing patch now.

Waste of time for 2.0, as nobody found this cheat in a decade, it's not
important enough, and there's not likely another 2.0 release before 2.1.


> PS: Why do the PACKET_UNIT_BRIBE_INQ and the PACKET_CITY_INCITE_INQ have
> the handle-per-conn flag? Do observers need to access such datas?
> 
Probably, as that's part of the observation.  Should be added to
DIPLOMAT_ACTION.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-10 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> [EMAIL PROTECTED] - Mar. Oct. 09 23:27:21 2007]:
> 
> Oh joy, I guess that will break network compatibility then, so that
> means a serverside fix for 2.0 ..

My propositions of changing packets is only for next released versions
(like 2.1, 2.2 and later).
The solution for 2.0 is an ugly hack: iterate adjacent unit and check if
the player have a diplomat, and if he can do the action.

> So to fix this in 2.1 you can just add a UNIT diplomat_id to the *_INQ
> packets. But  what do you think of merging Diplomat_Action packet with
> the bribe_inq packet.
> 
> 
> PACKET_UNIT_BRIBE_INQ=67;cs,handle-per-conn,dsend
>   UNIT unit_id;
> end
> 
> PACKET_CITY_INCITE_INQ=33;cs,handle-per-conn,dsend
>   CITY city_id;
> end
> 
> PACKET_UNIT_DIPLOMAT_ACTION=70;cs,dsend
>   UNIT diplomat_id;
>   DIPLOMAT_ACTION action_type;
>   UNIT target_id;   # city_id or unit_id target_id;
>   SINT16 value;
> end

Sounds a good idea. This packets could be considered as diplomat actions.

PS: Why do the PACKET_UNIT_BRIBE_INQ and the PACKET_CITY_INCITE_INQ have
the handle-per-conn flag? Do observers need to access such datas?


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-09 Thread Erik Johansson

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

> [pepeto - Tue Oct 09 17:34:27 2007]:
>
> Something else happens. You can use the packet unit_bribe_inq() and
> city_bribe_inq() without diplomat. So, then with a hacked client, you
> can know all city and unit costs of the game. Then you are able to know
> where are the capitals, and how many gold have a player.
>
> unit_bribe_inq() and city_bribe_inq() must contain a diplomat id, and
> this diplomat must be to adjacent tile.
>
>

Oh joy, I guess that will break network compatibility then, so that
means a serverside fix for 2.0 ..

So to fix this in 2.1 you can just add a UNIT diplomat_id to the *_INQ
packets. But  what do you think of merging Diplomat_Action packet with
the bribe_inq packet.


PACKET_UNIT_BRIBE_INQ=67;cs,handle-per-conn,dsend
  UNIT unit_id;
end

PACKET_CITY_INCITE_INQ=33;cs,handle-per-conn,dsend
  CITY city_id;
end

PACKET_UNIT_DIPLOMAT_ACTION=70;cs,dsend
  UNIT diplomat_id;
  DIPLOMAT_ACTION action_type;
  UNIT target_id;   # city_id or unit_id target_id;
  SINT16 value;
end

-- 
/emj



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39730) [Bug] Server allows bribe cheating

2007-10-09 Thread Pepeto _

http://bugs.freeciv.org/Ticket/Display.html?id=39730 >

Something else happens. You can use the packet unit_bribe_inq() and
city_bribe_inq() without diplomat. So, then with a hacked client, you
can know all city and unit costs of the game. Then you are able to know
where are the capitals, and how many gold have a player.

unit_bribe_inq() and city_bribe_inq() must contain a diplomat id, and
this diplomat must be to adjacent tile.


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev