OpenTTD Source  12.0-beta2
linkgraph_gui.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #include "../stdafx.h"
11 #include "../window_gui.h"
12 #include "../window_func.h"
13 #include "../company_base.h"
14 #include "../company_gui.h"
15 #include "../date_func.h"
16 #include "../viewport_func.h"
17 #include "../smallmap_gui.h"
18 #include "../core/geometry_func.hpp"
19 #include "../widgets/link_graph_legend_widget.h"
20 
21 #include "table/strings.h"
22 
23 #include "../safeguards.h"
24 
29 const uint8 LinkGraphOverlay::LINK_COLOURS[] = {
30  0x0f, 0xd1, 0xd0, 0x57,
31  0x55, 0x53, 0xbf, 0xbd,
32  0xba, 0xb9, 0xb7, 0xb5
33 };
34 
40 {
41  const NWidgetBase *wi = this->window->GetWidget<NWidgetBase>(this->widget_id);
42  dpi->left = dpi->top = 0;
43  dpi->width = wi->current_x;
44  dpi->height = wi->current_y;
45 }
46 
51 {
52  this->cached_links.clear();
53  this->cached_stations.clear();
54  if (this->company_mask == 0) return;
55 
56  DrawPixelInfo dpi;
57  this->GetWidgetDpi(&dpi);
58 
59  for (const Station *sta : Station::Iterate()) {
60  if (sta->rect.IsEmpty()) continue;
61 
62  Point pta = this->GetStationMiddle(sta);
63 
64  StationID from = sta->index;
65  StationLinkMap &seen_links = this->cached_links[from];
66 
67  uint supply = 0;
68  for (CargoID c : SetCargoBitIterator(this->cargo_mask)) {
69  if (!CargoSpec::Get(c)->IsValid()) continue;
70  if (!LinkGraph::IsValidID(sta->goods[c].link_graph)) continue;
71  const LinkGraph &lg = *LinkGraph::Get(sta->goods[c].link_graph);
72 
73  ConstNode from_node = lg[sta->goods[c].node];
74  supply += lg.Monthly(from_node.Supply());
75  for (ConstEdgeIterator i = from_node.Begin(); i != from_node.End(); ++i) {
76  StationID to = lg[i->first].Station();
77  assert(from != to);
78  if (!Station::IsValidID(to) || seen_links.find(to) != seen_links.end()) {
79  continue;
80  }
81  const Station *stb = Station::Get(to);
82  assert(sta != stb);
83 
84  /* Show links between stations of selected companies or "neutral" ones like oilrigs. */
85  if (stb->owner != OWNER_NONE && sta->owner != OWNER_NONE && !HasBit(this->company_mask, stb->owner)) continue;
86  if (stb->rect.IsEmpty()) continue;
87 
88  if (!this->IsLinkVisible(pta, this->GetStationMiddle(stb), &dpi)) continue;
89 
90  this->AddLinks(sta, stb);
91  seen_links[to]; // make sure it is created and marked as seen
92  }
93  }
94  if (this->IsPointVisible(pta, &dpi)) {
95  this->cached_stations.push_back(std::make_pair(from, supply));
96  }
97  }
98 }
99 
107 inline bool LinkGraphOverlay::IsPointVisible(Point pt, const DrawPixelInfo *dpi, int padding) const
108 {
109  return pt.x > dpi->left - padding && pt.y > dpi->top - padding &&
110  pt.x < dpi->left + dpi->width + padding &&
111  pt.y < dpi->top + dpi->height + padding;
112 }
113 
122 inline bool LinkGraphOverlay::IsLinkVisible(Point pta, Point ptb, const DrawPixelInfo *dpi, int padding) const
123 {
124  const int left = dpi->left - padding;
125  const int right = dpi->left + dpi->width + padding;
126  const int top = dpi->top - padding;
127  const int bottom = dpi->top + dpi->height + padding;
128 
129  /*
130  * This method is an implementation of the Cohen-Sutherland line-clipping algorithm.
131  * See: https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm
132  */
133 
134  const uint8 INSIDE = 0; // 0000
135  const uint8 LEFT = 1; // 0001
136  const uint8 RIGHT = 2; // 0010
137  const uint8 BOTTOM = 4; // 0100
138  const uint8 TOP = 8; // 1000
139 
140  int x0 = pta.x;
141  int y0 = pta.y;
142  int x1 = ptb.x;
143  int y1 = ptb.y;
144 
145  auto out_code = [&](int x, int y) -> uint8 {
146  uint8 out = INSIDE;
147  if (x < left) {
148  out |= LEFT;
149  } else if (x > right) {
150  out |= RIGHT;
151  }
152  if (y < top) {
153  out |= TOP;
154  } else if (y > bottom) {
155  out |= BOTTOM;
156  }
157  return out;
158  };
159 
160  uint8 c0 = out_code(x0, y0);
161  uint8 c1 = out_code(x1, y1);
162 
163  while (true) {
164  if (c0 == 0 || c1 == 0) return true;
165  if ((c0 & c1) != 0) return false;
166 
167  if (c0 & TOP) { // point 0 is above the clip window
168  x0 = x0 + (int)(((int64) (x1 - x0)) * ((int64) (top - y0)) / ((int64) (y1 - y0)));
169  y0 = top;
170  } else if (c0 & BOTTOM) { // point 0 is below the clip window
171  x0 = x0 + (int)(((int64) (x1 - x0)) * ((int64) (bottom - y0)) / ((int64) (y1 - y0)));
172  y0 = bottom;
173  } else if (c0 & RIGHT) { // point 0 is to the right of clip window
174  y0 = y0 + (int)(((int64) (y1 - y0)) * ((int64) (right - x0)) / ((int64) (x1 - x0)));
175  x0 = right;
176  } else if (c0 & LEFT) { // point 0 is to the left of clip window
177  y0 = y0 + (int)(((int64) (y1 - y0)) * ((int64) (left - x0)) / ((int64) (x1 - x0)));
178  x0 = left;
179  }
180 
181  c0 = out_code(x0, y0);
182  }
183 
184  NOT_REACHED();
185 }
186 
192 void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
193 {
194  for (CargoID c : SetCargoBitIterator(this->cargo_mask)) {
195  if (!CargoSpec::Get(c)->IsValid()) continue;
196  const GoodsEntry &ge = from->goods[c];
197  if (!LinkGraph::IsValidID(ge.link_graph) ||
198  ge.link_graph != to->goods[c].link_graph) {
199  continue;
200  }
201  const LinkGraph &lg = *LinkGraph::Get(ge.link_graph);
202  ConstEdge edge = lg[ge.node][to->goods[c].node];
203  if (edge.Capacity() > 0) {
204  this->AddStats(lg.Monthly(edge.Capacity()), lg.Monthly(edge.Usage()),
205  ge.flows.GetFlowVia(to->index), from->owner == OWNER_NONE || to->owner == OWNER_NONE,
206  this->cached_links[from->index][to->index]);
207  }
208  }
209 }
210 
221 /* static */ void LinkGraphOverlay::AddStats(uint new_cap, uint new_usg, uint new_plan, bool new_shared, LinkProperties &cargo)
222 {
223  /* multiply the numbers by 32 in order to avoid comparing to 0 too often. */
224  if (cargo.capacity == 0 ||
225  std::max(cargo.usage, cargo.planned) * 32 / (cargo.capacity + 1) < std::max(new_usg, new_plan) * 32 / (new_cap + 1)) {
226  cargo.capacity = new_cap;
227  cargo.usage = new_usg;
228  cargo.planned = new_plan;
229  }
230  if (new_shared) cargo.shared = true;
231 }
232 
238 {
239  if (this->dirty) {
240  this->RebuildCache();
241  this->dirty = false;
242  }
243  this->DrawLinks(dpi);
244  this->DrawStationDots(dpi);
245 }
246 
252 {
253  for (LinkMap::const_iterator i(this->cached_links.begin()); i != this->cached_links.end(); ++i) {
254  if (!Station::IsValidID(i->first)) continue;
255  Point pta = this->GetStationMiddle(Station::Get(i->first));
256  for (StationLinkMap::const_iterator j(i->second.begin()); j != i->second.end(); ++j) {
257  if (!Station::IsValidID(j->first)) continue;
258  Point ptb = this->GetStationMiddle(Station::Get(j->first));
259  if (!this->IsLinkVisible(pta, ptb, dpi, this->scale + 2)) continue;
260  this->DrawContent(pta, ptb, j->second);
261  }
262  }
263 }
264 
271 void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &cargo) const
272 {
273  uint usage_or_plan = std::min(cargo.capacity * 2 + 1, std::max(cargo.usage, cargo.planned));
274  int colour = LinkGraphOverlay::LINK_COLOURS[usage_or_plan * lengthof(LinkGraphOverlay::LINK_COLOURS) / (cargo.capacity * 2 + 2)];
275  int dash = cargo.shared ? this->scale * 4 : 0;
276 
277  /* Move line a bit 90° against its dominant direction to prevent it from
278  * being hidden below the grey line. */
279  int side = _settings_game.vehicle.road_side ? 1 : -1;
280  if (abs(pta.x - ptb.x) < abs(pta.y - ptb.y)) {
281  int offset_x = (pta.y > ptb.y ? 1 : -1) * side * this->scale;
282  GfxDrawLine(pta.x + offset_x, pta.y, ptb.x + offset_x, ptb.y, colour, this->scale, dash);
283  } else {
284  int offset_y = (pta.x < ptb.x ? 1 : -1) * side * this->scale;
285  GfxDrawLine(pta.x, pta.y + offset_y, ptb.x, ptb.y + offset_y, colour, this->scale, dash);
286  }
287 
288  GfxDrawLine(pta.x, pta.y, ptb.x, ptb.y, _colour_gradient[COLOUR_GREY][1], this->scale);
289 }
290 
296 {
297  for (StationSupplyList::const_iterator i(this->cached_stations.begin()); i != this->cached_stations.end(); ++i) {
298  const Station *st = Station::GetIfValid(i->first);
299  if (st == nullptr) continue;
300  Point pt = this->GetStationMiddle(st);
301  if (!this->IsPointVisible(pt, dpi, 3 * this->scale)) continue;
302 
303  uint r = this->scale * 2 + this->scale * 2 * std::min(200U, i->second) / 200;
304 
305  LinkGraphOverlay::DrawVertex(pt.x, pt.y, r,
307  (Colours)Company::Get(st->owner)->colour : COLOUR_GREY][5],
308  _colour_gradient[COLOUR_GREY][1]);
309  }
310 }
311 
320 /* static */ void LinkGraphOverlay::DrawVertex(int x, int y, int size, int colour, int border_colour)
321 {
322  size--;
323  int w1 = size / 2;
324  int w2 = size / 2 + size % 2;
325 
326  GfxFillRect(x - w1, y - w1, x + w2, y + w2, colour);
327 
328  w1++;
329  w2++;
330  GfxDrawLine(x - w1, y - w1, x + w2, y - w1, border_colour);
331  GfxDrawLine(x - w1, y + w2, x + w2, y + w2, border_colour);
332  GfxDrawLine(x - w1, y - w1, x - w1, y + w2, border_colour);
333  GfxDrawLine(x + w2, y - w1, x + w2, y + w2, border_colour);
334 }
335 
342 {
343  if (this->window->viewport != nullptr) {
344  return GetViewportStationMiddle(this->window->viewport, st);
345  } else {
346  /* assume this is a smallmap */
347  return static_cast<const SmallMapWindow *>(this->window)->GetStationMiddle(st);
348  }
349 }
350 
355 void LinkGraphOverlay::SetCargoMask(CargoTypes cargo_mask)
356 {
357  this->cargo_mask = cargo_mask;
358  this->RebuildCache();
359  this->window->GetWidget<NWidgetBase>(this->widget_id)->SetDirty(this->window);
360 }
361 
366 void LinkGraphOverlay::SetCompanyMask(uint32 company_mask)
367 {
368  this->company_mask = company_mask;
369  this->RebuildCache();
370  this->window->GetWidget<NWidgetBase>(this->widget_id)->SetDirty(this->window);
371 }
372 
375 {
376  return MakeCompanyButtonRows(biggest_index, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST, COLOUR_GREY, 3, STR_NULL);
377 }
378 
379 NWidgetBase *MakeSaturationLegendLinkGraphGUI(int *biggest_index)
380 {
382  for (uint i = 0; i < lengthof(LinkGraphOverlay::LINK_COLOURS); ++i) {
383  NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_DARK_GREEN, i + WID_LGL_SATURATION_FIRST);
384  wid->SetMinimalSize(50, 0);
385  wid->SetMinimalTextLines(1, 0, FS_SMALL);
386  wid->SetFill(1, 1);
387  wid->SetResize(0, 0);
388  panel->Add(wid);
389  }
390  *biggest_index = WID_LGL_SATURATION_LAST;
391  return panel;
392 }
393 
394 NWidgetBase *MakeCargoesLegendLinkGraphGUI(int *biggest_index)
395 {
396  static const uint ENTRIES_PER_ROW = CeilDiv(NUM_CARGO, 5);
398  NWidgetHorizontal *row = nullptr;
399  for (uint i = 0; i < NUM_CARGO; ++i) {
400  if (i % ENTRIES_PER_ROW == 0) {
401  if (row) panel->Add(row);
402  row = new NWidgetHorizontal(NC_EQUALSIZE);
403  }
404  NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, i + WID_LGL_CARGO_FIRST);
405  wid->SetMinimalSize(25, 0);
406  wid->SetMinimalTextLines(1, 0, FS_SMALL);
407  wid->SetFill(1, 1);
408  wid->SetResize(0, 0);
409  row->Add(wid);
410  }
411  /* Fill up last row */
412  for (uint i = 0; i < 4 - (NUM_CARGO - 1) % 5; ++i) {
413  NWidgetSpacer *spc = new NWidgetSpacer(25, 0);
414  spc->SetMinimalTextLines(1, 0, FS_SMALL);
415  spc->SetFill(1, 1);
416  spc->SetResize(0, 0);
417  row->Add(spc);
418  }
419  panel->Add(row);
420  *biggest_index = WID_LGL_CARGO_LAST;
421  return panel;
422 }
423 
424 
425 static const NWidgetPart _nested_linkgraph_legend_widgets[] = {
427  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
428  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_LGL_CAPTION), SetDataTip(STR_LINKGRAPH_LEGEND_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
429  NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
430  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
431  EndContainer(),
432  NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
434  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_LGL_SATURATION),
436  NWidgetFunction(MakeSaturationLegendLinkGraphGUI),
437  EndContainer(),
438  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_LGL_COMPANIES),
442  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_LGL_COMPANIES_ALL), SetDataTip(STR_LINKGRAPH_LEGEND_ALL, STR_NULL),
443  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_LGL_COMPANIES_NONE), SetDataTip(STR_LINKGRAPH_LEGEND_NONE, STR_NULL),
444  EndContainer(),
445  EndContainer(),
446  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_LGL_CARGOES),
449  NWidgetFunction(MakeCargoesLegendLinkGraphGUI),
450  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_LGL_CARGOES_ALL), SetDataTip(STR_LINKGRAPH_LEGEND_ALL, STR_NULL),
451  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_LGL_CARGOES_NONE), SetDataTip(STR_LINKGRAPH_LEGEND_NONE, STR_NULL),
452  EndContainer(),
453  EndContainer(),
454  EndContainer(),
455  EndContainer()
456 };
457 
458 static_assert(WID_LGL_SATURATION_LAST - WID_LGL_SATURATION_FIRST ==
460 
461 static WindowDesc _linkgraph_legend_desc(
462  WDP_AUTO, "toolbar_linkgraph", 0, 0,
464  0,
465  _nested_linkgraph_legend_widgets, lengthof(_nested_linkgraph_legend_widgets)
466 );
467 
472 {
473  AllocateWindowDescFront<LinkGraphLegendWindow>(&_linkgraph_legend_desc, 0);
474 }
475 
476 LinkGraphLegendWindow::LinkGraphLegendWindow(WindowDesc *desc, int window_number) : Window(desc)
477 {
478  this->InitNested(window_number);
479  this->InvalidateData(0);
480  this->SetOverlay(FindWindowById(WC_MAIN_WINDOW, 0)->viewport->overlay);
481 }
482 
488  this->overlay = overlay;
489  uint32 companies = this->overlay->GetCompanyMask();
490  for (uint c = 0; c < MAX_COMPANIES; c++) {
491  if (!this->IsWidgetDisabled(WID_LGL_COMPANY_FIRST + c)) {
492  this->SetWidgetLoweredState(WID_LGL_COMPANY_FIRST + c, HasBit(companies, c));
493  }
494  }
495  CargoTypes cargoes = this->overlay->GetCargoMask();
496  for (uint c = 0; c < NUM_CARGO; c++) {
497  if (!this->IsWidgetDisabled(WID_LGL_CARGO_FIRST + c)) {
498  this->SetWidgetLoweredState(WID_LGL_CARGO_FIRST + c, HasBit(cargoes, c));
499  }
500  }
501 }
502 
503 void LinkGraphLegendWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
504 {
505  if (IsInsideMM(widget, WID_LGL_SATURATION_FIRST, WID_LGL_SATURATION_LAST + 1)) {
506  StringID str = STR_NULL;
507  if (widget == WID_LGL_SATURATION_FIRST) {
508  str = STR_LINKGRAPH_LEGEND_UNUSED;
509  } else if (widget == WID_LGL_SATURATION_LAST) {
510  str = STR_LINKGRAPH_LEGEND_OVERLOADED;
511  } else if (widget == (WID_LGL_SATURATION_LAST + WID_LGL_SATURATION_FIRST) / 2) {
512  str = STR_LINKGRAPH_LEGEND_SATURATED;
513  }
514  if (str != STR_NULL) {
515  Dimension dim = GetStringBoundingBox(str);
516  dim.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
517  dim.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
518  *size = maxdim(*size, dim);
519  }
520  }
521  if (IsInsideMM(widget, WID_LGL_CARGO_FIRST, WID_LGL_CARGO_LAST + 1)) {
522  CargoSpec *cargo = CargoSpec::Get(widget - WID_LGL_CARGO_FIRST);
523  if (cargo->IsValid()) {
524  Dimension dim = GetStringBoundingBox(cargo->abbrev);
525  dim.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
526  dim.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
527  *size = maxdim(*size, dim);
528  }
529  }
530 }
531 
532 void LinkGraphLegendWindow::DrawWidget(const Rect &r, int widget) const
533 {
534  if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) {
535  if (this->IsWidgetDisabled(widget)) return;
536  CompanyID cid = (CompanyID)(widget - WID_LGL_COMPANY_FIRST);
537  Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
538  DrawCompanyIcon(cid, (r.left + r.right + 1 - sprite_size.width) / 2, (r.top + r.bottom + 1 - sprite_size.height) / 2);
539  }
540  if (IsInsideMM(widget, WID_LGL_SATURATION_FIRST, WID_LGL_SATURATION_LAST + 1)) {
541  GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, LinkGraphOverlay::LINK_COLOURS[widget - WID_LGL_SATURATION_FIRST]);
542  StringID str = STR_NULL;
543  if (widget == WID_LGL_SATURATION_FIRST) {
544  str = STR_LINKGRAPH_LEGEND_UNUSED;
545  } else if (widget == WID_LGL_SATURATION_LAST) {
546  str = STR_LINKGRAPH_LEGEND_OVERLOADED;
547  } else if (widget == (WID_LGL_SATURATION_LAST + WID_LGL_SATURATION_FIRST) / 2) {
548  str = STR_LINKGRAPH_LEGEND_SATURATED;
549  }
550  if (str != STR_NULL) DrawString(r.left, r.right, (r.top + r.bottom + 1 - FONT_HEIGHT_SMALL) / 2, str, TC_FROMSTRING, SA_HOR_CENTER);
551  }
552  if (IsInsideMM(widget, WID_LGL_CARGO_FIRST, WID_LGL_CARGO_LAST + 1)) {
553  if (this->IsWidgetDisabled(widget)) return;
554  CargoSpec *cargo = CargoSpec::Get(widget - WID_LGL_CARGO_FIRST);
555  GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, cargo->legend_colour);
556  DrawString(r.left, r.right, (r.top + r.bottom + 1 - FONT_HEIGHT_SMALL) / 2, cargo->abbrev, GetContrastColour(cargo->legend_colour, 73), SA_HOR_CENTER);
557  }
558 }
559 
560 bool LinkGraphLegendWindow::OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond)
561 {
562  if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) {
563  if (this->IsWidgetDisabled(widget)) {
564  GuiShowTooltips(this, STR_LINKGRAPH_LEGEND_SELECT_COMPANIES, 0, nullptr, close_cond);
565  } else {
566  uint64 params[2];
567  CompanyID cid = (CompanyID)(widget - WID_LGL_COMPANY_FIRST);
568  params[0] = STR_LINKGRAPH_LEGEND_SELECT_COMPANIES;
569  params[1] = cid;
570  GuiShowTooltips(this, STR_LINKGRAPH_LEGEND_COMPANY_TOOLTIP, 2, params, close_cond);
571  }
572  return true;
573  }
574  if (IsInsideMM(widget, WID_LGL_CARGO_FIRST, WID_LGL_CARGO_LAST + 1)) {
575  if (this->IsWidgetDisabled(widget)) return false;
576  CargoSpec *cargo = CargoSpec::Get(widget - WID_LGL_CARGO_FIRST);
577  uint64 params[1];
578  params[0] = cargo->name;
579  GuiShowTooltips(this, STR_BLACK_STRING, 1, params, close_cond);
580  return true;
581  }
582  return false;
583 }
584 
589 {
590  uint32 mask = 0;
591  for (uint c = 0; c < MAX_COMPANIES; c++) {
592  if (this->IsWidgetDisabled(c + WID_LGL_COMPANY_FIRST)) continue;
593  if (!this->IsWidgetLowered(c + WID_LGL_COMPANY_FIRST)) continue;
594  SetBit(mask, c);
595  }
596  this->overlay->SetCompanyMask(mask);
597 }
598 
603 {
604  CargoTypes mask = 0;
605  for (uint c = 0; c < NUM_CARGO; c++) {
606  if (this->IsWidgetDisabled(c + WID_LGL_CARGO_FIRST)) continue;
607  if (!this->IsWidgetLowered(c + WID_LGL_CARGO_FIRST)) continue;
608  SetBit(mask, c);
609  }
610  this->overlay->SetCargoMask(mask);
611 }
612 
613 void LinkGraphLegendWindow::OnClick(Point pt, int widget, int click_count)
614 {
615  /* Check which button is clicked */
616  if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) {
617  if (!this->IsWidgetDisabled(widget)) {
618  this->ToggleWidgetLoweredState(widget);
619  this->UpdateOverlayCompanies();
620  }
621  } else if (widget == WID_LGL_COMPANIES_ALL || widget == WID_LGL_COMPANIES_NONE) {
622  for (uint c = 0; c < MAX_COMPANIES; c++) {
623  if (this->IsWidgetDisabled(c + WID_LGL_COMPANY_FIRST)) continue;
624  this->SetWidgetLoweredState(WID_LGL_COMPANY_FIRST + c, widget == WID_LGL_COMPANIES_ALL);
625  }
626  this->UpdateOverlayCompanies();
627  this->SetDirty();
628  } else if (IsInsideMM(widget, WID_LGL_CARGO_FIRST, WID_LGL_CARGO_LAST + 1)) {
629  if (!this->IsWidgetDisabled(widget)) {
630  this->ToggleWidgetLoweredState(widget);
631  this->UpdateOverlayCargoes();
632  }
633  } else if (widget == WID_LGL_CARGOES_ALL || widget == WID_LGL_CARGOES_NONE) {
634  for (uint c = 0; c < NUM_CARGO; c++) {
635  if (this->IsWidgetDisabled(c + WID_LGL_CARGO_FIRST)) continue;
636  this->SetWidgetLoweredState(WID_LGL_CARGO_FIRST + c, widget == WID_LGL_CARGOES_ALL);
637  }
638  this->UpdateOverlayCargoes();
639  }
640  this->SetDirty();
641 }
642 
648 void LinkGraphLegendWindow::OnInvalidateData(int data, bool gui_scope)
649 {
650  /* Disable the companies who are not active */
651  for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
652  this->SetWidgetDisabledState(i + WID_LGL_COMPANY_FIRST, !Company::IsValidID(i));
653  }
654  for (CargoID i = 0; i < NUM_CARGO; i++) {
655  this->SetWidgetDisabledState(i + WID_LGL_CARGO_FIRST, !CargoSpec::Get(i)->IsValid());
656  }
657 }
MakeCompanyButtonRows
NWidgetBase * MakeCompanyButtonRows(int *biggest_index, int widget_first, int widget_last, Colours button_colour, int max_length, StringID button_tooltip)
Make a number of rows with button-like graphics, for enabling/disabling each company.
Definition: widget.cpp:3088
LinkGraphOverlay::company_mask
uint32 company_mask
Bitmask of companies to be displayed.
Definition: linkgraph_gui.h:74
WD_FRAMERECT_TOP
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
Definition: window_gui.h:64
LinkGraphOverlay::LINK_COLOURS
static const uint8 LINK_COLOURS[]
Colours for the various "load" states of links.
Definition: linkgraph_gui.h:43
Station::goods
GoodsEntry goods[NUM_CARGO]
Goods at this station.
Definition: station_base.h:476
LinkGraphLegendWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: linkgraph_gui.cpp:503
LinkGraph::EdgeWrapper::Usage
uint Usage() const
Get edge's usage.
Definition: linkgraph.h:99
NWidgetFunction
static NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
Obtain a nested widget (sub)tree from an external source.
Definition: widget_type.h:1239
LinkGraphOverlay::window
const Window * window
Window to be drawn into.
Definition: linkgraph_gui.h:71
Pool::PoolItem<&_link_graph_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:337
FlowStatMap::GetFlowVia
uint GetFlowVia(StationID via) const
Get the sum of flows via a specific station from this FlowStatMap.
Definition: station_cmd.cpp:4719
LinkGraph
A connected component of a link graph.
Definition: linkgraph.h:39
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1139
NWidgetContainer::Add
void Add(NWidgetBase *wid)
Append widget wid to container.
Definition: widget.cpp:1047
GetContrastColour
TextColour GetContrastColour(uint8 background, uint8 threshold)
Determine a contrasty text colour for a coloured background.
Definition: gfx.cpp:1354
LinkGraphLegendWindow::UpdateOverlayCompanies
void UpdateOverlayCompanies()
Update the overlay with the new company selection.
Definition: linkgraph_gui.cpp:588
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
Station
Station data structure.
Definition: station_base.h:447
LinkGraphOverlay::RebuildCache
void RebuildCache()
Rebuild the cache and recalculate which links and stations to be shown.
Definition: linkgraph_gui.cpp:50
Window::viewport
ViewportData * viewport
Pointer to viewport data, if present.
Definition: window_gui.h:321
NWidgetResizeBase::SetMinimalTextLines
void SetMinimalTextLines(uint8 min_lines, uint8 spacing, FontSize size)
Set minimal text lines for the widget.
Definition: widget.cpp:892
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition: pool_type.hpp:235
CargoSpec::Get
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
Definition: cargotype.h:119
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
LinkGraph::ConstNode
Constant node class.
Definition: linkgraph.h:345
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition: geometry_func.cpp:22
FindWindowById
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition: window.cpp:1146
LinkGraphLegendWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Invalidate the data of this window if the cargoes or companies have changed.
Definition: linkgraph_gui.cpp:648
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
NWidgetSpacer
Spacer widget.
Definition: widget_type.h:568
LinkGraphLegendWindow::OnTooltip
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
Event to display a custom tooltip.
Definition: linkgraph_gui.cpp:560
LinkGraphOverlay::GetCargoMask
CargoTypes GetCargoMask()
Get a bitmask of the currently shown cargoes.
Definition: linkgraph_gui.h:65
SpecializedStation< Station, false >::Get
static Station * Get(size_t index)
Gets station with given index.
Definition: base_station_base.h:219
DrawString
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition: gfx.cpp:642
LinkGraphLegendWindow::UpdateOverlayCargoes
void UpdateOverlayCargoes()
Update the overlay with the new cargo selection.
Definition: linkgraph_gui.cpp:602
CargoSpec
Specification of a cargo type.
Definition: cargotype.h:57
SpecializedStation< Station, false >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
Definition: base_station_base.h:210
VehicleSettings::road_side
byte road_side
the side of the road vehicles drive on
Definition: settings_type.h:493
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
BaseStation::owner
Owner owner
The owner of this station.
Definition: base_station_base.h:62
_colour_gradient
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
Definition: gfx.cpp:52
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:971
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1107
SmallMapWindow
Class managing the smallmap window.
Definition: smallmap_gui.h:43
GetStringBoundingBox
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:888
LinkGraph::EdgeWrapper
Wrapper for an edge (const or not) allowing retrieval, but no modification.
Definition: linkgraph.h:77
LinkGraphOverlay::SetCompanyMask
void SetCompanyMask(uint32 company_mask)
Set a new company mask and rebuild the cache.
Definition: linkgraph_gui.cpp:366
SpecializedStation< Station, false >::Iterate
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
Definition: base_station_base.h:270
IsInsideMM
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
Definition: math_func.hpp:204
WindowDesc
High level window description.
Definition: window_gui.h:168
COMPANY_FIRST
@ COMPANY_FIRST
First company, same as owner.
Definition: company_type.h:22
LinkGraphOverlay::cached_links
LinkMap cached_links
Cache for links to reduce recalculation.
Definition: linkgraph_gui.h:75
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:463
Window::GetWidget
const NWID * GetWidget(uint widnum) const
Get the nested widget with number widnum from the nested widget tree.
Definition: window_gui.h:908
LinkGraphOverlay::cached_stations
StationSupplyList cached_stations
Cache for stations to be drawn.
Definition: linkgraph_gui.h:76
LinkGraphOverlay
Handles drawing of links into some window.
Definition: linkgraph_gui.h:37
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:156
SetBitIterator
Iterable ensemble of each set bit in a value.
Definition: bitmath_func.hpp:329
GuiShowTooltips
void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
Shows a tooltip.
Definition: misc_gui.cpp:767
LinkGraphOverlay::SetCargoMask
void SetCargoMask(CargoTypes cargo_mask)
Set a new cargo mask and rebuild the cache.
Definition: linkgraph_gui.cpp:355
LinkGraphOverlay::AddLinks
void AddLinks(const Station *sta, const Station *stb)
Add all "interesting" links between the given stations to the cache.
Definition: linkgraph_gui.cpp:192
BaseStation::rect
StationRect rect
NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions.
Definition: base_station_base.h:76
LinkGraphLegendWindow::SetOverlay
void SetOverlay(LinkGraphOverlay *overlay)
Set the overlay belonging to this menu and import its company/cargo settings.
Definition: linkgraph_gui.cpp:487
NWidgetResizeBase::SetResize
void SetResize(uint resize_x, uint resize_y)
Set resize step of the widget.
Definition: widget.cpp:916
CargoSpec::IsValid
bool IsValid() const
Tests for validity of this cargospec.
Definition: cargotype.h:100
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:993
WD_FRAMERECT_LEFT
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:62
FS_SMALL
@ FS_SMALL
Index of the small font in the font tables.
Definition: gfx_type.h:208
GoodsEntry::node
NodeID node
ID of node in link graph referring to this goods entry.
Definition: station_base.h:255
WD_FRAMERECT_RIGHT
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:63
WD_FRAMERECT_BOTTOM
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
Definition: window_gui.h:65
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:53
Window::SetWidgetDisabledState
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition: window_gui.h:386
MAX_COMPANIES
@ MAX_COMPANIES
Maximum number of companies.
Definition: company_type.h:23
LinkGraphOverlay::IsLinkVisible
bool IsLinkVisible(Point pta, Point ptb, const DrawPixelInfo *dpi, int padding=0) const
Determine if a certain link crosses through the area given by the dpi with some lee way.
Definition: linkgraph_gui.cpp:122
LinkGraphOverlay::AddStats
static void AddStats(uint new_cap, uint new_usg, uint new_flow, bool new_shared, LinkProperties &cargo)
Add information from a given pair of link stat and flow stat to the given link properties.
Definition: linkgraph_gui.cpp:221
LinkGraph::EdgeWrapper::Capacity
uint Capacity() const
Get edge's capacity.
Definition: linkgraph.h:93
LinkProperties::capacity
uint capacity
Capacity of the link.
Definition: linkgraph_gui.h:27
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
GfxFillRect
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Definition: gfx.cpp:116
GoodsEntry::link_graph
LinkGraphID link_graph
Link graph this station belongs to.
Definition: station_base.h:254
WC_LINKGRAPH_LEGEND
@ WC_LINKGRAPH_LEGEND
Linkgraph legend; Window numbers:
Definition: window_type.h:672
NWidgetBase::current_y
uint current_y
Current vertical size (after resizing).
Definition: widget_type.h:187
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:37
SA_HOR_CENTER
@ SA_HOR_CENTER
Horizontally center the text.
Definition: gfx_type.h:329
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
NWidgetResizeBase::SetFill
void SetFill(uint fill_x, uint fill_y)
Set the filling of the widget from initial size.
Definition: widget.cpp:905
FONT_HEIGHT_SMALL
#define FONT_HEIGHT_SMALL
Height of characters in the small (FS_SMALL) font.
Definition: gfx_func.h:162
DrawCompanyIcon
void DrawCompanyIcon(CompanyID c, int x, int y)
Draw the icon of a company.
Definition: company_cmd.cpp:143
GetSpriteSize
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition: gfx.cpp:976
LinkGraphOverlay::scale
uint scale
Width of link lines.
Definition: linkgraph_gui.h:77
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
GoodsEntry
Stores station stats for a single cargo.
Definition: station_base.h:167
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1092
LinkGraphOverlay::dirty
bool dirty
Set if overlay should be rebuilt.
Definition: linkgraph_gui.h:78
LinkGraphOverlay::DrawStationDots
void DrawStationDots(const DrawPixelInfo *dpi) const
Draw dots for stations into the smallmap.
Definition: linkgraph_gui.cpp:295
NWidgetHorizontal
Horizontal container.
Definition: widget_type.h:493
LinkProperties::planned
uint planned
Planned usage of the link.
Definition: linkgraph_gui.h:29
GoodsEntry::flows
FlowStatMap flows
Planned flows through this station.
Definition: station_base.h:256
MakeCompanyButtonRowsLinkGraphGUI
NWidgetBase * MakeCompanyButtonRowsLinkGraphGUI(int *biggest_index)
Make a number of rows with buttons for each company for the linkgraph legend window.
Definition: linkgraph_gui.cpp:374
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1207
LinkGraphLegendWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: linkgraph_gui.cpp:532
LinkGraphOverlay::Draw
void Draw(const DrawPixelInfo *dpi)
Draw the linkgraph overlay or some part of it, in the area given.
Definition: linkgraph_gui.cpp:237
LinkGraphOverlay::GetStationMiddle
Point GetStationMiddle(const Station *st) const
Determine the middle of a station in the current window.
Definition: linkgraph_gui.cpp:341
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
LinkGraph::ConstEdgeIterator
An iterator for const edges.
Definition: linkgraph.h:315
LinkGraphLegendWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: linkgraph_gui.cpp:613
OWNER_NONE
@ OWNER_NONE
The tile has no ownership.
Definition: company_type.h:25
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:487
NUM_CARGO
@ NUM_CARGO
Maximal number of cargo types in a game.
Definition: cargo_type.h:65
LinkGraphOverlay::IsPointVisible
bool IsPointVisible(Point pt, const DrawPixelInfo *dpi, int padding=0) const
Determine if a certain point is inside the given DPI, with some lee way.
Definition: linkgraph_gui.cpp:107
NWidgetVertical
Vertical container.
Definition: widget_type.h:516
CargoSpec::name
StringID name
Name of this type of cargo.
Definition: cargotype.h:72
WC_MAIN_WINDOW
@ WC_MAIN_WINDOW
Main window; Window numbers:
Definition: window_type.h:43
LinkProperties::usage
uint usage
Actual usage of the link.
Definition: linkgraph_gui.h:28
LinkProperties::shared
bool shared
If this is a shared link to be drawn dashed.
Definition: linkgraph_gui.h:30
CargoSpec::abbrev
StringID abbrev
Two letter abbreviation for this cargo type.
Definition: cargotype.h:76
ShowLinkGraphLegend
void ShowLinkGraphLegend()
Open a link graph legend window.
Definition: linkgraph_gui.cpp:471
abs
static T abs(const T a)
Returns the absolute value of (scalar) variable.
Definition: math_func.hpp:21
LinkGraphOverlay::GetWidgetDpi
void GetWidgetDpi(DrawPixelInfo *dpi) const
Get a DPI for the widget we will be drawing to.
Definition: linkgraph_gui.cpp:39
LinkGraphOverlay::cargo_mask
CargoTypes cargo_mask
Bitmask of cargos to be displayed.
Definition: linkgraph_gui.h:73
LinkGraphOverlay::SetDirty
void SetDirty()
Mark the linkgraph dirty to be rebuilt next time Draw() is called.
Definition: linkgraph_gui.h:62
Window::ToggleWidgetLoweredState
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
Definition: window_gui.h:457
SetBit
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
Definition: bitmath_func.hpp:121
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:378
SpecializedStation< Station, false >::GetIfValid
static Station * GetIfValid(size_t index)
Returns station if the index is a valid index for this station type.
Definition: base_station_base.h:228
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:20
LinkGraphOverlay::GetCompanyMask
uint32 GetCompanyMask()
Get a bitmask of the currently shown companies.
Definition: linkgraph_gui.h:68
LinkGraphOverlay::DrawContent
void DrawContent(Point pta, Point ptb, const LinkProperties &cargo) const
Draw one specific link.
Definition: linkgraph_gui.cpp:271
CeilDiv
static uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
Definition: math_func.hpp:254
LinkGraphOverlay::widget_id
const uint widget_id
ID of Widget in Window to be drawn to.
Definition: linkgraph_gui.h:72
GameSettings::vehicle
VehicleSettings vehicle
options for vehicles
Definition: settings_type.h:584
Window
Data structure for an opened window.
Definition: window_gui.h:279
WD_CAPTIONTEXT_LEFT
@ WD_CAPTIONTEXT_LEFT
Offset of the caption text at the left.
Definition: window_gui.h:127
Pool::PoolItem<&_link_graph_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:326
LinkGraphOverlay::DrawLinks
void DrawLinks(const DrawPixelInfo *dpi) const
Draw the cached links or part of them into the given area.
Definition: linkgraph_gui.cpp:251
NWidgetBackground
Nested widget with a child.
Definition: widget_type.h:584
Window::IsWidgetDisabled
bool IsWidgetDisabled(byte widget_index) const
Gets the enabled/disabled status of a widget.
Definition: window_gui.h:415
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:47
LinkGraph::ConstNode::End
ConstEdgeIterator End() const
Get an iterator pointing beyond the end of the edges array.
Definition: linkgraph.h:374
LinkGraphOverlay::DrawVertex
static void DrawVertex(int x, int y, int size, int colour, int border_colour)
Draw a square symbolizing a producer of cargo.
Definition: linkgraph_gui.cpp:320
NWidgetBase::current_x
uint current_x
Current horizontal size (after resizing).
Definition: widget_type.h:186
NWidgetResizeBase::SetMinimalSize
void SetMinimalSize(uint min_x, uint min_y)
Set minimal size of the widget.
Definition: widget.cpp:866
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:447
LinkGraph::ConstNode::Begin
ConstEdgeIterator Begin() const
Get an iterator pointing to the start of the edges array.
Definition: linkgraph.h:368
LinkGraph::Monthly
uint Monthly(uint base) const
Scale a value to its monthly equivalent, based on last compression.
Definition: linkgraph.h:524
DrawPixelInfo
Data about how and where to blit pixels.
Definition: gfx_type.h:155
LinkGraph::NodeWrapper::Supply
uint Supply() const
Get supply of wrapped node.
Definition: linkgraph.h:153
LinkProperties
Properties of a link between two stations.
Definition: linkgraph_gui.h:24
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:62