Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2002:
[Freeciv-Dev] Re: File save format: rivers?
Home

[Freeciv-Dev] Re: File save format: rivers?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Miguel Farah <miguel@xxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: File save format: rivers?
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Sun, 2 Jun 2002 10:29:57 +0200

On Sun, Jun 02, 2002 at 01:32:13AM -0400, Miguel Farah wrote:
> I've finally got off my lazy ass to do the modifications my map2gif
> script requires to properly handle the rivers in V2 maps. I looked into
> saved files, and I found that the rivers are designated by a '2' in the
> n0?? lines. Looking a bit more, I noticed that the possible values
> indicated:
> 
> 0: regular terrain
> 1: special 2 (oil, whale, fruit, etc.)
> 2: river
> 3: special 2 + river
> 4: as 0 + farmland
> 5: as 1 + farmland
> 6: as 2 + farmland
> 7: as 3 + farmland
> 8: as 0 + airbase
> 9: as 1 + airbase
> 
> So, what would '10' (river + airbase) upto '15' (all the goodies) be
> written as in the .sav? Where is special 1? What I really need is to
> know that the "bit 2" is indeed what indicates if a river is present in
> a given square. Am I right?

  SAVE_NORMAL_MAP_DATA(file, bin2ascii_hex(map_get_tile(x, y)->special, 0),
                       "map.l%03d");
  SAVE_NORMAL_MAP_DATA(file, bin2ascii_hex(map_get_tile(x, y)->special, 1),
                       "map.u%03d");
  SAVE_NORMAL_MAP_DATA(file, bin2ascii_hex(map_get_tile(x, y)->special, 2),
                       "map.n%03d");
  SAVE_NORMAL_MAP_DATA(file, bin2ascii_hex(map_get_tile(x, y)->special, 3),
                       "map.f%03d");

enum tile_special_type is divided into groups of 4 values:

  S_SPECIAL_1  =    1,
  S_ROAD       =    2,    map.l
  S_IRRIGATION =    4,
  S_RAILROAD   =    8,

  S_MINE       =   16,
  S_POLLUTION  =   32,    map.u
  S_HUT        =   64,
  S_FORTRESS   =  128,

  S_SPECIAL_2  =  256,
  S_RIVER      =  512,    map.n
  S_FARMLAND   = 1024,
  S_AIRBASE    = 2048,

  S_FALLOUT    = 4096     map.f

While the values for map.u, map.n and map.f are divided by 16, 256 and
4096.

So S_SPECIAL_1 is set if the number of map.l is odd.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Make it idiot-proof and someone will make a better idiot."


[Prev in Thread] Current Thread [Next in Thread]