summaryrefslogtreecommitdiff
path: root/src/linkgraph
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2018-05-21 22:08:39 +0100
committerGitHub <noreply@github.com>2018-05-21 22:08:39 +0100
commit4cebebcf683b079ff010e70b0a0a78c12734933e (patch)
tree4f140272bd8c1efba4916a642b85a22f153cb7b4 /src/linkgraph
parent42b43c998314a3fcd89aa59ad7834104dd80b053 (diff)
downloadopenttd-4cebebcf683b079ff010e70b0a0a78c12734933e.tar.xz
Change: Add CargoTypes type for cargo masks. (#6790)
Diffstat (limited to 'src/linkgraph')
-rw-r--r--src/linkgraph/linkgraph_gui.cpp6
-rw-r--r--src/linkgraph/linkgraph_gui.h8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp
index 1fe34fe79..015dc52ff 100644
--- a/src/linkgraph/linkgraph_gui.cpp
+++ b/src/linkgraph/linkgraph_gui.cpp
@@ -298,7 +298,7 @@ Point LinkGraphOverlay::GetStationMiddle(const Station *st) const
* Set a new cargo mask and rebuild the cache.
* @param cargo_mask New cargo mask.
*/
-void LinkGraphOverlay::SetCargoMask(uint32 cargo_mask)
+void LinkGraphOverlay::SetCargoMask(CargoTypes cargo_mask)
{
this->cargo_mask = cargo_mask;
this->RebuildCache();
@@ -435,7 +435,7 @@ void LinkGraphLegendWindow::SetOverlay(LinkGraphOverlay *overlay) {
this->SetWidgetLoweredState(WID_LGL_COMPANY_FIRST + c, HasBit(companies, c));
}
}
- uint32 cargoes = this->overlay->GetCargoMask();
+ CargoTypes cargoes = this->overlay->GetCargoMask();
for (uint c = 0; c < NUM_CARGO; c++) {
if (!this->IsWidgetDisabled(WID_LGL_CARGO_FIRST + c)) {
this->SetWidgetLoweredState(WID_LGL_CARGO_FIRST + c, HasBit(cargoes, c));
@@ -519,7 +519,7 @@ void LinkGraphLegendWindow::UpdateOverlayCompanies()
*/
void LinkGraphLegendWindow::UpdateOverlayCargoes()
{
- uint32 mask = 0;
+ CargoTypes mask = 0;
for (uint c = 0; c < NUM_CARGO; c++) {
if (this->IsWidgetDisabled(c + WID_LGL_CARGO_FIRST)) continue;
if (!this->IsWidgetLowered(c + WID_LGL_CARGO_FIRST)) continue;
diff --git a/src/linkgraph/linkgraph_gui.h b/src/linkgraph/linkgraph_gui.h
index a9be8254d..12f1f6e73 100644
--- a/src/linkgraph/linkgraph_gui.h
+++ b/src/linkgraph/linkgraph_gui.h
@@ -51,17 +51,17 @@ public:
* @param company_mask Bitmask of companies to be shown.
* @param scale Desired thickness of lines and size of station dots.
*/
- LinkGraphOverlay(const Window *w, uint wid, uint32 cargo_mask, uint32 company_mask, uint scale) :
+ LinkGraphOverlay(const Window *w, uint wid, CargoTypes cargo_mask, uint32 company_mask, uint scale) :
window(w), widget_id(wid), cargo_mask(cargo_mask), company_mask(company_mask), scale(scale)
{}
void RebuildCache();
void Draw(const DrawPixelInfo *dpi) const;
- void SetCargoMask(uint32 cargo_mask);
+ void SetCargoMask(CargoTypes cargo_mask);
void SetCompanyMask(uint32 company_mask);
/** Get a bitmask of the currently shown cargoes. */
- uint32 GetCargoMask() { return this->cargo_mask; }
+ CargoTypes GetCargoMask() { return this->cargo_mask; }
/** Get a bitmask of the currently shown companies. */
uint32 GetCompanyMask() { return this->company_mask; }
@@ -69,7 +69,7 @@ public:
protected:
const Window *window; ///< Window to be drawn into.
const uint widget_id; ///< ID of Widget in Window to be drawn to.
- uint32 cargo_mask; ///< Bitmask of cargos to be displayed.
+ CargoTypes cargo_mask; ///< Bitmask of cargos to be displayed.
uint32 company_mask; ///< Bitmask of companies to be displayed.
LinkMap cached_links; ///< Cache for links to reduce recalculation.
StationSupplyList cached_stations; ///< Cache for stations to be drawn.