summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
authordP <dp@dpointer.org>2020-05-12 01:36:28 +0300
committerCharles Pigott <charlespigott@googlemail.com>2020-05-13 08:43:01 +0100
commit7bd52970a1e83cb88069e73e26479eb71bd17726 (patch)
tree88e6fca4b38b16333dd6f37c7fde50fd4464596d /src/station.cpp
parent2d5869fc79a1f1f347ab31665148c806d54afcd9 (diff)
downloadopenttd-7bd52970a1e83cb88069e73e26479eb71bd17726.tar.xz
Codechange: Refactor FindStationsAroundTiles to avoid code duplication
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/station.cpp b/src/station.cpp
index 61c53bc56..ec332e0bb 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -359,12 +359,11 @@ Rect Station::GetCatchmentRect() const
/**
* Add nearby industry to station's industries_near list if it accepts cargo.
* @param ind Industry
- * @param st Station
*/
-static void AddIndustryToDeliver(Industry *ind, Station *st)
+void Station::AddIndustryToDeliver(Industry *ind)
{
/* Don't check further if this industry is already in the list */
- if (st->industries_near.find(ind) != st->industries_near.end()) return;
+ if (this->industries_near.find(ind) != this->industries_near.end()) return;
/* Include only industries that can accept cargo */
uint cargo_index;
@@ -373,7 +372,7 @@ static void AddIndustryToDeliver(Industry *ind, Station *st)
}
if (cargo_index >= lengthof(ind->accepts_cargo)) return;
- st->industries_near.insert(ind);
+ this->industries_near.insert(ind);
}
/**
@@ -464,7 +463,7 @@ void Station::RecomputeCatchment()
i->stations_near.insert(this);
/* Add if we can deliver to this industry as well */
- AddIndustryToDeliver(i, this);
+ this->AddIndustryToDeliver(i);
}
}
}