&#x27;Smoking ban and staff shortage led to Wiltshire prison riot&#x27;, court told