3 /** @file overlay_cmd.cpp Handling of overlays. */
9 #include "station_func.h"
10 #include "viewport_func.h"
11 #include "overlay_cmd.h"
13 Overlays
* Overlays::instance
= NULL
;
15 Overlays
* Overlays::Instance()
18 instance
= new Overlays();
22 void Overlays::AddStation(const Station
* st
)
24 this->catchmentOverlay
.insert(st
);
27 void Overlays::RemoveStation(const Station
* st
)
29 this->catchmentOverlay
.erase(st
);
32 void Overlays::ToggleStation(const Station
* st
)
34 if(this->HasStation(st
)) {
35 this->RemoveStation(st
);
41 void Overlays::Clear()
43 this->catchmentOverlay
.clear();
46 bool Overlays::IsTileInCatchmentArea(const TileInfo
* ti
, CatchmentType type
)
48 for(std::set
<const Station
*>::iterator iter
= catchmentOverlay
.begin();iter
!= catchmentOverlay
.end();) {
49 const Station
*st
= *iter
;
50 if( st
->IsTileInCatchmentArea(ti
, type
))
57 bool Overlays::HasStation(const Station
* st
)
59 return (this->catchmentOverlay
.find(st
) != this->catchmentOverlay
.end());
64 this->catchmentOverlay
.clear();