Comment 1 for bug 1205901

Revision history for this message
cghislai (charlyghislain) wrote :

yes that var is useless. The block could be replaced by
 // iterate through all buildings to find first predecessor
 const Tribe_Descr & t = b.descr().tribe();
 while (true) {
  const Building_Descr * oldest = b.m_old_buildings.front();
  if (!oldest->is_enhanced()) {
   break;
  }
  const Building_Index & oldest_idx = t.building_index(oldest->name());
  for (Building_Index i = Building_Index::First(); i < t.get_nrbuildings(); ++i) {
   Building_Descr const * ob = t.get_building_descr(i);
   if (ob->enhancements().count(oldest_idx)) {
    b.m_old_buildings.insert(b.m_old_buildings.begin(), ob);
    break;
   }
  }
 }
}