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.5ck.r31846/7801
type: file
pred: 2ml.5ck.r31001/28077
count: 32
text: 31846 0 7773 13908 32e775f37e8eef63d04321a31b535d5e
props: 9904 3275 110 0 705660468cdcbf270377dea86b274451
cpath: /trunk/server/generator/mapgen_topology.c
copyroot: 15280 /trunk

PLAIN
K 11
Makefile.am
V 25
file 2mf.5ck.r27705/60528
K 12
height_map.c
V 25
file 2mj.5ck.r30221/69898
K 12
height_map.h
V 26
file 2mk.5bk.r13949/117031
K 8
mapgen.c
V 25
file 2mg.5ck.r31533/28678
K 8
mapgen.h
V 25
file 2mh.5ck.r19265/30017
K 17
mapgen_topology.c
V 24
file 2ml.5ck.r31846/7801
K 17
mapgen_topology.h
V 25
file 2mm.5ck.r30221/70677
K 10
startpos.c
V 25
file 2mt.5ck.r30221/70938
K 10
startpos.h
V 24
file 2mu.5ck.r18296/4932
K 17
temperature_map.c
V 25
file 2mn.5ck.r30221/71194
K 17
temperature_map.h
V 25
file 2mo.5ck.r20375/12210
K 11
utilities.c
V 25
file 2mp.5ck.r30221/71454
K 11
utilities.h
V 24
file 2mq.5ck.r28863/1091
END
ENDREP
id: 2me.5ck.r31846/8715
type: dir
pred: 2me.5ck.r31533/29587
count: 200
text: 31846 8060 642 0 a464a2c87516297fd773a070474556ea
props: 11108 4081 68 0 445aae39c72ff2e5199436fb06040160
cpath: /trunk/server/generator
copyroot: 15280 /trunk

PLAIN
K 11
Makefile.am
V 23
file 5q.5ck.r31395/7318
K 13
actiontools.c
V 25
file 1p83.5ck.r31161/6148
K 13
actiontools.h
V 26
file 1p86.5ck.r30751/20576
K 8
advisors
V 24
dir 4n2.5ck.r31525/42325
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.5ck.r31065/7891
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.5ck.r30874/23837
K 11
barbarian.h
V 23
file lx.5ck.r28605/1460
K 14
citizenshand.c
V 25
file 6mz.5ck.r29645/54068
K 14
citizenshand.h
V 25
file 6n0.5ck.r26905/56662
K 10
cityhand.c
V 23
file 10.5ck.r31341/9613
K 10
cityhand.h
V 23
file 4f.0.r13297/423686
K 11
citytools.c
V 24
file 4g.5ck.r31250/44250
K 11
citytools.h
V 24
file 4h.5ck.r29273/23520
K 10
cityturn.c
V 24
file 4i.5ck.r31794/18708
K 10
cityturn.h
V 23
file 4j.5ck.r31247/3607
K 11
civserver.c
V 24
file 4k.5ck.r31685/12452
K 10
commands.c
V 25
file 2ly.5ck.r30812/39680
K 10
commands.h
V 25
file 2lz.5ck.r28012/47664
K 13
connecthand.c
V 25
file 2dw.5ck.r31663/31033
K 13
connecthand.h
V 24
file 2dx.5ck.r23606/2057
K 9
console.c
V 23
file dd.5ck.r31822/8631
K 9
console.h
V 23
file de.5ck.r31514/8658
K 10
diplhand.c
V 22
file 4m.5ck.r31332/500
K 10
diplhand.h
V 23
file 4n.5ck.r27517/8916
K 11
diplomats.c
V 24
file vz.5ck.r31250/44737
K 11
diplomats.h
V 23
file w0.5ck.r29361/9281
K 10
edithand.c
V 25
file 3bk.5ck.r31792/35781
K 10
edithand.h
V 25
file 4ez.5ck.r26905/64705
K 6
fcdb.c
V 23
file 6l3.5ck.r30952/119
K 6
fcdb.h
V 25
file 6l4.5ck.r26905/57239
K 10
gamehand.c
V 22
file 4o.5ck.r30550/551
K 10
gamehand.h
V 24
file 4p.5ck.r26564/23149
K 9
generator
V 23
dir 2me.5ck.r31846/8715
K 10
handchat.c
V 23
file 4q.5ck.r25915/6654
K 10
handchat.h
V 24
file dj.5ck.r18270/28229
K 12
legacysave.c
V 24
file vl.5tv.r31794/18948
K 12
legacysave.h
V 23
file vm.5tw.r30931/2151
K 9
maphand.c
V 23
file 13.5ck.r31136/2535
K 9
maphand.h
V 23
file 14.5ck.r31136/2778
K 6
meta.c
V 24
file 4s.5ck.r31685/12692
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.5ck.r31785/854
K 8
notify.h
V 25
file 4i3.5ck.r31370/14432
K 9
plrhand.c
V 24
file 4u.5ck.r31792/36028
K 9
plrhand.h
V 24
file 4v.5ck.r31792/36273
K 8
report.c
V 24
file vi.5ck.r30328/90100
K 8
report.h
V 23
file vj.5ck.r29899/8035
K 10
rscompat.c
V 23
file 1kte.5ck.r31612/71
K 10
rscompat.h
V 25
file 1ktg.5ck.r31576/1878
K 10
rssanity.c
V 25
file hew.5ck.r31633/27344
K 10
rssanity.h
V 24
file hey.5ck.r31144/1251
K 9
ruleset.c
V 25
file 8w.5ck.r31630/119205
K 9
ruleset.h
V 23
file 8x.5ck.r31448/1338
K 13
sanitycheck.c
V 22
file wi.5ck.r30957/384
K 13
sanitycheck.h
V 24
file wj.5ck.r28075/17176
K 12
savecompat.c
V 25
file qva.5ck.r31794/19214
K 12
savecompat.h
V 24
file qvc.5ck.r30202/8414
K 10
savegame.c
V 26
file 28ln.5ck.r31444/17489
K 10
savegame.h
V 25
file 4m1.5tx.r31444/17678
K 11
savegame2.c
V 25
file 4m0.5ck.r31682/14280
K 11
savegame2.h
V 24
file 4m1.5ck.r31395/8224
K 11
savegame3.c
V 25
file 4m0.5ql.r31682/14527
K 11
savegame3.h
V 25
file 25ch.5ck.r31395/8732
K 7
score.c
V 25
file 2eg.5ck.r29645/57467
K 7
score.h
V 24
file 2eh.5ck.r21929/6179
K 9
scripting
V 24
dir 31x.5ck.r31794/20777
K 8
sernet.c
V 23
file 15.5ck.r31822/8871
K 8
sernet.h
V 23
file 4y.5ck.r23685/5129
K 10
settings.c
V 25
file 2m0.5ck.r31794/21017
K 10
settings.h
V 23
file 2m1.5ck.r29779/937
K 11
spacerace.c
V 23
file 9a.5ck.r31476/5877
K 11
spacerace.h
V 23
file 9b.5ck.r31476/6121
K 9
srv_log.c
V 25
file 15t.5el.r28853/27603
K 9
srv_log.h
V 25
file 15u.5em.r28012/47157
K 10
srv_main.c
V 24
file vg.5ck.r31794/21266
K 10
srv_main.h
V 23
file vh.5ck.r31620/2345
K 11
stdinhand.c
V 23
file 4z.5ck.r31822/9111
K 11
stdinhand.h
V 23
file 50.5ck.r31822/9356
K 11
techtools.c
V 23
file 33n.5ck.r31623/100
K 11
techtools.h
V 23
file 33o.5ck.r31623/343
K 10
unithand.c
V 23
file 18.5ck.r31838/9562
K 10
unithand.h
V 24
file 19.5ck.r31341/10100
K 11
unittools.c
V 22
file 1a.5ck.r31840/104
K 11
unittools.h
V 23
file 1b.5ck.r31164/5815
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.5ck.r31846/13193
type: dir
pred: z.5ck.r31840/4585
count: 6441
text: 31846 8954 4226 0 527fc1665d5eedec3a3b04d3dc6f06f9
props: 23990 448 166 0 e5026e1cb18fe57b41417951bfac7b19
cpath: /trunk/server
copyroot: 15280 /trunk

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5ck.r31532/74309
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.r31275/938
K 11
Makefile.am
V 23
file 59.5ck.r31811/2614
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.r31824/2853
K 10
autogen.sh
V 23
file 12o.5ck.r31650/192
K 9
bootstrap
V 24
dir 2p5.5ck.r31532/76576
K 6
client
V 21
dir d.5ck.r31838/9334
K 6
common
V 21
dir p.5ck.r31837/6121
K 12
configure.ac
V 23
file 149.5ck.r31783/216
K 4
data
V 21
dir w.5ck.r31841/5822
K 12
dependencies
V 23
dir 2yu.5ck.r31822/5233
K 3
doc
V 22
dir k7.5ck.r31801/2955
K 10
fc_version
V 25
file 2lo.5en.r31792/35536
K 11
gen_headers
V 24
dir 1hsw.5ck.r31822/5785
K 2
m4
V 23
dir 12p.5ck.r31822/8409
K 7
scripts
V 23
dir 2yo.5ck.r31448/1168
K 6
server
V 22
dir z.5ck.r31846/13193
K 5
tests
V 22
dir 2g9.5ck.r31520/584
K 5
tools
V 24
dir 4pj.5js.r31830/15124
K 12
translations
V 23
dir t0a.5ck.r31743/7474
K 7
utility
V 23
dir 1c.5ck.r31828/33856
K 5
win32
V 23
dir 2eu.5ck.r31827/6273
END
ENDREP
id: 3.5ck.r31846/14550
type: dir
pred: 3.5ck.r31841/7178
count: 20874
text: 31846 13420 1117 0 7859be8d98d62811be3814ff52b25230
props: 28036 14655 292 0 9e1d5de0253c723466868990c52c129f
cpath: /trunk
copyroot: 15280 /trunk

PLAIN
K 8
branches
V 19
dir 1.0.r31845/7099
K 4
tags
V 19
dir 2.0.r31807/7857
K 5
trunk
V 22
dir 3.5ck.r31846/14550
K 7
website
V 21
dir 3ge.0.r31809/1913
END
ENDREP
id: 0.0.r31846/14940
type: dir
pred: 0.0.r31845/7417
count: 31846
text: 31846 14774 153 0 5c7d1be900643eec001223544c00daa9
cpath: /
copyroot: 0 /

2ml.5ck.t31845-1 modify true false /trunk/server/generator/mapgen_topology.c


14940 15087
