public static List <TileID> CreateList(TerrainID t0, TerrainID t1, TerrainID t2, TerrainID t3) { List <TileID> list = new List <TileID>(); TileID tt0 = new TileID(t0, 1); TileID tt1 = new TileID(t1, 2); TileID tt2 = new TileID(t2, 4); TileID tt3 = new TileID(t3, 8); bool added; list.Add(tt0); added = false; foreach (var item in list) { if (item.Add(tt1)) { added = true; } } if (!added) { list.Add(tt1); } added = false; foreach (var item in list) { if (item.Add(tt2)) { added = true; } } if (!added) { list.Add(tt2); } added = false; foreach (var item in list) { if (item.Add(tt3)) { added = true; } } if (!added) { list.Add(tt3); } return(list); }