Campeche's old city walls protected it from pirates in the 17th and 18th centuries.