# HG changeset patch # User rubidium # Date 2011-11-04 06:05:11 # Node ID 0adacaa8f4f21fe92502fcd3552c505c16c6cdca # Parent cf295a72fdc8480625dd3d66882169dd012a0aa7 (svn r23090) -Codechange: use map accessors instead of directly accessing the map (mhl) diff --git a/src/landscape.cpp b/src/landscape.cpp --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -813,16 +813,16 @@ static void GenerateTerrain(int type, ui if (x + w >= MapMaxX() - 1) return; if (y + h >= MapMaxY() - 1) return; - Tile *tile = &_m[TileXY(x, y)]; + TileIndex tile = TileXY(x, y); switch (direction) { default: NOT_REACHED(); case DIAGDIR_NE: do { - Tile *tile_cur = tile; + TileIndex tile_cur = tile; for (uint w_cur = w; w_cur != 0; --w_cur) { - if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4); + if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4)); p++; tile_cur++; } @@ -832,10 +832,10 @@ static void GenerateTerrain(int type, ui case DIAGDIR_SE: do { - Tile *tile_cur = tile; + TileIndex tile_cur = tile; for (uint h_cur = h; h_cur != 0; --h_cur) { - if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4); + if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4)); p++; tile_cur += TileDiffXY(0, 1); } @@ -846,10 +846,10 @@ static void GenerateTerrain(int type, ui case DIAGDIR_SW: tile += TileDiffXY(w - 1, 0); do { - Tile *tile_cur = tile; + TileIndex tile_cur = tile; for (uint w_cur = w; w_cur != 0; --w_cur) { - if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4); + if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4)); p++; tile_cur--; } @@ -860,10 +860,10 @@ static void GenerateTerrain(int type, ui case DIAGDIR_NW: tile += TileDiffXY(0, h - 1); do { - Tile *tile_cur = tile; + TileIndex tile_cur = tile; for (uint h_cur = h; h_cur != 0; --h_cur) { - if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4); + if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4)); p++; tile_cur -= TileDiffXY(0, 1); }