A colony of UAVs flying in formation within crowded environments needs to decide upon changes of the formation in order to adapt to sudden emergence of new high impact environmental features. Besides usual tasks like area coverage, exploration and collective transportation, an alert formation control is needed to adapt to the new features with little latencies. This approach is constructed upon an existing method which is based on constrained optimization and multi-robot consensus to compute formation parameters. We equipped that formation control method with the swift novel ability of splitting and merging to reconstruct the formation when necessary disruption is carried out in the adaptation to environmental features. In this approach, robots first decide on a direction to move collectively, and then they approximate obstacle-free convex regions to find a volume that formation can be fitted into, directed towards the decided direction. Then, using the intersection of these regions and constraints coming from the required shape, an optimization is carried out in order to find formation parameters that are suitable to environmental conditions. After deciding on formation parameters, target positions are assigned to robots with the aim of minimizing the mission completion time. The system is validated through simulations in Microsoft AirSim environment.