Update to 12.0-beta1

This commit is contained in:
dP
2021-08-15 14:57:29 +03:00
parent ac7d3eba75
commit 9df4f2c4fc
666 changed files with 61302 additions and 20466 deletions
+6 -5
View File
@@ -16,10 +16,10 @@
#include "../station_base.h"
#include "../cargotype.h"
#include "../date_func.h"
#include "../saveload/saveload.h"
#include "linkgraph_type.h"
#include <utility>
struct SaveLoad;
class LinkGraph;
/**
@@ -495,7 +495,7 @@ public:
* Get the current size of the component.
* @return Size.
*/
inline uint Size() const { return (uint)this->nodes.size(); }
inline NodeID Size() const { return (NodeID)this->nodes.size(); }
/**
* Get date of last compression.
@@ -525,9 +525,10 @@ public:
protected:
friend class LinkGraph::ConstNode;
friend class LinkGraph::Node;
friend const SaveLoad *GetLinkGraphDesc();
friend const SaveLoad *GetLinkGraphJobDesc();
friend void SaveLoad_LinkGraph(LinkGraph &lg);
friend SaveLoadTable GetLinkGraphDesc();
friend SaveLoadTable GetLinkGraphJobDesc();
friend class SlLinkgraphNode;
friend class SlLinkgraphEdge;
CargoID cargo; ///< Cargo of this component's link graph.
Date last_compression; ///< Last time the capacities and supplies were compressed.
+8 -7
View File
@@ -65,8 +65,7 @@ void LinkGraphOverlay::RebuildCache()
StationLinkMap &seen_links = this->cached_links[from];
uint supply = 0;
CargoID c;
FOR_EACH_SET_CARGO_ID(c, this->cargo_mask) {
for (CargoID c : SetCargoBitIterator(this->cargo_mask)) {
if (!CargoSpec::Get(c)->IsValid()) continue;
if (!LinkGraph::IsValidID(sta->goods[c].link_graph)) continue;
const LinkGraph &lg = *LinkGraph::Get(sta->goods[c].link_graph);
@@ -192,8 +191,7 @@ inline bool LinkGraphOverlay::IsLinkVisible(Point pta, Point ptb, const DrawPixe
*/
void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
{
CargoID c;
FOR_EACH_SET_CARGO_ID(c, this->cargo_mask) {
for (CargoID c : SetCargoBitIterator(this->cargo_mask)) {
if (!CargoSpec::Get(c)->IsValid()) continue;
const GoodsEntry &ge = from->goods[c];
if (!LinkGraph::IsValidID(ge.link_graph) ||
@@ -383,7 +381,8 @@ NWidgetBase *MakeSaturationLegendLinkGraphGUI(int *biggest_index)
NWidgetVertical *panel = new NWidgetVertical(NC_EQUALSIZE);
for (uint i = 0; i < lengthof(LinkGraphOverlay::LINK_COLOURS); ++i) {
NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_DARK_GREEN, i + WID_LGL_SATURATION_FIRST);
wid->SetMinimalSize(50, FONT_HEIGHT_SMALL);
wid->SetMinimalSize(50, 0);
wid->SetMinimalTextLines(1, 0, FS_SMALL);
wid->SetFill(1, 1);
wid->SetResize(0, 0);
panel->Add(wid);
@@ -403,14 +402,16 @@ NWidgetBase *MakeCargoesLegendLinkGraphGUI(int *biggest_index)
row = new NWidgetHorizontal(NC_EQUALSIZE);
}
NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, i + WID_LGL_CARGO_FIRST);
wid->SetMinimalSize(25, FONT_HEIGHT_SMALL);
wid->SetMinimalSize(25, 0);
wid->SetMinimalTextLines(1, 0, FS_SMALL);
wid->SetFill(1, 1);
wid->SetResize(0, 0);
row->Add(wid);
}
/* Fill up last row */
for (uint i = 0; i < 4 - (NUM_CARGO - 1) % 5; ++i) {
NWidgetSpacer *spc = new NWidgetSpacer(25, FONT_HEIGHT_SMALL);
NWidgetSpacer *spc = new NWidgetSpacer(25, 0);
spc->SetMinimalTextLines(1, 0, FS_SMALL);
spc->SetFill(1, 1);
spc->SetResize(0, 0);
row->Add(spc);
+2 -2
View File
@@ -65,7 +65,7 @@ void LinkGraphJob::SpawnThread()
* On the other hand, if you want to play games which make this hang noticeably
* on a platform without threads then you'll probably get other problems first.
* OK:
* If someone comes and tells me that this hangs for him/her, I'll implement a
* If someone comes and tells me that this hangs for them, I'll implement a
* smaller grained "Step" method for all handlers and add some more ticks where
* "Step" is called. No problem in principle. */
LinkGraphSchedule::Run(this);
@@ -101,7 +101,7 @@ LinkGraphJob::~LinkGraphJob()
/* Link graph has been merged into another one. */
if (!LinkGraph::IsValidID(this->link_graph.index)) return;
uint size = this->Size();
uint16 size = this->Size();
for (NodeID node_id = 0; node_id < size; ++node_id) {
Node from = (*this)[node_id];
+2 -2
View File
@@ -52,7 +52,7 @@ private:
typedef std::vector<NodeAnnotation> NodeAnnotationVector;
typedef SmallMatrix<EdgeAnnotation> EdgeAnnotationMatrix;
friend const SaveLoad *GetLinkGraphJobDesc();
friend SaveLoadTable GetLinkGraphJobDesc();
friend class LinkGraphSchedule;
protected:
@@ -332,7 +332,7 @@ public:
* Get the size of the underlying link graph.
* @return Size.
*/
inline uint Size() const { return this->link_graph.Size(); }
inline NodeID Size() const { return this->link_graph.Size(); }
/**
* Get the cargo of the underlying link graph.
+1 -1
View File
@@ -39,7 +39,7 @@ private:
~LinkGraphSchedule();
typedef std::list<LinkGraph *> GraphList;
typedef std::list<LinkGraphJob *> JobList;
friend const SaveLoad *GetLinkGraphScheduleDesc();
friend SaveLoadTable GetLinkGraphScheduleDesc();
protected:
ComponentHandler *handlers[6]; ///< Handlers to be run for each job.
+4 -4
View File
@@ -260,7 +260,7 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
{
typedef std::set<Tannotation *, typename Tannotation::Comparator> AnnoSet;
Tedge_iterator iter(this->job);
uint size = this->job.Size();
uint16 size = this->job.Size();
AnnoSet annos;
paths.resize(size, nullptr);
for (NodeID node = 0; node < size; ++node) {
@@ -473,7 +473,7 @@ bool MCF1stPass::EliminateCycles(PathVector &path, NodeID origin_id, NodeID next
bool MCF1stPass::EliminateCycles()
{
bool cycles_found = false;
uint size = this->job.Size();
uint16 size = this->job.Size();
PathVector path(size, nullptr);
for (NodeID node = 0; node < size; ++node) {
/* Starting at each node in the graph find all cycles involving this
@@ -491,7 +491,7 @@ bool MCF1stPass::EliminateCycles()
MCF1stPass::MCF1stPass(LinkGraphJob &job) : MultiCommodityFlow(job)
{
PathVector paths;
uint size = job.Size();
uint16 size = job.Size();
uint accuracy = job.Settings().accuracy;
bool more_loops;
std::vector<bool> finished_sources(size);
@@ -540,7 +540,7 @@ MCF2ndPass::MCF2ndPass(LinkGraphJob &job) : MultiCommodityFlow(job)
{
this->max_saturation = UINT_MAX; // disable artificial cap on saturation
PathVector paths;
uint size = job.Size();
uint16 size = job.Size();
uint accuracy = job.Settings().accuracy;
bool demand_left = true;
std::vector<bool> finished_sources(size);