/** * Make a tree-tile. * * This functions change the tile to a tile with trees and all informations which belongs to it. * * @param t The tile to make a tree-tile from * @param type The type of the tree * @param count the number of trees * @param growth the growth status * @param ground the ground type * @param density the density (not the number of trees) */ public static void MakeTree(TileIndex t, TreeType type, uint count, uint growth, TreeGround ground, uint density) { TileMap.SetTileType(t, TileType.MP_TREES); TileMap.SetTileOwner(t, Owner.OWNER_NONE); Map._m[t].m2 = (ushort)(ground << 6 | density << 4 | 0); Map._m[t].m3 = (byte)type; Map._m[t].m4 = 0 << 5 | 0 << 2; Map._m[t].m5 = (byte)(count << 6 | growth); BitMath.SB(Map._me[t].m6, 2, 4, 0); Map._me[t].m7 = 0; }
/** * Set the density and ground type of a tile with trees. * * This functions saves the ground type and the density which belongs to it * for a given tile. * * @param t The tile to set the density and ground type * @param g The ground type to save * @param d The density to save with * @pre Tile must be of type TileType.MP_TREES) */ public static void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d) { Debug.Assert(TileMap.IsTileType(t, TileType.MP_TREES)); // XXX incomplete Map._m[t].m2 = BitMath.SB(Map._m[t].m2, 4, 2, d); Map._m[t].m2 = BitMath.SB(Map._m[t].m2, 6, 3, g); }