/** * Set the house type. * @param t the tile * @param house_id the new house type * @pre TileMap.IsTileType(t, TileType.MP_HOUSE) */ public static void SetHouseType(this TileIndex t, HouseID house_id) { Debug.Assert(TileMap.IsTileType(t, TileType.MP_HOUSE)); Map._m[t].m4 = BitMath.GB(house_id, 0, 8); Map._m[t].m3 = BitMath.SB(Map._m[t].m3, 6, 1, BitMath.GB(house_id, 8, 1)); }
/** * Make the tile a house. * @param t tile index * @param tid Town index * @param counter of construction step * @param stage of construction (used for drawing) * @param type of house. Index into house specs array * @param random_bits required for newgrf houses * @pre TileMap.IsTileType(t, MP_CLEAR) */ public static void MakeHouseTile(this TileIndex t, ushort tid, byte counter, byte stage, HouseID type, byte random_bits) { Debug.Assert(TileMap.IsTileType(t, TileType.MP_CLEAR)); TileMap.SetTileType(t, TileType.MP_HOUSE); Map._m[t].m1 = random_bits; Map._m[t].m2 = tid; Map._m[t].m3 = 0; SetHouseType(t, type); SetHouseCompleted(t, stage == TOWN_HOUSE_COMPLETED); Map._m[t].m5 = IsHouseCompleted(t) ? 0 : (stage << 3 | counter); SetAnimationFrame(t, 0); SetHouseProcessingTime(t, HouseSpec.Get(type).processing_time); }