DELTA 26727 0 40906
SVN  †  †  ›  ” €B ‚ÑP—w€` FÉ €‚ l q¯ FÉ  š)‚ê>“ ˆ„…,´ …©4€„4 …”C€‚J &…šS ƒm…¬k¤ ít…²€ FÉ €‡| P«~¸ QƒÂ@€u Qƒ» €F ]ƒÂ@² i˜;€‚, O«» QƒÂ@  J…¥ybool maybe_become_veteran_real(struct unit *punit, bool settler);
**
  Refresh units visibility of 'aplayer' for 'pplayer' after alliance have
  been contracted.
******/
void give_allied_visibility(struct player *pplayer,
                            struct player *aplayer)
{
  unit_list_iterate(aplayer->units, punit) {
    if (can_player_see_unit(pplayer, punit)) {
      send_unit_info(pplayer->connections, punit);
    }Is unit being refueled in its current position
send_unit_info(NULL**
  send the unit to the players who need the info.**/
void send_unit_info(struct conn_list *dest, struct unit *punit)
{
  const struct player *powner;
  struct packet_unit_info info[GAME_TRANSPORT_MAX_RECURSIVE + 1];
  struct packet_unit_short_info sinfo;
  int info_num;
  int i;

  if (dest == NULL) {
    dest = game.est_connections;
  }

  CHECK_UNIT(punit);

  powner = unit_owner(punit);
  package_unit(punit, &info[0]);
  i = 1;
  unit_transports_iterate(punit, ptrans) {
    fc_assert_action(i < ARRAY_SIZE(info), break);
    package_unit(punit, &info[i++]);
  } unit_transports_iterate_end;
  info_num = iconn_get_player(pconn);

    /* Be careful to consider all cases where pplayer is NULL... */
    if (pplayer == powner || (pplayer == NULL && pconn->observer)) {
      for (i = info_num - 1; i >= 0; i--) {
        send_packet_unit_info(pconn, &info[i]);
      }
    } else if (pplayer != NULL && can_player_see_unit(pplayer, punit        send_unit_info(dest, punit);*********************************************
  Due to the effects in the scripted hut behavior can not be predicted,
  unit_enter_hut returns nothing.
****/
static void unit_enter_hut(struct unit *punit)
{
  struct player *pplayer = unit_owner(punit);
  enum hut_behavior behavior = unit_class(punit)->hut_behavior;

  /* FIXME: Should we still run "hut_enter" script when
   *        hut_behavior is HUT_NOTHING or HUT_FRIGHTEN? */ 
  if (behavior == HUT_NOTHING) {
    return;
  }

  tile_clear_special(unit_tile(punit), S_HUT);
  update_tile_knowledge(unit_tile(punit));

  if (behavior == HUT_FRIGHTEN) {
    notify_player(pplayer, unit_tile(punit), E_HUT_BARB, ftc_server,
                  _("Your overflight frightens the tribe;"
                    " they scatter in terror."));
    return;
  }
  
  /* AI with H_LIMITEDHUTS only gets 25 gold (or barbs if unlucky) */
  if (pplayer->ai_controlled && ai_handicap(pplayer, H_LIMITEDHUTS)) {
    (void) hut_get_limited(punit);
    return;
  }

  script_server_signal_emit("hut_enter", 1,
                            API_TYPE_UNIT, punit);

  send_player_info_c(pplayer, pplayer->connections); /* eg, gold */
  return**
  Put the unit onto the transporter, and tell everyonvoid unit_transport_load_send(struct unit *punit, struct unit *ptrans)
{
  fc_assert_ret(punit != NULL);
  fc_assert_ret(ptrans != NULL);

  unit_transport_load(punit, ptrans, FALSE);

  send_unit_info(NULL, punit);
  send_unit_info(NULL, ptrans**
  Load unit to transport, send transport's loaded status to everyonunit_transport_load_tp_status(struct unit *punit,
bool force)
{
  bool had_cargo;

  fc_assert_ret(punit != NULL);
  fc_assert_ret(ptrans != NULL);

  had_cargo = get_transporter_occupancy(ptrans) > 0;

  unit_transport_load(punit, ptrans, force);

  if (!had_cargo) {
    /* Transport's loaded status changed */
    send_unit_info(NULL, ptrans);
  }**
  Pull the unit off of the transporter, and tell everyonvoid unit_transport_unload_send(†  ‚½.‚ÆVÇ) äF•(€‡3 MÈ>  WŽ@€‚[ LŽ{€ˆ ^¹+Š ‰u€‚Z "Œ PÈ; …$ú9€k |€.€  ‚hƒ€ƒ% sˆ! ,Šv „]‘&€§ …Lš?€ƒ~ [ ‘ „G«$» g¯ ÷nÅ@struct unit_move_data {
  struct unit *punit;
  int unit_id;
  const struct player *powner;
  bv_player can_see_unit_at_src;
  bv_player can_see_unit_at_dest;
  struct vision *old_vision;
};

#define SPECLIST_TAG unit_move_data
#include "speclist.h"
#define unit_move_data_list_iterate(_plist, _pdata)                         \
  TYPED_LIST_ITERATE(struct unit_move_data, _plist, _pdata)
#define unit_move_data_list_iterate_end LIST_ITERATE_END
#define unit_move_data_list_both_iterate(_plist, _plink, _pdata)            \
  TYPED_LIST_BOTH_ITERATE(struct unit_move_data_list_link,                  \
                          struct unit_move_data, _plist, _plink, _pdata)
#define unit_move_data_list_both_iterate_end LIST_BOTH_ITERATE_END
#define unit_move_data_list_iterate_rev(_plist, _pdata)                     \
  TYPED_LIST_ITERATE_REV(struct unit_move_data, _plist, _pdata)
#define unit_move_data_list_iterate_rev_end LIST_ITERATE_REV_END**
  Create a new unit move datastruct unit_move_data *unit_move_data_new(struct unit *punit,
                                                 struct tile *psrctile,
                                                 struct tile *pdesttile)
{
  struct unit_move_data *pdata = fc_malloc(sizeof(*pdata));
  struct player *powner = unit_owner(punit);
  const v_radius_t radius_sq =
    get_unit_vision_at(punit, pdesttile, V_INVIS));
  struct vision *new_vision;
  bool transported = unit_transported(punit);
  bool success;

  pdata->punit = punit;
  pdata->unit_id = punit->id;
  pdata->powner = powner;
  BV_CLR_ALL(pdata->can_see_unit_at_src);
  BV_CLR_ALL(pdata->can_see_unit_at_dest);
  players_iterate(pplayer) {
    if (pplayer == powner
        || can_player_see_unit_at(pplayer, punit, psrctile, transported)) {
      BV_SET(pdata->can_see_unit_at_src, player_index(pplayer));
    }
    if (pplayer == powner
        || can_player_see_unit_at(pplayer, punit, pdesttile, transported)) {
      BV_SET(pdata->can_see_unit_at_dest, player_index(pplayer));
    }
  } players_iterate_end;
  pdata->old_vision = punit->server.vision;

  /* Remove unit from the source tile. */
  fc_assert(unit_tile(punit) == psrctile);
  success = unit_list_remove(psrctile->units, punit);
  fc_assert(success == TRUE);

  /* Set new tile. */
  unit_tile_set(punit, pdesttile);
  unit_list_prepend(pdesttile->units, punit);

  if (transported) {unit);
  }We first unfog the destination, then send the move,
   * and then fog the old territory. This means that the player
   * gets a chance to see the newly explored territory while the
   * client moves the unit, and both areas are visible during the
   * move */

  /* Enhance vision if unit steps into a fortress */
  new_vision = vision_new(pownerreturn pdatapacket_unit_info src_info, dest_info;
  struct packet_unit_short_info src_sinfo, dest_sinfo;
  struct unit_move_data_list *plist =
      unit_move_data_list_new_full((unit_move_data_list_free_fn_t) free);
  struct unit_move_data *pdatapsrctile = unit_tile(punit);
  adj = base_get_direction_for_step(psrctile, pdesttile, &facing);

  conn_list_do_buffer(game.est_}

  /* Wakup units next to us before we move. */
  wakeup_neighbor_sentries(punit);

  /* Make info packets at 'psrctile'. */
  if (adj) {
    package_unit(punit, &src_info);
    package_short_unit(punit, &src_sinfo, UNIT_INFO_IDENTITY, 0, FALSE);
  }

  /* Make new data for 'punit'. */
  pdata = unit_move_data_new(punit, psrctile, pdesttile);
  unit_move_data_list_prepend(plist, pdata);

  /* Set unit orientation */Move all contained units. */
  unit_cargo_iterate(punit, pcargo) {
    pdata = unit_move_data_new(pcargo, psrctile, pdesttile);
    unit_move_data_list_append(plist, pdata);
  } unit_cargo_iterate_end;

  /* Get data for 'punit'. */
  pdata = unit_move_data_list_front(plist);

  /* Check timeout settings. */
  if (game.info.timeout != 0 && game.server.timeoutaddenemymove > 0) {
    bool new_information_for_enemy = FALSE;

    phase_players_iterate(penemy) {
      /* Increase the timeout if an enemy unit moves and the
       * timeoutaddenemymove setting is in use. */
      if (penemy->is_connected
          && pplayer != penemy
          && pplayers_at_war(pplayer, penemy)
          && (BV_ISSET(pdata->can_see_unit_at_src, player_index(penemy))
              || BV_ISSET(pdata->can_see_unit_at_dest,
                          player_index(penemy)))) {
        new_information_for_enemy = TRUE;
        break;
      }
    } phase_players_iterate_end;

    if (new_information_for_enemy) {
      increase_timeout_because_unit_moved();
    }
  }

  /* Notifications of the move to the clients. */
  if (adj) {
    /* Special case: 'punit' is moving to adjacent position. Then we show
     * 'punit' move to all users able to see 'psrctile' or 'pdesttile'. */

    /* Make info packets at 'pdesttile'. */
    package_unit(punit, &dest_info);
    package_short_unit(punit, &dest_sinfo, UNIT_INFO_IDENTITY, 0, FALSE);

    conn_list_iterate(game.est_connections, pconn) {
      struct player *aplayer = conn_get_player(pconn);

      if (aplayer == pplayer || (aplayer == NULL && pconn->observer)) {
        send_packet_unit_info(pconn, &src_info);
        send_packet_unit_info(pconn, &dest_info);
      } else if (aplayer != NULL
                 && (BV_ISSET(pdata->can_see_unit_at_src,
                              player_index(aplayer))
                     || BV_ISSET(pdata->can_see_unit_at_dest,
                                 player_index(aplayer)))) {
        send_packet_unit_short_info(pconn, &src_sinfo);
        send_packet_unit_short_info(pconn, &dest_sinfo);
      }
    } conn_list_iterate_end;
  }

  /* Other moves. */
  unit_move_data_list_iterate(plist, pmove_data) {
    if (adj && pmove_data == pdata) {
      /* If positions are adjacent, we have already shown 'punit' move.
       * See above. */
      continue;
    }

    /* Make info packets at 'pdesttile'. */
    package_unit(pmove_data->punit, &dest_info);
    package_short_unit(pmove_data->punit, &dest_sinfo,
                       UNIT_INFO_IDENTITY, 0, FALSE);

    conn_list_iterate(game.est_connections, pconn) {
      struct player *aplayer = conn_get_player(pconn);

      if (aplayer == pmove_data->powner
          || (aplayer == NULL && pconn->observer)) {
        send_packet_unit_info(pconn, &dest_info);
      } else if (aplayer != NULL
                 && (BV_ISSET(pmove_data->can_see_unit_at_dest,
                              player_index(aplayer))
                     || (adj && BV_ISSET(pmove_data->can_see_unit_at_src,
                                         player_index(aplayer))))) {
        send_packet_unit_short_info(pconn, &dest_sinfo);
      }
    } conn_list_iterate_end;
  } unit_move_data_list_iterate_end;

  /* Remove units going out of sight. */
  unit_move_data_list_iterate_rev(plist, pmove_data) {
    players_iterate(aplayer) {
      if (aplayer != pmove_data->powner
          && BV_ISSET(pmove_data->can_see_unit_at_src, player_index(aplayer))
          && !BV_ISSET(pmove_data->can_see_unit_at_dest,
                       player_index(aplayer))) {
        unit_goes_out_of_sight(aplayer, pdata->punit);
      }
    } players_iterate_end;
  } unit_move_data_list_iterate_rev_end;

  /* Clear old vision. */
  unit_move_data_list_iterate(plist, pmove_data) {
    vision_clear_sight(pmove_data->old_vision);
    vision_free(pmove_data->old_vision);
  } unit_move_data_list_iterate_end;

  /* Move consequences. */
  unit_move_data_list_both_iterate(plist, plink, pmove_data) {
    struct unit *aunit = player_unit_by_number(pmove_data->powner,
                                               pmove_data->unit_id);

    if (aunit == pmove_data->punit && unit_tile(aunit) == pdesttile) {
      (void) unit_move_consequences(aunit, psrctile, pdesttile,
                                    pdata != pmove_data);
    } else {
      unit_move_data_list_erase(plist, plink);
    }
  } unit_move_data_list_both_iterate_end;
  /* Check alive units. */
  unit_move_data_list_both_iterate(plist, plink, pmove_data) {
    struct unit *aunit = player_unit_by_number(pmove_data->powner,
                                               pmove_data->unit_id);

    if (aunit != pmove_data->punit || unit_tile(aunit) != pdesttile) {
      unit_move_data_list_erase(plist, plink);
    }
  } unit_move_data_list_both_iterate_end;
  pdata = unit_move_data_list_front(plist);
  if (pdata == NULL || punit != pdata->punit) {
    unit_lives = FALSE;
    pdata = NULL;
  }

  /* Wakeup units and make contact. */  /* Remove units going out of sight. */
        unit_move_data_list_iterate_rev(plist, pmove_data) {
          players_iterate(aplayer) {
            if (aplayer != pmove_data->powner
                && BV_ISSET(pdata->can_see_unit_at_dest,
                            player_index(aplayer))
                && !can_player_see_unit(aplayer, pmove_data->punit)) {
              unit_goes_out_of_sight(aplayer, punit);
            }
          } players_iterate_end;
        } unit_move_data_list_iterate_rev_endif (unit_lives) {game.est_connections);

  unit_move_data_list_destroy(plistENDREP
id: 1a.5kv.r26855/12921
type: file
pred: 1a.5kv.r26849/5220
count: 708
text: 26855 0 12894 144214 9cd16c5efb4990f5dcd956e39af351aa
props: 11095 1637 112 0 c5bfe3670c093a84ebf28b66298044e4
cpath: /branches/S2_5/server/unittools.c
copyroot: 22812 /branches/S2_5

PLAIN
K 11
Makefile.am
V 22
file 5q.5kv.r26602/963
K 8
advisors
V 23
dir 4n2.5kv.r25683/1257
K 9
aiiface.c
V 25
file 4gm.5ck.r22318/27020
K 9
aiiface.h
V 24
file 4gn.5ck.r20559/1295
K 6
auth.c
V 25
file 39c.5ck.r20274/32101
K 6
auth.h
V 25
file 39d.5ck.r18977/19170
K 11
barbarian.c
V 24
file lw.5kv.r25427/14169
K 11
barbarian.h
V 24
file lx.5ck.r22667/36940
K 14
citizenshand.c
V 25
file 6mz.5ck.r22267/14643
K 14
citizenshand.h
V 25
file 6n0.5ck.r22267/14833
K 10
cityhand.c
V 24
file 10.5ck.r19573/66885
K 10
cityhand.h
V 23
file 4f.0.r13297/423686
K 11
citytools.c
V 23
file 4g.5kv.r26847/1980
K 11
citytools.h
V 24
file 4h.5kv.r26533/10341
K 10
cityturn.c
V 23
file 4i.5kv.r26812/2489
K 10
cityturn.h
V 24
file 4j.5ck.r22267/13479
K 11
civserver.c
V 23
file 4k.5kv.r24557/7334
K 11
civserver.h
V 21
file 4l.0.r2805/33121
K 10
commands.c
V 22
file 2ly.5kv.r25101/53
K 10
commands.h
V 24
file 2lz.5ck.r21821/2153
K 13
connecthand.c
V 24
file 2dw.5kv.r26264/1131
K 13
connecthand.h
V 24
file 2dx.5kv.r23607/6193
K 9
console.c
V 24
file dd.5kv.r24896/15603
K 9
console.h
V 23
file de.5ck.r19183/7918
K 10
diplhand.c
V 23
file 4m.5kv.r26849/4963
K 10
diplhand.h
V 21
file 4n.0.r13421/6826
K 11
diplomats.c
V 21
file vz.5kv.r26752/86
K 11
diplomats.h
V 23
file w0.5ck.r19106/3619
K 10
edithand.c
V 23
file 3bk.5kv.r26702/722
K 10
edithand.h
V 26
file 4ez.5ck.r18452/115476
K 6
fcdb.c
V 24
file 6l3.5kv.r25474/3634
K 6
fcdb.h
V 25
file 6l4.5kv.r24501/15794
K 10
gamehand.c
V 24
file 4o.5kv.r26191/17584
K 10
gamehand.h
V 24
file 4p.5ck.r15698/24111
K 9
generator
V 24
dir 2me.5kv.r26497/34651
K 11
ggzserver.c
V 25
file 39a.5ck.r20126/49744
K 11
ggzserver.h
V 23
file 39b.5ck.r20191/350
K 10
handchat.c
V 24
file 4q.5kv.r25916/11288
K 10
handchat.h
V 24
file dj.5ck.r18270/28229
K 9
maphand.c
V 23
file 13.5kv.r26736/8570
K 9
maphand.h
V 23
file 14.5kv.r24760/7587
K 6
meta.c
V 22
file 4s.5kv.r26486/191
K 6
meta.h
V 24
file 4t.5kv.r24201/11322
K 8
notify.c
V 24
file 4i2.5ck.r22596/6685
K 8
notify.h
V 24
file 4i3.5ck.r18282/3660
K 9
plrhand.c
V 22
file 4u.5kv.r26705/216
K 9
plrhand.h
V 24
file 4v.5kv.r26693/42243
K 8
report.c
V 22
file vi.5kv.r26451/108
K 8
report.h
V 24
file vj.5ck.r18270/29203
K 10
rssanity.c
V 23
file hew.5kv.r26785/643
K 10
rssanity.h
V 25
file hey.5ck.r21709/23329
K 9
ruleset.c
V 23
file 8w.5kv.r26839/8818
K 9
ruleset.h
V 24
file 8x.5kv.r24188/21310
K 13
sanitycheck.c
V 23
file wi.5kv.r26110/1695
K 13
sanitycheck.h
V 24
file wj.5ck.r20315/26296
K 10
savegame.c
V 24
file vl.5kv.r26429/14524
K 10
savegame.h
V 24
file vm.5ck.r20758/19233
K 11
savegame2.c
V 23
file 4m0.5kv.r26500/136
K 11
savegame2.h
V 25
file 4m1.5ck.r21363/11592
K 7
score.c
V 24
file 2eg.5ck.r21929/5694
K 7
score.h
V 24
file 2eh.5ck.r21929/6179
K 9
scripting
V 23
dir 31x.5kv.r26845/1359
K 8
sernet.c
V 22
file 15.5kv.r26842/590
K 8
sernet.h
V 24
file 4y.5ck.r19197/31924
K 10
settings.c
V 24
file 2m0.5kv.r26811/9796
K 10
settings.h
V 24
file 2m1.5kv.r23404/2389
K 11
spacerace.c
V 24
file 9a.5kv.r24606/23848
K 11
spacerace.h
V 21
file 9b.0.r11338/1129
K 9
srv_log.c
V 25
file 15t.5el.r22382/32625
K 9
srv_log.h
V 25
file 15u.5em.r20315/26035
K 10
srv_main.c
V 22
file vg.5kv.r26705/473
K 10
srv_main.h
V 24
file vh.5kv.r23883/21338
K 11
stdinhand.c
V 22
file 4z.5kv.r26810/216
K 11
stdinhand.h
V 24
file 50.5kv.r25916/11029
K 11
techtools.c
V 23
file 33n.5kv.r26548/161
K 11
techtools.h
V 25
file 33o.5ck.r21976/23870
K 10
unithand.c
V 23
file 18.5kv.r26736/7530
K 10
unithand.h
V 24
file 19.5ck.r21095/21648
K 11
unittools.c
V 24
file 1a.5kv.r26855/12921
K 11
unittools.h
V 23
file 1b.5kv.r26849/5482
K 8
voting.c
V 24
file 4ex.5kv.r26272/1694
K 8
voting.h
V 22
file 4ey.5kv.r26274/47
END
ENDREP
id: z.5kv.r26855/16883
type: dir
pred: z.5kv.r26849/9442
count: 5332
text: 26855 13182 3688 3688 a3d52646328134a087a9b7d3d9bacb18
props: 23991 453 166 0 e5026e1cb18fe57b41417951bfac7b19
cpath: /branches/S2_5/server
copyroot: 22812 /branches/S2_5

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5kv.r23463/86338
K 7
AUTHORS
V 24
file 5u.5ck.r22143/14016
K 7
COPYING
V 19
file 1h.0.r9643/400
K 9
ChangeLog
V 26
file 6l.5kv.r25637/6537782
K 7
INSTALL
V 22
file 6.5kv.r25136/6183
K 11
Makefile.am
V 21
file 59.5kv.r26663/76
K 4
NEWS
V 24
file 6m.5kv.r25633/30575
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 21
dir 8.5kv.r26445/2693
K 10
autogen.sh
V 23
file 12o.5kv.r24092/228
K 9
bootstrap
V 23
dir 2p5.5kv.r25971/4686
K 6
client
V 21
dir d.5kv.r26852/6838
K 6
common
V 21
dir p.5kv.r26839/8575
K 12
configure.ac
V 23
file 149.5kv.r26602/711
K 4
data
V 21
dir w.5kv.r26809/4011
K 6
debian
V 22
dir 5w.5kv.r23304/4091
K 12
dependencies
V 23
dir 2yu.5kv.r26648/4305
K 11
diff_ignore
V 24
file qq.5ck.r21039/26581
K 3
doc
V 22
dir k7.5kv.r26811/9553
K 10
fc_version
V 25
file 2lo.5kw.r26230/63926
K 2
m4
V 24
dir 12p.5kv.r26569/16589
K 7
scripts
V 23
dir 2yo.5kv.r26113/1118
K 6
server
V 22
dir z.5kv.r26855/16883
K 5
tests
V 22
dir 2g9.5kv.r25380/686
K 5
tools
V 24
dir 4pj.5lo.r26655/47707
K 12
translations
V 23
dir t0n.5kv.r26808/7575
K 7
utility
V 22
dir 1c.5kv.r26807/6161
K 3
vms
V 25
dir u9.5ck.r21528/1396085
K 5
win32
V 23
dir 2eu.5kv.r25499/1616
END
ENDREP
id: 3.5kv.r26855/18333
type: dir
pred: 3.5kv.r26852/8285
count: 17463
text: 26855 17130 1190 1190 a58f547e1a38f4b33c9efb8cc6de4d0c
props: 20140 3888 282 0 e4bb46e81629a60eef613b169b23a9ea
cpath: /branches/S2_5
copyroot: 22812 /branches/S2_5

PLAIN
K 5
S1_14
V 21
dir 3.21.r18109/18803
K 4
S2_0
V 21
dir 3.10x.r21862/4178
K 4
S2_1
V 22
dir 3.59e.r20026/11014
K 4
S2_2
V 21
dir 3.5cy.r21861/5036
K 4
S2_3
V 21
dir 3.5f2.r24391/5183
K 4
S2_4
V 21
dir 3.5ii.r26853/7157
K 4
S2_5
V 22
dir 3.5kv.r26855/18333
K 11
freeciv-web
V 22
dir 3.5bl.r13594/14918
END
ENDREP
id: 1.0.r26855/18892
type: dir
pred: 1.0.r26853/7713
count: 8201
text: 26855 18575 304 304 0260c7f66692aeaaf0c3b73c90c10ce4
cpath: /branches
copyroot: 0 /

PLAIN
K 8
branches
V 20
dir 1.0.r26855/18892
K 4
tags
V 19
dir 2.0.r25885/6524
K 5
trunk
V 21
dir 3.5ck.r26854/5788
K 7
website
V 21
dir 3ge.0.r22980/2263
END
ENDREP
id: 0.0.r26855/19214
type: dir
pred: 0.0.r26854/6178
count: 26855
text: 26855 19048 153 153 076af6fb2ae4adc32dc437dbf3d39d06
cpath: /
copyroot: 0 /

1a.5kv.t26854-1 modify true false /branches/S2_5/server/unittools.c


19214 19363
