mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Codechange: Replaced SmallVector::Resize() with std::vector::resize()
This commit is contained in:
parent
a690936ed7
commit
bad2c2154b
@ -74,7 +74,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (index >= this->data.size() && index < Tmax_size) {
|
if (index >= this->data.size() && index < Tmax_size) {
|
||||||
this->data.Resize(index + 1);
|
this->data.resize(index + 1);
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
@ -97,15 +97,6 @@ public:
|
|||||||
return this->End() - to_add;
|
return this->End() - to_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the size of the vector, effectively truncating items from the end or appending uninitialised ones.
|
|
||||||
* @param num_items Target size.
|
|
||||||
*/
|
|
||||||
inline void Resize(uint num_items)
|
|
||||||
{
|
|
||||||
std::vector<T>::resize(num_items);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new item at a specific position into the vector, moving all following items.
|
* Insert a new item at a specific position into the vector, moving all following items.
|
||||||
* @param item Position at which the new item should be inserted
|
* @param item Position at which the new item should be inserted
|
||||||
|
@ -281,7 +281,7 @@ void LinkGraph::Init(uint size)
|
|||||||
{
|
{
|
||||||
assert(this->Size() == 0);
|
assert(this->Size() == 0);
|
||||||
this->edges.Resize(size, size);
|
this->edges.Resize(size, size);
|
||||||
this->nodes.Resize(size);
|
this->nodes.resize(size);
|
||||||
|
|
||||||
for (uint i = 0; i < size; ++i) {
|
for (uint i = 0; i < size; ++i) {
|
||||||
this->nodes[i].Init();
|
this->nodes[i].Init();
|
||||||
|
@ -179,7 +179,7 @@ LinkGraphJob::~LinkGraphJob()
|
|||||||
void LinkGraphJob::Init()
|
void LinkGraphJob::Init()
|
||||||
{
|
{
|
||||||
uint size = this->Size();
|
uint size = this->Size();
|
||||||
this->nodes.Resize(size);
|
this->nodes.resize(size);
|
||||||
this->edges.Resize(size, size);
|
this->edges.Resize(size, size);
|
||||||
for (uint i = 0; i < size; ++i) {
|
for (uint i = 0; i < size; ++i) {
|
||||||
this->nodes[i].Init(this->link_graph[i].Supply());
|
this->nodes[i].Init(this->link_graph[i].Supply());
|
||||||
|
@ -482,7 +482,7 @@ struct RefitWindow : public Window {
|
|||||||
/* 0xFF item is in front, other subtypes are sorted. So just truncate the list in the right spot */
|
/* 0xFF item is in front, other subtypes are sorted. So just truncate the list in the right spot */
|
||||||
for (uint i = 1; i < l.size(); i++) {
|
for (uint i = 1; i < l.size(); i++) {
|
||||||
if (l[i].subtype >= refit_cyc) {
|
if (l[i].subtype >= refit_cyc) {
|
||||||
l.Resize(i);
|
l.resize(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user