Codechange: Use range-for iteration.
This commit is contained in:
@@ -51,8 +51,8 @@ void FlowMapper::Run(LinkGraphJob &job) const
|
||||
* division by 0 if spawn date == last compression date. This matches
|
||||
* LinkGraph::Monthly(). */
|
||||
uint runtime = job.JoinDate() - job.Settings().recalc_time - job.LastCompression() + 1;
|
||||
for (FlowStatMap::iterator i = flows.begin(); i != flows.end(); ++i) {
|
||||
i->second.ScaleToMonthly(runtime);
|
||||
for (auto &it : flows) {
|
||||
it.second.ScaleToMonthly(runtime);
|
||||
}
|
||||
}
|
||||
/* Clear paths. */
|
||||
|
@@ -273,14 +273,14 @@ void LinkGraphOverlay::Draw(const DrawPixelInfo *dpi)
|
||||
void LinkGraphOverlay::DrawLinks(const DrawPixelInfo *dpi) const
|
||||
{
|
||||
int width = ScaleGUITrad(this->scale);
|
||||
for (LinkMap::const_iterator i(this->cached_links.begin()); i != this->cached_links.end(); ++i) {
|
||||
if (!Station::IsValidID(i->first)) continue;
|
||||
Point pta = this->GetStationMiddle(Station::Get(i->first));
|
||||
for (StationLinkMap::const_iterator j(i->second.begin()); j != i->second.end(); ++j) {
|
||||
if (!Station::IsValidID(j->first)) continue;
|
||||
Point ptb = this->GetStationMiddle(Station::Get(j->first));
|
||||
for (const auto &i : this->cached_links) {
|
||||
if (!Station::IsValidID(i.first)) continue;
|
||||
Point pta = this->GetStationMiddle(Station::Get(i.first));
|
||||
for (const auto &j : i.second) {
|
||||
if (!Station::IsValidID(j.first)) continue;
|
||||
Point ptb = this->GetStationMiddle(Station::Get(j.first));
|
||||
if (!this->IsLinkVisible(pta, ptb, dpi, width + 2)) continue;
|
||||
this->DrawContent(pta, ptb, j->second);
|
||||
this->DrawContent(pta, ptb, j.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,13 +319,13 @@ void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &c
|
||||
void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const
|
||||
{
|
||||
int width = ScaleGUITrad(this->scale);
|
||||
for (StationSupplyList::const_iterator i(this->cached_stations.begin()); i != this->cached_stations.end(); ++i) {
|
||||
const Station *st = Station::GetIfValid(i->first);
|
||||
for (const auto &i : this->cached_stations) {
|
||||
const Station *st = Station::GetIfValid(i.first);
|
||||
if (st == nullptr) continue;
|
||||
Point pt = this->GetStationMiddle(st);
|
||||
if (!this->IsPointVisible(pt, dpi, 3 * width)) continue;
|
||||
|
||||
uint r = width * 2 + width * 2 * std::min(200U, i->second) / 200;
|
||||
uint r = width * 2 + width * 2 * std::min(200U, i.second) / 200;
|
||||
|
||||
LinkGraphOverlay::DrawVertex(pt.x, pt.y, r,
|
||||
_colour_gradient[st->owner != OWNER_NONE ?
|
||||
|
@@ -110,8 +110,8 @@ void LinkGraphSchedule::JoinNext()
|
||||
*/
|
||||
void LinkGraphSchedule::SpawnAll()
|
||||
{
|
||||
for (JobList::iterator i = this->running.begin(); i != this->running.end(); ++i) {
|
||||
(*i)->SpawnThread();
|
||||
for (auto &it : this->running) {
|
||||
it->SpawnThread();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@ void LinkGraphSchedule::SpawnAll()
|
||||
*/
|
||||
/* static */ void LinkGraphSchedule::Clear()
|
||||
{
|
||||
for (JobList::iterator i(instance.running.begin()); i != instance.running.end(); ++i) {
|
||||
(*i)->AbortJob();
|
||||
for (auto &it : instance.running) {
|
||||
it->AbortJob();
|
||||
}
|
||||
instance.running.clear();
|
||||
instance.schedule.clear();
|
||||
|
@@ -144,10 +144,10 @@ bool LinkRefresher::HandleRefit(CargoID refit_cargo)
|
||||
*/
|
||||
void LinkRefresher::ResetRefit()
|
||||
{
|
||||
for (RefitList::iterator it(this->refit_capacities.begin()); it != this->refit_capacities.end(); ++it) {
|
||||
if (it->remaining == it->capacity) continue;
|
||||
this->capacities[it->cargo] += it->capacity - it->remaining;
|
||||
it->remaining = it->capacity;
|
||||
for (auto &it : this->refit_capacities) {
|
||||
if (it.remaining == it.capacity) continue;
|
||||
this->capacities[it.cargo] += it.capacity - it.remaining;
|
||||
it.remaining = it.capacity;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user