DELTA 24743 2371 10548
SVN  hLN5 i S OiR (6@ !ct P? $3 zD. ZRb ?s$ P?V B@W S?E X1	 c& rm 5M L; B4 t 3Z V Fk ?5 _x 5 q B@ r,h B@t B, mW P? B@mcommon */
#include "extras.h"
#include "fc_types.h"
#include "game.h"
#include "map
  FIXME: Get rid of this. _index() makes no sense when they are not
  in an arrayextra_type *const *p,
                           const struct extra_type *const *q)
{
  const struct road_type *proad = extra_road_get(*p);
  const struct road_type *qroad = extra_road_get(*q)requirement_vector_init(&proad->first_reqs);

  proad->id = idx;
  proad->integrators = NULL;
  proad->self = pextraextra_type_by_cause_iterate(EC_ROAD, pextra) {
    struct road_type *proad = extra_road_get(pextra);

    proad->integrators = extra_type_list_new();
    /* Roads always integrate with themselves. */
    extra_type_list_append(proad->integrators, pextra);
    extra_type_by_cause_iterate(EC_ROAD, oextra) {
      struct road_type *oroad = extra_road_get(oextra);
      if (BV_ISSET(proad->integrates, road_index(oroad))) {
        extra_type_list_append(proad->integrators, oextra);
      }
    } extra_type_by_cause_iterate_end;
    extra_type_list_unique(proad->integrators);
    extra_type_list_sort(proad->integrators, &compare_road_move_cost);
  } extra_type_by_causextra_type_by_cause_iterate(EC_ROAD, pextra) {
    struct road_type *proad = extra_road_get(pextra);

    requirement_vector_free(&proad->first_reqs);

    if (proad->integrators != NULL) {
      extra_type_list_destroy(proad->integrators);
      proad->integrators = NULL;
    }
  } extra_type_by_causextra_type_by_cause_iterate(EC_ROAD, pextra) {
    struct road_type *proad = extra_road_get(pextra);
    if (road_compat_special(proad) == compat) {
      return proad;
    }
  } extra_type_by_cause_iterate_end;

  return NULLextra_type_by_cause_iterate(EC_ROAD, poextra) {
      struct road_type *old = extra_road_get(poextra);

      if (road_has_flag(old, RF_PREVENTS_OTHER_ROADS)
          && tile_has_extra(ptile, poextra)) {
        return FALSE;
      }
    } extra_type_by_cause_iterate_end;
  }

  return TRUE**
  Tells if player and optionally unit have road building requirements
  fulfilled.
**********/
static bool are_road_reqs_fulfilled(const struct road_type *proad,
                                    const struct player *pplayer,
                                    const struct unit *punit,
         = road_extra_get(proad);
  const struct unit_type *utype;

  if (punit == NULL) {
    utype = NULL;
  } else {
    utype = unit_type_get(punit);
  }

  if (requirement_vector_size(&proad->first_reqs) > 0) {
    bool beginning = TRUE;

    extra_type_list_iterate(proad->integrators, iroad) {
      /* FIXME: mixing cardinal and non-cardinal roads as integrators is
       * probably not a good idea. */
      if (is_cardinal_only_road(iroad)) {
        cardinal_adjc_iterate(ptile, adjc_tile) {
          if (tile_has_extra(adjc_tile, iroad)) {
            beginning = FALSE;
            break;
          }
        } cardinal_adjc_iterate_end;
      } else {
        adjc_iterate(ptile, adjc_tile) {
          if (tile_has_extra(adjc_tile, iroad)) {
            beginning = FALSE;
            break;
          }
        } adjc_iterate_end;
      }

      if (!beginning) {
        break;
      }
    } extra_type_list_iterate_end;

    if (beginning) {
      if (!  punit, utype, NULL, NULL, NULL,
                           &proad->first_reqs, RPT_POSSIBLE)) {
        return FALSE;
      }
    }
  }punit, utype, NULL, NULL, NULL,
                        return are_road_reqs_fulfilled(proad, pplayer, NULL, ptilereturn are_road_reqs_fulfilled(proad, pplayer, punit, ptileextraextraextraextraextraadjc_iterate(ptile, adjc_tile) {
    if (tile_has_extra (does not check ptile itself).
**********/
bool is_road_flag_card_near(const struct tile *ptile, enum road_flag_id flag)
{
  extra_type_by_cause_iterate(EC_ROAD, pextra) {
    if (road_has_flag(extra_road_get(pextra), flag)) {
      cardinal_adjc_iterate(ptile, adjc_tile) {
        if (tile_has_extra(adjc_tile, pextra)) {
          return TRUE;
        }
      } cardinal_adjc_iterate_end;
    }
  } extra_type_by_causeReturns TRUE iff any adjacent tile contains a road with the given flag
  (does not check ptile itself).
**********/
bool is_road_flag_near_tile(const struct tile *ptile, enum road_flag_id flag)
{
  extra_type_by_cause_iterate(EC_ROAD, pextra) {
    if (road_has_flag(extra_road_get(pextra), flag)) {
      adjc_iterate(ptile, adjc_tile) {
        if (tile_has_extra(adjc_tile, pextra)) {
          return TRUE;
        }
      } adjc_iterate_end;
    }
  } extra_type_by_causeNULL, NULL,
                        (pextra);

  return proad->move_mode == RMM_CARDINAL || proad->move_mode == RMM_RELAXED**
  Does road type provide move bonus
**********/
bool road_provides_move_bonus(const struct road_type *proad)
{
  return proad->move_cost >= 0;
}
ENDREP
id: 6pq.5ck.r33935/5039
type: file
pred: 6pq.5ck.r32132/1500
count: 80
text: 33935 0 5009 16588 34c16858597957cac598ae87890a809a
props: 26905 202896 34 0 25e6c2f7558b7484000d4d090dea5b92
cpath: /trunk/common/road.c
copyroot: 15280 /trunk

PLAIN
K 11
Makefile.am
V 25
file 5h.5ck.r33632/234056
K 14
achievements.c
V 24
file qhc.5ck.r33814/2433
K 14
achievements.h
V 24
file qhe.5ck.r33814/2681
K 9
actions.c
V 24
file r7a.5ck.r33901/2093
K 9
actions.h
V 24
file r7c.5ck.r33861/1208
K 4
ai.c
V 24
file 4go.5ck.r31726/5773
K 4
ai.h
V 24
file 4gp.5ck.r33881/4440
K 6
aicore
V 24
dir 18t.5ck.r33908/30627
K 6
base.c
V 25
file 3jw.5ck.r32671/84793
K 6
base.h
V 25
file 3jx.5ck.r32671/85034
K 9
borders.c
V 25
file 4f0.5ck.r31935/29464
K 9
borders.h
V 26
file 4f1.5ck.r26905/213493
K 10
calendar.c
V 25
file 147p.5ck.r31992/7425
K 10
calendar.h
V 27
file 147r.5ck.r26905/215265
K 8
capstr.c
V 24
file dv.5ck.r33689/98181
K 8
capstr.h
V 24
file dw.5ck.r18858/97074
K 6
chat.h
V 24
file dj.5wt.r33223/26762
K 10
citizens.c
V 26
file 6mx.5ck.r26905/203234
K 10
citizens.h
V 26
file 6my.5ck.r26905/204108
K 6
city.c
V 23
file q.5ck.r33908/30864
K 6
city.h
V 24
file 3q.5ck.r33527/74560
K 13
clientutils.c
V 26
file zj9.5ck.r26905/212022
K 13
clientutils.h
V 26
file zjb.5ck.r26905/213199
K 8
combat.c
V 24
file wp.5ck.r32671/85276
K 8
combat.h
V 24
file wq.5ck.r24573/25814
K 9
culture.c
V 27
file 104t.5ck.r26905/202652
K 9
culture.h
V 27
file 104v.5ck.r26905/203523
K 11
diptreaty.c
V 24
file 3r.5ck.r30328/78509
K 11
diptreaty.h
V 24
file 3s.5ck.r27517/13575
K 10
disaster.c
V 24
file b2m.5ck.r32459/3378
K 10
disaster.h
V 25
file b2o.5ck.r28753/25083
K 9
effects.c
V 24
file 2eo.5ck.r32924/9802
K 9
effects.h
V 24
file 2ep.5ck.r33626/5067
K 8
events.c
V 25
file 33h.5ck.r33605/10831
K 8
events.h
V 24
file 3t.5ck.r33605/11074
K 8
extras.c
V 24
file o9u.5ck.r33771/5126
K 8
extras.h
V 24
file o9w.5ck.r33771/5369
K 12
fc_cmdhelp.c
V 26
file 76j.5ck.r26905/216438
K 12
fc_cmdhelp.h
V 26
file 76k.5ck.r26905/216731
K 14
fc_interface.c
V 25
file 4up.5ck.r30095/11458
K 14
fc_interface.h
V 24
file 4uq.5ck.r33040/6826
K 10
fc_types.h
V 24
file 2ll.5ck.r33814/2927
K 15
featured_text.c
V 23
file 4h3.5ck.r33433/118
K 15
featured_text.h
V 23
file 4h4.5ck.r33433/362
K 6
game.c
V 24
file 3u.5ck.r33483/63317
K 6
game.h
V 25
file 3v.5ck.r33665/103662
K 19
generate_packets.py
V 23
file 2f4.5ck.r32904/459
K 12
government.c
V 22
file he.5ck.r33641/872
K 12
government.h
V 23
file hf.5ck.r33641/1115
K 6
idex.c
V 25
file qo.5ck.r32526/118033
K 6
idex.h
V 24
file qp.5ck.r18858/92434
K 13
improvement.c
V 25
file vb.5ck.r32526/118274
K 13
improvement.h
V 23
file vc.5ck.r33074/3506
K 5
map.c
V 23
file r.5ck.r33483/63799
K 5
map.h
V 22
file 41.5ck.r33663/728
K 11
map_types.h
V 26
file 216z.5ck.r33020/14504
K 8
mapimg.c
V 25
file 6n9.5ck.r33483/64280
K 8
mapimg.h
V 26
file 6na.5ck.r26905/215559
K 15
metaknowledge.c
V 24
file siq.5ck.r32920/7211
K 15
metaknowledge.h
V 24
file sis.5ck.r32258/4135
K 10
movement.c
V 26
file 2xv.5ck.r33097/213452
K 10
movement.h
V 23
file 2xw.5ck.r32838/690
K 13
multipliers.c
V 25
file 197b.5ck.r32459/4353
K 13
multipliers.h
V 26
file 197d.5ck.r29117/26290
K 18
name_translation.h
V 24
file 4k1.5ck.r32459/4601
K 8
nation.c
V 24
file il.5ck.r33386/79163
K 8
nation.h
V 24
file im.5ck.r32925/36846
K 10
networking
V 25
dir 2gws.5ck.r33908/32034
K 8
player.c
V 23
file 45.5ck.r33036/5070
K 8
player.h
V 22
file 46.5ck.r32500/612
K 9
reqtext.c
V 23
file 2ob8.5ck.r33806/54
K 9
reqtext.h
V 26
file 2oba.5ck.r33783/13455
K 14
requirements.c
V 23
file 2wq.5ck.r33862/715
K 14
requirements.h
V 25
file 2wr.5ck.r33863/19462
K 10
research.c
V 24
file 4ro.5ck.r32922/7196
K 10
research.h
V 24
file 4rp.5ck.r27750/1056
K 10
rgbcolor.c
V 25
file 6i6.5ck.r31090/42043
K 10
rgbcolor.h
V 25
file 6i7.5ck.r31090/42290
K 6
road.c
V 24
file 6pq.5ck.r33935/5039
K 6
road.h
V 25
file 6pr.5ck.r32069/28162
K 10
scriptcore
V 23
dir 75a.5ck.r33884/4071
K 11
spaceship.c
V 24
file 98.5ck.r33765/44399
K 11
spaceship.h
V 22
file 99.5ck.r33680/332
K 12
specialist.c
V 24
file 33f.5ck.r33778/1445
K 12
specialist.h
V 24
file 33g.5ck.r33778/1688
K 7
style.c
V 24
file zzb.5ck.r33771/5613
K 7
style.h
V 24
file zzd.5ck.r33771/5853
K 6
team.c
V 24
file 33i.5ck.r33326/1430
K 6
team.h
V 23
file 33j.5ck.r26183/314
K 6
tech.c
V 22
file t.5ck.r33324/9294
K 6
tech.h
V 22
file u.5ck.r33324/9532
K 9
terrain.c
V 24
file 2fp.5ck.r33667/1144
K 9
terrain.h
V 23
file qs.5ck.r33814/3169
K 6
tile.c
V 25
file 2ys.5ck.r33483/66733
K 6
tile.h
V 23
file 2yt.5ck.r33784/202
K 13
traderoutes.c
V 25
file bf8.5ck.r33908/32221
K 13
traderoutes.h
V 25
file bfa.5ck.r33908/32469
K 8
traits.h
V 25
file 7k3.5ck.r30330/11323
K 6
unit.c
V 22
file v.5ck.r33887/2070
K 6
unit.h
V 23
file 48.5ck.r33887/2302
K 10
unitlist.c
V 25
file 39m.5ck.r31889/62464
K 10
unitlist.h
V 26
file 39n.5ck.r27611/110113
K 10
unittype.c
V 24
file v9.5ck.r33828/81718
K 10
unittype.h
V 23
file va.5ck.r33695/1417
K 9
version.c
V 23
file oe.5ck.r31866/3027
K 9
version.h
V 23
file e7.5ck.r31866/3263
K 9
victory.c
V 26
file qex.5ck.r26905/217020
K 9
victory.h
V 26
file qez.5ck.r26905/217896
K 8
vision.c
V 23
file 4dm.5ck.r33561/483
K 8
vision.h
V 23
file 4dn.5ck.r33796/456
K 12
workertask.c
V 26
file llw.5ck.r26905/206753
K 12
workertask.h
V 25
file lly.5ck.r28926/17170
K 10
worklist.c
V 24
file o8.5ck.r32721/82052
K 10
worklist.h
V 24
file o9.5ck.r32721/82295
K 14
world_object.h
V 26
file 2ngs.5ck.r33483/66975
END
ENDREP
id: p.5ck.r33935/10511
type: dir
pred: p.5ck.r33908/37950
count: 4855
text: 33935 5278 5220 0 615b06d783b61c60f9a35b4c0f9d8645
props: 23743 0 112 0 b2bc91bf125d83375389d51f25ff2c2f
cpath: /trunk/common
copyroot: 15280 /trunk

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5ck.r33136/31347
K 7
AUTHORS
V 24
file 5u.5ck.r22143/14016
K 7
COPYING
V 22
file 1h.5ck.r29454/952
K 9
ChangeLog
V 26
file 6l.5ck.r31297/7697235
K 7
INSTALL
V 21
file 6.5ck.r33470/217
K 11
Makefile.am
V 22
file 59.5ck.r33448/261
K 4
NEWS
V 24
file 6m.5ck.r25634/30702
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 21
dir 8.5ck.r33923/3037
K 10
autogen.sh
V 23
file 12o.5ck.r33470/442
K 9
bootstrap
V 23
dir 2p5.5ck.r33447/3735
K 6
client
V 21
dir d.5ck.r33929/4707
K 6
common
V 22
dir p.5ck.r33935/10511
K 12
configure.ac
V 22
file 149.5ck.r33690/80
K 4
data
V 22
dir w.5ck.r33908/53028
K 12
dependencies
V 23
dir 2yu.5ck.r33404/2662
K 3
doc
V 22
dir k7.5ck.r33910/2086
K 10
fc_version
V 25
file 2lo.5en.r33908/53257
K 11
gen_headers
V 24
dir 1hsw.5ck.r32371/1764
K 3
lua
V 24
dir 2c5e.5ck.r31919/4841
K 2
m4
V 23
dir 12p.5ck.r33871/2477
K 7
scripts
V 23
dir 2yo.5ck.r31852/3843
K 6
server
V 22
dir z.5ck.r33932/73498
K 5
tests
V 22
dir 2g9.5ck.r32361/591
K 5
tools
V 24
dir 4pj.5js.r33908/60133
K 12
translations
V 23
dir t0a.5ck.r33795/9547
K 7
utility
V 23
dir 1c.5ck.r33765/61991
K 7
windows
V 23
dir 2eu.5x1.r33910/4456
END
ENDREP
id: 3.5ck.r33935/11906
type: dir
pred: 3.5ck.r33932/74895
count: 21964
text: 33935 10737 1156 0 1081b8ea78cff2da96b4ce43d74e5f80
props: 28036 14655 292 0 9e1d5de0253c723466868990c52c129f
cpath: /trunk
copyroot: 15280 /trunk

PLAIN
K 8
branches
V 19
dir 1.0.r33934/7526
K 4
tags
V 19
dir 2.0.r33382/6667
K 5
trunk
V 22
dir 3.5ck.r33935/11906
K 7
website
V 21
dir 3ge.0.r33387/2571
END
ENDREP
id: 0.0.r33935/12297
type: dir
pred: 0.0.r33934/7845
count: 33935
text: 33935 12131 153 0 e294b09d37aa474ab0e3308ca89066ac
cpath: /
copyroot: 0 /

6pq.5ck.t33934-1 modify true false /trunk/common/road.c


12297 12444
