Cleanup: Make ChunkOrderHotspot a struct

This commit is contained in:
Jeroen Bakker
2021-02-17 15:00:04 +01:00
parent 8bca03056c
commit ef53859d24
3 changed files with 17 additions and 18 deletions

View File

@@ -29,13 +29,12 @@ ChunkOrder::ChunkOrder()
void ChunkOrder::update_distance(ChunkOrderHotspot **hotspots, unsigned int len_hotspots)
{
unsigned int index;
double new_distance = FLT_MAX;
for (index = 0; index < len_hotspots; index++) {
for (int index = 0; index < len_hotspots; index++) {
ChunkOrderHotspot *hotspot = hotspots[index];
double ndistance = hotspot->determineDistance(x, y);
if (ndistance < new_distance) {
new_distance = ndistance;
double distance_to_hotspot = hotspot->calc_distance(x, y);
if (distance_to_hotspot < new_distance) {
new_distance = distance_to_hotspot;
}
}
this->distance = new_distance;