Loading

Paste #pwp2v1qoc

  1.     function removeUsedCityPair(fromCity, toCity) {
  2.         for (local i = m_nearCityPairArray.len() - 1 ; i >= 0; --i) {
  3.             if (m_nearCityPairArray[i].isEqual(fromCity, toCity)) {
  4.                 m_nearCityPairArray.remove(i);
  5.             }
  6.         }
  7.        
  8.         local removeList = AIList();
  9.         for (local u = m_usedCities.Begin(); m_usedCities.HasNext(); m_usedCities.Next()) {
  10.             local removeTown = true;
  11.             for (local i = 0; i < m_nearCityPairArray.len(); ++i) {
  12.                 if (u == m_nearCityPairArray[i].m_cityFrom || u == m_nearCityPairArray[i].m_cityTo) {
  13.                     removeTown = false;
  14.                 }
  15.             }
  16.             if (removeTown) {
  17.                 AILog.Info("Town " + AITown.GetName(u) + " is being removed (removeUsedCityPair)");
  18.                 removeTown.AddItem(u);
  19.             }
  20.         }
  21.        
  22.         m_usedCities.RemoveList(removeList);
  23.     }

Comments