Skip to content

Commit

Permalink
perf(memory): Don't even create the data classes for intermediates :)
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Oct 29, 2024
1 parent cbbec40 commit 65b96d1
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,9 @@ object NextTurnAutomation {

for (civ1city in civ1.cities)
for (civ2city in civ2.cities){
val currentDistance = CityDistance(civ1city, civ2city,
civ1city.getCenterTile().aerialDistanceTo(civ2city.getCenterTile()))
if (minDistance == null || currentDistance.aerialDistance < minDistance.aerialDistance)
minDistance = currentDistance
val currentDistance = civ1city.getCenterTile().aerialDistanceTo(civ2city.getCenterTile())
if (minDistance == null || currentDistance < minDistance.aerialDistance)
minDistance = CityDistance(civ1city, civ2city, currentDistance)
}

return minDistance
Expand Down

0 comments on commit 65b96d1

Please sign in to comment.