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

I see this line in server/diplomat.c in diplomat_bribe():

  if (pvictim->bribe_cost == -1) {
    freelog (LOG_ERROR, "Bribe cost -1 in diplomat_bribe by %s",
    pvictim->bribe_cost = unit_bribe_cost (pvictim);

I was wondering where was calculated this value, I found it in
server/unithand.c in handle_unit_bribe_inq():

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);

So this value is calculated only when you ask the bribe cost to the
server. With a hacked client, it's very easy to don't ask a such info.
Then the value is not calculated (produce a LOG_ERROR) or is an old
value (dangerous). This should be recalculated in diplomat_bribe() to
work properly.

Freeciv-dev mailing list

Reply via email to