DELTA 8213 3130 5537
SVN  ÍHìT»D J ¯ „0r€ „\…R€ FŠa€ƒo ? …b=‰ >–;³ ‡_˜ eŸ~ A d ‚+¢&€u ¥s³ §,€M ƒG©€b A¬U „Z®F ³'€ƒ{ =¶X€… G €†' G € ¾k€ž% G €kÍCFreeciv - Copyright (C) 2004 - Marcelo J. Burdafdef HAVE_CONFIG_H
#include <fc_config.h>
#endif

#include <math.h> /* sqrt */

/* utility */
#include "log.h"

/* common */
#include "game.h"
#include "mapconst struct tile *ptile)
{
  double x, y;
  int tile_x, tile_y;

  fc_assert_ret_val(ptile != NULL, MAX_COLATITUDE / 2);

  if (game.map.server
  index_to_map_pos(&tile_x, &tile_y, tile_index(ptile));
  do_in_natural_pos(ntl_x, ntl_y, tile_x, tile_y) {
    if (game.map.server.single_pole) {
      if (!current_topo_has_flag(TF_WRAPY)) {
        /* Partial planetary map.  A polar zone is placed
         * at the top and the equator is at the bottom. */
        return MAX_COLATITUDE * ntl_y / (NATURAL_HEIGHT - 1);
      }
      if (!current_topo_has_flag(TF_WRAPX)) {
        return MAX_COLATITUDE * ntl_x / (NATURAL_WIDTH -1);
      }!current_
  if (!current_topo_has_flag(TF_WRAPX) && current_in RT 8624; the discussion can be found at
   * http://thread.gmane.org/gmane.games.freeciv.devel/42648 */
  return MAX_COLATITUDE * (1.5 * (x * x * y + x * y * y)
                           - 0.5 * (x * x * x + y * y * y)
                      typical city radius is SINGULAR.  This is
  used toconst struct tile *ptile)
{
  return is_singular_tile(ptile, CITY_MAP_DEFAULT/* The generator works also for odd values; keep this here for autogenerated
   * height and widthMAP_IS_ISOMETRICgame.map.xsize = Xratio * i_size * even;
  game.map.ysize = Yratio * i_size * even * iso;

  /* Now make sure the size isn't too large for this ratio or the overall map
   * size (MAP_INDEX_SIZE) is larger than the maximal allowed size
   * (MAP_MAX_SIZE * 1000). If it is then decrease the size and try again. */
  if (game.map.xsize > MAP_MAX_LINEAR_SIZE
      || game.map.ysize > MAP_MAX_LINEAR_SIZE
      || MAP_INDEX_SIZE > MAP_MAX_SIZE * 1000) {
    fc_assert(size > 100.0);
    set_sizes(size - 100.0game.map.server.size * 1000 > size + 900.0) {
    /* Warning when size is set uselessly big */ 
    log_error("Requested size of %d is too big for this topology.",
              game.map.server.size);
  }

  /* xsize and ysize must be between MAP_MIN_LINEAR_SIZE and
   * MAP_MAX_LINEAR_SIZE. */
  game.map.xsize = CLIP(MAP_MIN_LINEAR_SIZE, game.map.xsize, MAP_MAX_LINEAR_SIZE);
  game.map.ysize = CLIP(MAP_MIN_LINEAR_SIZE, game.map.ysize, MAP_MAX_LINEAR_SIZE);

  log_normal(_("Creating a map of size %d x %d = %d tiles (%d requested)."),
             game.map.xsize, game.map.ysize, game.map.xsize * game.map.ysize,
             (int) size);
}

******
  Return the default ratios for known topologies.

 The factor x_ratio * y_ratio determines the accuracy of the size.
 Small ratios work better than large ones; 3:2 is not the same as 6:4
****************************************************************************/
static void get_ratios(int *x_ratio, int *y_ratio)
{
  if (current_topo_has_flag(TF_WRAPX)) {
    if (current_topo_has_flag(TF_WRAPY)) {
      /* Ratios for torus map. */
      *x_ratio = 1;
      *y_ratio = 1;
    } else {
      /* Ratios for classic map. */
      *x_ratio = 3;
      *y_ratio = 2;
    }
  } else {
    if (current_topo_has_flag(TF_WRAPY)) {
      /* Ratios for uranus map. */
      *x_ratio = 2;
      *y_ratio = 3;
    } else {
      /* Ratios for flat map. */
      *x_ratio = 1;
      *y_ratio = 1;
    }
  }
}

*****
  This function sets sizes in a topology-specific way then calls
  map_init_topology(). Set 'autosize' to TRUE if the xsize/ysize should be
  calculatedint sqsize;
  double map_size;

  /* The server behavior to create the map is defined by 'map.server.mapsize'.
   * Calculate the xsize/ysize if it is not directly defined. */
  if (autosize) {
    int x_ratio, y_ratio;

    switch (game.map.server.mapsize) {
    case MAPSIZE_XYSIZE:
      game.map.server.size = (float)(game.map.xsize * game.map.ysize) / 1000.0 + 0.5;
      game.map.server.tilesperplayer = ((map_num_tiles() * game.map.server.landpercent)
                                   / (player_count() * 100));
      log_normal(_("Creating a map of size %d x %d = %d tiles (map size: "
                   "%d)."), game.map.xsize, game.map.ysize, game.map.xsize * game.map.ysize,
                 game.map.server.size);
      break;

    case MAPSIZE_PLAYER:
      map_size = ((double) (player_count() * game.map.server.tilesperplayer * 100)
                  / game.map.server.landpercent);

      if (map_size < MAP_MIN_SIZE * 1000) {
        game.map.server.size = MAP_MIN_SIZE;
        map_size = MAP_MIN_SIZE * 1000;
        log_normal(_("Map size calculated for %d (land) tiles per player "
                     "and %d player(s) too small. Setting map size to the "
                     "minimal size %d."), game.map.server.tilesperplayer,
                   player_count(), game.map.server.size);
      } else if (map_size > MAP_MAX_SIZE * 1000) {
        game.map.server.size = MAP_MAX_SIZE;
        map_size = MAP_MAX_SIZE * 1000;
        log_normal(_("Map size calculated for %d (land) tiles per player "
                     "and %d player(s) too large. Setting map size to the "
                     "maximal size %d."), game.map.server.tilesperplayer,
                   player_count(), game.map.server.size);
      } else {
        game.map.server.size = (double) map_size / 1000.0 + 0.5;
        log_normal(_("Setting map size to %d (approx. %d (land) tiles for "
                     "each of the %d player(s))."), game.map.server.size,
                   game.map.server.tilesperplayer, player_count());
      }
      get_ratios(&x_ratio, &y_ratio);
      set_sizes(map_size, x_ratio, y_ratio);
      break;

    case MAPSIZE_FULLSIZE:
      /* Set map.xsize and map.ysize based on map.size. */
      get_ratios(&x_ratio, &y_ratio);
      set_sizes(game.map.server.size * 1000, x_ratio, y_ratio);
      game.map.server.tilesperplayer = ((map_num_tiles() * game.map.server.landpercent)
                                   / (player_count() * 100));
      break;
    }
  } else {
    game.map.server.size = (double) map_num_tiles() / 1000.0 + 0.5;
    game.map.server.tilesperplayer = ((map_num_tiles() * game.map.server.landpercent)
                                 / (player_count() * 100));
  }

  sqsize = get_sqsize();

  /* initialize the ICE_BASE_LEVEL */

  /* if maps has strip like poles we get smaller poles
   * (less playables than island poles)
   *   5% for little maps
   *   2% for big ones, if map.server.temperature == 50
   * exept if separate poles is set */
  if (game.map.server.separatepoles) {
    /* with separatepoles option strip poles are useless */
    ice_base_colatitude =
        (MAX(0, 100 * COLD_LEVEL / 3 - 1 *  MAX_COLATITUDE)
         + 1 *  MAX_COLATITUDE * sqsize) / (100 * sqsize);
  } else {
    /* any way strip poles are not so playable as isle poles */
    ice_base_colatitude =
        (MAX(0, 100 * COLD_LEVEL / 3 - 2 * MAX_COLATITUDE)
         + 2 * MAX_COLATITUDE * sqsize) / (100 * sqsize);
  }

  /* correction for single pole (Flat Earth) */
  if (game.map.server.single_pole) {
    if (!current_topo_has_flag(TF_WRAPY) || !current_topo_has_flag(TF_WRAPX)) {
      ice_base_colatitude /= 2;
    }
  }

  if (game.map.server.huts_absolute >= 0) {
    game.map.server.huts = game.map.server.huts_absolute * 1000 / map_num_tiles();
    game.map.server.huts_absolute = -1;
  }

  map_init_topology();
}

***** 
  An estimate of the linear (1-dimensional) size of the map.
***************************************************************************/
int get_sqsize(void)
{
  int sqsize = sqrt(MAP_INDEX_SIZE / 1000);

  return MAX(1, sqsizeENDREP
id: 2ml.5qi.r31849/7801
type: file
pred: 2ml.5qi.r31002/27932
count: 32
text: 31849 0 7773 13908 32e775f37e8eef63d04321a31b535d5e
props: 9904 3275 110 0 705660468cdcbf270377dea86b274451
cpath: /branches/S2_6/server/generator/mapgen_topology.c
copyroot: 27474 /branches/S2_6

PLAIN
K 11
Makefile.am
V 25
file 2mf.5ck.r17430/10847
K 12
height_map.c
V 26
file 2mj.5qi.r30222/102683
K 12
height_map.h
V 26
file 2mk.5bk.r13949/117031
K 8
mapgen.c
V 24
file 2mg.5qi.r31534/8154
K 8
mapgen.h
V 25
file 2mh.5ck.r19265/30017
K 17
mapgen_topology.c
V 24
file 2ml.5qi.r31849/7801
K 17
mapgen_topology.h
V 26
file 2mm.5qi.r30222/103514
K 10
startpos.c
V 26
file 2mt.5qi.r30222/103793
K 10
startpos.h
V 24
file 2mu.5ck.r18296/4932
K 17
temperature_map.c
V 26
file 2mn.5qi.r30222/104066
K 17
temperature_map.h
V 25
file 2mo.5ck.r20375/12210
K 11
utilities.c
V 26
file 2mp.5qi.r30222/104347
K 11
utilities.h
V 24
file 2mq.5qi.r28864/1364
END
ENDREP
id: 2me.5qi.r31849/8735
type: dir
pred: 2me.5qi.r31534/9085
count: 197
text: 31849 8076 646 0 ac3371661f39c1e90369a9fbba4e1f95
props: 11108 4081 68 0 445aae39c72ff2e5199436fb06040160
cpath: /branches/S2_6/server/generator
copyroot: 27474 /branches/S2_6

PLAIN
K 11
Makefile.am
V 24
file 5q.5qi.r28430/14363
K 13
actiontools.c
V 27
file 1p8q.5qi.r31154/115051
K 13
actiontools.h
V 26
file 1p8t.5qi.r28430/14182
K 8
advisors
V 23
dir 4n2.5qi.r31487/5504
K 9
aiiface.c
V 25
file 4gm.5ck.r26905/55786
K 9
aiiface.h
V 25
file 4gn.5ck.r26905/56374
K 9
animals.c
V 24
file vnk.5qi.r31066/7733
K 9
animals.h
V 25
file vnm.5ck.r26905/63257
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.5qi.r30875/23564
K 11
barbarian.h
V 22
file lx.5qi.r28606/673
K 14
citizenshand.c
V 25
file 6mz.5qi.r29646/26851
K 14
citizenshand.h
V 25
file 6n0.5ck.r26905/56662
K 10
cityhand.c
V 22
file 10.5qi.r31108/127
K 10
cityhand.h
V 23
file 4f.0.r13297/423686
K 11
citytools.c
V 23
file 4g.5qi.r31253/4533
K 11
citytools.h
V 23
file 4h.5qi.r29015/8710
K 10
cityturn.c
V 24
file 4i.5qi.r31546/25474
K 10
cityturn.h
V 24
file 4j.5qi.r31248/20765
K 11
civserver.c
V 24
file 4k.5qi.r31660/12343
K 10
commands.c
V 25
file 2ly.5qi.r30817/40910
K 10
commands.h
V 25
file 2lz.5qi.r28013/36715
K 13
connecthand.c
V 25
file 2dw.5qi.r31664/94838
K 13
connecthand.h
V 24
file 2dx.5ck.r23606/2057
K 9
console.c
V 24
file dd.5qi.r31823/12861
K 9
console.h
V 23
file de.5qi.r31515/8464
K 10
diplhand.c
V 24
file 4m.5qi.r31333/19083
K 10
diplhand.h
V 23
file 4n.5qi.r27518/5128
K 11
diplomats.c
V 23
file vz.5qi.r31253/5048
K 11
diplomats.h
V 23
file w0.5ck.r27461/1674
K 10
edithand.c
V 25
file 3bk.5qi.r31793/46430
K 10
edithand.h
V 25
file 4ez.5ck.r26905/64705
K 6
fcdb.c
V 23
file 6l3.5qi.r30953/119
K 6
fcdb.h
V 25
file 6l4.5ck.r26905/57239
K 10
gamehand.c
V 22
file 4o.5qi.r30551/550
K 10
gamehand.h
V 24
file 4p.5ck.r26564/23149
K 9
generator
V 23
dir 2me.5qi.r31849/8735
K 10
handchat.c
V 23
file 4q.5ck.r25915/6654
K 10
handchat.h
V 24
file dj.5ck.r18270/28229
K 9
maphand.c
V 24
file 13.5qi.r31137/53157
K 9
maphand.h
V 24
file 14.5qi.r31137/53420
K 6
meta.c
V 24
file 4s.5qi.r31660/12600
K 6
meta.h
V 23
file 4t.5ck.r27204/3095
K 6
mood.c
V 26
file 112c.5ck.r26905/63547
K 6
mood.h
V 26
file 112e.5ck.r26905/64129
K 8
notify.c
V 23
file 4i2.5qi.r31786/855
K 8
notify.h
V 25
file 4i3.5qi.r31371/15986
K 9
plrhand.c
V 24
file 4u.5qi.r31793/46693
K 9
plrhand.h
V 24
file 4v.5qi.r31793/46952
K 8
report.c
V 23
file vi.5qi.r29900/1902
K 8
report.h
V 23
file vj.5qi.r29900/2158
K 10
rssanity.c
V 25
file hew.5qi.r31634/20355
K 10
rssanity.h
V 25
file hey.5ck.r26905/55500
K 9
ruleset.c
V 24
file 8w.5qi.r31631/29636
K 9
ruleset.h
V 24
file 8x.5qi.r30103/20281
K 13
sanitycheck.c
V 23
file wi.5qi.r30958/3358
K 13
sanitycheck.h
V 24
file wj.5qi.r28076/13693
K 12
savecompat.c
V 24
file qva.5qi.r31482/5611
K 12
savecompat.h
V 24
file qvc.5qi.r30204/4618
K 10
savegame.c
V 22
file vl.5qi.r31598/237
K 10
savegame.h
V 24
file vm.5ck.r20758/19233
K 11
savegame2.c
V 23
file 4m0.5qi.r31588/473
K 11
savegame2.h
V 25
file 4m1.5ck.r26905/58971
K 7
score.c
V 25
file 2eg.5qi.r29646/30135
K 7
score.h
V 24
file 2eh.5ck.r21929/6179
K 9
scripting
V 23
dir 31x.5qi.r31253/6888
K 8
sernet.c
V 24
file 15.5qi.r31823/13119
K 8
sernet.h
V 23
file 4y.5ck.r23685/5129
K 10
settings.c
V 25
file 2m0.5qi.r31664/95104
K 10
settings.h
V 23
file 2m1.5qi.r29780/954
K 11
spacerace.c
V 23
file 9a.5qi.r31487/5759
K 11
spacerace.h
V 23
file 9b.5qi.r31487/6019
K 9
srv_log.c
V 24
file 15t.5rh.r28854/9971
K 9
srv_log.h
V 25
file 15u.5ri.r28013/36974
K 10
srv_main.c
V 24
file vg.5qi.r31660/13109
K 10
srv_main.h
V 23
file vh.5qi.r31621/2340
K 11
stdinhand.c
V 24
file 4z.5qi.r31823/13378
K 11
stdinhand.h
V 24
file 50.5qi.r31823/13640
K 11
techtools.c
V 22
file 33n.5qi.r31624/97
K 11
techtools.h
V 23
file 33o.5qi.r31624/354
K 10
unithand.c
V 22
file 18.5qi.r31478/512
K 10
unithand.h
V 23
file 19.5qi.r30792/9489
K 11
unittools.c
V 22
file 1a.5qi.r31842/102
K 11
unittools.h
V 23
file 1b.5qi.r31031/2636
K 8
voting.c
V 25
file 4ex.5ck.r26905/57525
K 8
voting.h
V 25
file 4ey.5ck.r26905/58399
END
ENDREP
id: z.5qi.r31849/12940
type: dir
pred: z.5qi.r31842/4310
count: 6190
text: 31849 8989 3938 0 4db25656961ff9f2bde5610d5400ecf1
props: 23990 448 166 0 e5026e1cb18fe57b41417951bfac7b19
cpath: /branches/S2_6/server
copyroot: 27474 /branches/S2_6

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5ck.r27270/69307
K 7
AUTHORS
V 24
file 5u.5ck.r22143/14016
K 7
COPYING
V 22
file 1h.5qi.r29455/952
K 9
ChangeLog
V 26
file 6l.5qi.r31298/7507168
K 7
INSTALL
V 22
file 6.5qi.r31740/1317
K 11
Makefile.am
V 23
file 59.5qi.r31812/2624
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.5qi.r31825/2881
K 10
autogen.sh
V 24
file 12o.5qi.r31740/1559
K 9
bootstrap
V 23
dir 2p5.5qi.r31374/4550
K 6
client
V 21
dir d.5qi.r31835/8011
K 6
common
V 22
dir p.5qi.r31829/29643
K 12
configure.ac
V 23
file 149.5qi.r31784/214
K 4
data
V 21
dir w.5qi.r31843/5535
K 12
dependencies
V 23
dir 2yu.5qi.r31823/9339
K 3
doc
V 22
dir k7.5qi.r31802/2968
K 10
fc_version
V 25
file 2lo.5qj.r31793/46172
K 11
gen_headers
V 24
dir 1hsw.5qi.r31823/9927
K 2
m4
V 24
dir 12p.5qi.r31823/12621
K 7
scripts
V 24
dir 2yo.5qi.r31425/15183
K 6
server
V 22
dir z.5qi.r31849/12940
K 5
tests
V 22
dir 2g9.5qi.r31521/645
K 5
tools
V 23
dir 4pj.5qp.r31831/7752
K 12
translations
V 23
dir t0a.5qi.r31733/2917
K 7
utility
V 23
dir 1c.5qi.r31829/33877
K 3
vms
V 25
dir u9.5ck.r21528/1396085
K 5
win32
V 23
dir 2eu.5qi.r31817/6451
END
ENDREP
id: 3.5qi.r31849/14355
type: dir
pred: 3.5qi.r31843/6949
count: 20386
text: 31849 13183 1159 0 6180428fd3287f1fd003f578cc9d7c2c
props: 28037 14463 292 0 9e1d5de0253c723466868990c52c129f
cpath: /branches/S2_6
copyroot: 27474 /branches/S2_6

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.r29458/5135
K 4
S2_4
V 22
dir 3.5ii.r30401/87429
K 4
S2_5
V 21
dir 3.5kv.r31845/6469
K 6
S2_5_3
V 23
dir 3.5ut.r31805/553797
K 4
S2_6
V 22
dir 3.5qi.r31849/14355
K 11
freeciv-web
V 22
dir 3.5bl.r13594/14918
END
ENDREP
id: 1.0.r31849/14989
type: dir
pred: 1.0.r31845/7099
count: 10795
text: 31849 14595 381 0 6f759cfadc2b384bf8407bb5d5e6e0a1
cpath: /branches
copyroot: 0 /

PLAIN
K 8
branches
V 20
dir 1.0.r31849/14989
K 4
tags
V 19
dir 2.0.r31807/7857
K 5
trunk
V 22
dir 3.5ck.r31848/51681
K 7
website
V 21
dir 3ge.0.r31809/1913
END
ENDREP
id: 0.0.r31849/15311
type: dir
pred: 0.0.r31848/52072
count: 31849
text: 31849 15144 154 0 88cc0182b270558152895f1b0e7f6668
cpath: /
copyroot: 0 /

2ml.5qi.t31848-1 modify true false /branches/S2_6/server/generator/mapgen_topology.c


15311 15459
