mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back()
parent
ca2f33c6d0
commit
a0f36a50e6
|
@ -481,7 +481,7 @@ struct AISettingsWindow : public Window {
|
||||||
|
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (int i = config_item.min_value; i <= config_item.max_value; i++) {
|
for (int i = config_item.min_value; i <= config_item.max_value; i++) {
|
||||||
*list->Append() = new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false);
|
list->push_back(new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowDropDownListAt(this, list, old_val, -1, wi_rect, COLOUR_ORANGE, true);
|
ShowDropDownListAt(this, list, old_val, -1, wi_rect, COLOUR_ORANGE, true);
|
||||||
|
|
|
@ -219,7 +219,7 @@ class BuildAirportWindow : public PickerWindowBase {
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
|
|
||||||
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
|
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
|
||||||
*list->Append() = new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false);
|
list->push_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -140,7 +140,7 @@ class ReplaceVehicleWindow : public Window {
|
||||||
if (!CheckAutoreplaceValidity(this->sel_engine[0], eid, _local_company)) continue;
|
if (!CheckAutoreplaceValidity(this->sel_engine[0], eid, _local_company)) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
*list->Append() = eid;
|
list->push_back(eid);
|
||||||
if (eid == this->sel_engine[side]) selected_engine = eid; // The selected engine is still in the list
|
if (eid == this->sel_engine[side]) selected_engine = eid; // The selected engine is still in the list
|
||||||
}
|
}
|
||||||
this->sel_engine[side] = selected_engine; // update which engine we selected (the same or none, if it's not in the list anymore)
|
this->sel_engine[side] = selected_engine; // update which engine we selected (the same or none, if it's not in the list anymore)
|
||||||
|
@ -468,8 +468,8 @@ public:
|
||||||
|
|
||||||
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
|
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
*list->Append() = new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false);
|
list->push_back(new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false);
|
list->push_back(new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false));
|
||||||
ShowDropDownList(this, list, this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
|
ShowDropDownList(this, list, this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,12 +416,13 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
|
||||||
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
|
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
|
||||||
if (CheckBridgeAvailability(brd_type, bridge_len).Succeeded()) {
|
if (CheckBridgeAvailability(brd_type, bridge_len).Succeeded()) {
|
||||||
/* bridge is accepted, add to list */
|
/* bridge is accepted, add to list */
|
||||||
BuildBridgeData *item = bl->Append();
|
/*C++17: BuildBridgeData &item = */ bl->emplace_back();
|
||||||
item->index = brd_type;
|
BuildBridgeData &item = bl->back();
|
||||||
item->spec = GetBridgeSpec(brd_type);
|
item.index = brd_type;
|
||||||
|
item.spec = GetBridgeSpec(brd_type);
|
||||||
/* Add to terraforming & bulldozing costs the cost of the
|
/* Add to terraforming & bulldozing costs the cost of the
|
||||||
* bridge itself (not computed with DC_QUERY_COST) */
|
* bridge itself (not computed with DC_QUERY_COST) */
|
||||||
item->cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item->spec->price) >> 8) + infra_cost;
|
item.cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item.spec->price) >> 8) + infra_cost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1246,7 +1246,7 @@ struct BuildVehicleWindow : Window {
|
||||||
/* Filter now! So num_engines and num_wagons is valid */
|
/* Filter now! So num_engines and num_wagons is valid */
|
||||||
if (!FilterSingleEngine(eid)) continue;
|
if (!FilterSingleEngine(eid)) continue;
|
||||||
|
|
||||||
*this->eng_list.Append() = eid;
|
this->eng_list.push_back(eid);
|
||||||
|
|
||||||
if (rvi->railveh_type != RAILVEH_WAGON) {
|
if (rvi->railveh_type != RAILVEH_WAGON) {
|
||||||
num_engines++;
|
num_engines++;
|
||||||
|
@ -1284,7 +1284,7 @@ struct BuildVehicleWindow : Window {
|
||||||
EngineID eid = e->index;
|
EngineID eid = e->index;
|
||||||
if (!IsEngineBuildable(eid, VEH_ROAD, _local_company)) continue;
|
if (!IsEngineBuildable(eid, VEH_ROAD, _local_company)) continue;
|
||||||
if (!HasBit(this->filter.roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)) continue;
|
if (!HasBit(this->filter.roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)) continue;
|
||||||
*this->eng_list.Append() = eid;
|
this->eng_list.push_back(eid);
|
||||||
|
|
||||||
if (eid == this->sel_engine) sel_id = eid;
|
if (eid == this->sel_engine) sel_id = eid;
|
||||||
}
|
}
|
||||||
|
@ -1302,7 +1302,7 @@ struct BuildVehicleWindow : Window {
|
||||||
if (!this->show_hidden_engines && e->IsHidden(_local_company)) continue;
|
if (!this->show_hidden_engines && e->IsHidden(_local_company)) continue;
|
||||||
EngineID eid = e->index;
|
EngineID eid = e->index;
|
||||||
if (!IsEngineBuildable(eid, VEH_SHIP, _local_company)) continue;
|
if (!IsEngineBuildable(eid, VEH_SHIP, _local_company)) continue;
|
||||||
*this->eng_list.Append() = eid;
|
this->eng_list.push_back(eid);
|
||||||
|
|
||||||
if (eid == this->sel_engine) sel_id = eid;
|
if (eid == this->sel_engine) sel_id = eid;
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1330,7 @@ struct BuildVehicleWindow : Window {
|
||||||
/* First VEH_END window_numbers are fake to allow a window open for all different types at once */
|
/* First VEH_END window_numbers are fake to allow a window open for all different types at once */
|
||||||
if (!this->listview_mode && !CanVehicleUseStation(eid, st)) continue;
|
if (!this->listview_mode && !CanVehicleUseStation(eid, st)) continue;
|
||||||
|
|
||||||
*this->eng_list.Append() = eid;
|
this->eng_list.push_back(eid);
|
||||||
if (eid == this->sel_engine) sel_id = eid;
|
if (eid == this->sel_engine) sel_id = eid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,10 +606,10 @@ private:
|
||||||
if (default_livery != NULL) {
|
if (default_livery != NULL) {
|
||||||
/* Add COLOUR_END to put the colour out of range, but also allow us to show what the default is */
|
/* Add COLOUR_END to put the colour out of range, but also allow us to show what the default is */
|
||||||
default_col = (primary ? default_livery->colour1 : default_livery->colour2) + COLOUR_END;
|
default_col = (primary ? default_livery->colour1 : default_livery->colour2) + COLOUR_END;
|
||||||
*list->Append() = new DropDownListColourItem(default_col, false);
|
list->push_back(new DropDownListColourItem(default_col, false));
|
||||||
}
|
}
|
||||||
for (uint i = 0; i < lengthof(_colour_dropdown); i++) {
|
for (uint i = 0; i < lengthof(_colour_dropdown); i++) {
|
||||||
*list->Append() = new DropDownListColourItem(i, HasBit(used_colours, i));
|
list->push_back(new DropDownListColourItem(i, HasBit(used_colours, i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
byte sel = (default_livery == NULL || HasBit(livery->in_use, primary ? 0 : 1)) ? (primary ? livery->colour1 : livery->colour2) : default_col;
|
byte sel = (default_livery == NULL || HasBit(livery->in_use, primary ? 0 : 1)) ? (primary ? livery->colour1 : livery->colour2) : default_col;
|
||||||
|
@ -642,8 +642,8 @@ private:
|
||||||
{
|
{
|
||||||
for (const Group **g = source->Begin(); g != source->End(); g++) {
|
for (const Group **g = source->Begin(); g != source->End(); g++) {
|
||||||
if ((*g)->parent != parent) continue;
|
if ((*g)->parent != parent) continue;
|
||||||
*this->groups.Append() = *g;
|
this->groups.push_back(*g);
|
||||||
*this->indents.Append() = indent;
|
this->indents.push_back(indent);
|
||||||
AddChildren(source, (*g)->index, indent + 1);
|
AddChildren(source, (*g)->index, indent + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -662,7 +662,7 @@ private:
|
||||||
const Group *g;
|
const Group *g;
|
||||||
FOR_ALL_GROUPS(g) {
|
FOR_ALL_GROUPS(g) {
|
||||||
if (g->owner == owner && g->vehicle_type == vtype) {
|
if (g->owner == owner && g->vehicle_type == vtype) {
|
||||||
*list.Append() = g;
|
list.push_back(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct PoolBase {
|
||||||
*/
|
*/
|
||||||
PoolBase(PoolType pt) : type(pt)
|
PoolBase(PoolType pt) : type(pt)
|
||||||
{
|
{
|
||||||
*PoolBase::GetPools()->Append() = this;
|
PoolBase::GetPools()->push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~PoolBase();
|
virtual ~PoolBase();
|
||||||
|
|
|
@ -143,9 +143,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
|
||||||
inline bool Insert(const T &key, const U &data)
|
inline bool Insert(const T &key, const U &data)
|
||||||
{
|
{
|
||||||
if (this->Contains(key)) return false;
|
if (this->Contains(key)) return false;
|
||||||
Pair *n = this->Append();
|
std::vector<Pair>::emplace_back(key, data);
|
||||||
n->first = key;
|
|
||||||
n->second = data;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,9 +158,10 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
|
||||||
for (uint i = 0; i < std::vector<Pair>::size(); i++) {
|
for (uint i = 0; i < std::vector<Pair>::size(); i++) {
|
||||||
if (key == std::vector<Pair>::operator[](i).first) return std::vector<Pair>::operator[](i).second;
|
if (key == std::vector<Pair>::operator[](i).first) return std::vector<Pair>::operator[](i).second;
|
||||||
}
|
}
|
||||||
Pair *n = this->Append();
|
/*C++17: Pair &n = */ std::vector<Pair>::emplace_back();
|
||||||
n->first = key;
|
Pair &n = std::vector<Pair>::back();
|
||||||
return n->second;
|
n.first = key;
|
||||||
|
return n.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SortByKey()
|
inline void SortByKey()
|
||||||
|
|
|
@ -66,17 +66,6 @@ public:
|
||||||
|
|
||||||
~SmallVector() = default;
|
~SmallVector() = default;
|
||||||
|
|
||||||
/**
|
|
||||||
* Append an item and return it.
|
|
||||||
* @param to_add the number of items to append
|
|
||||||
* @return pointer to newly allocated item
|
|
||||||
*/
|
|
||||||
inline T *Append(uint to_add = 1)
|
|
||||||
{
|
|
||||||
std::vector<T>::resize(std::vector<T>::size() + to_add);
|
|
||||||
return this->End() - to_add;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -112,7 +101,7 @@ public:
|
||||||
inline bool Include(const T &item)
|
inline bool Include(const T &item)
|
||||||
{
|
{
|
||||||
bool is_member = std::find(std::vector<T>::begin(), std::vector<T>::end(), item) != std::vector<T>::end();
|
bool is_member = std::find(std::vector<T>::begin(), std::vector<T>::end(), item) != std::vector<T>::end();
|
||||||
if (!is_member) *this->Append() = item;
|
if (!is_member) std::vector<T>::emplace_back(item);
|
||||||
return is_member;
|
return is_member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +146,23 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to extend a vector by more than one element
|
||||||
|
* Consider using std::back_inserter in new code
|
||||||
|
*
|
||||||
|
* @param vec A reference to the vector to be extended
|
||||||
|
* @param num The number of elements to default-construct
|
||||||
|
*
|
||||||
|
* @return Pointer to the first new element
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
inline T* grow(std::vector<T>& vec, std::size_t num)
|
||||||
|
{
|
||||||
|
const std::size_t pos = vec.size();
|
||||||
|
vec.resize(pos + num);
|
||||||
|
return vec.data() + pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple vector template class, with automatic free.
|
* Simple vector template class, with automatic free.
|
||||||
|
|
|
@ -75,14 +75,14 @@ struct SetDateWindow : Window {
|
||||||
|
|
||||||
case WID_SD_DAY:
|
case WID_SD_DAY:
|
||||||
for (uint i = 0; i < 31; i++) {
|
for (uint i = 0; i < 31; i++) {
|
||||||
*list->Append() = new DropDownListStringItem(STR_DAY_NUMBER_1ST + i, i + 1, false);
|
list->push_back(new DropDownListStringItem(STR_DAY_NUMBER_1ST + i, i + 1, false));
|
||||||
}
|
}
|
||||||
selected = this->date.day;
|
selected = this->date.day;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_SD_MONTH:
|
case WID_SD_MONTH:
|
||||||
for (uint i = 0; i < 12; i++) {
|
for (uint i = 0; i < 12; i++) {
|
||||||
*list->Append() = new DropDownListStringItem(STR_MONTH_JAN + i, i, false);
|
list->push_back(new DropDownListStringItem(STR_MONTH_JAN + i, i, false));
|
||||||
}
|
}
|
||||||
selected = this->date.month;
|
selected = this->date.month;
|
||||||
break;
|
break;
|
||||||
|
@ -91,7 +91,7 @@ struct SetDateWindow : Window {
|
||||||
for (Year i = this->min_year; i <= this->max_year; i++) {
|
for (Year i = this->min_year; i <= this->max_year; i++) {
|
||||||
DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
|
DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
|
||||||
item->SetParam(0, i);
|
item->SetParam(0, i);
|
||||||
*list->Append() = item;
|
list->push_back(item);
|
||||||
}
|
}
|
||||||
selected = this->date.year;
|
selected = this->date.year;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -490,11 +490,12 @@ void EngineOverrideManager::ResetToDefaultMapping()
|
||||||
this->clear();
|
this->clear();
|
||||||
for (VehicleType type = VEH_TRAIN; type <= VEH_AIRCRAFT; type++) {
|
for (VehicleType type = VEH_TRAIN; type <= VEH_AIRCRAFT; type++) {
|
||||||
for (uint internal_id = 0; internal_id < _engine_counts[type]; internal_id++) {
|
for (uint internal_id = 0; internal_id < _engine_counts[type]; internal_id++) {
|
||||||
EngineIDMapping *eid = this->Append();
|
/*C++17: EngineIDMapping &eid = */ this->emplace_back();
|
||||||
eid->type = type;
|
EngineIDMapping &eid = this->back();
|
||||||
eid->grfid = INVALID_GRFID;
|
eid.type = type;
|
||||||
eid->internal_id = internal_id;
|
eid.grfid = INVALID_GRFID;
|
||||||
eid->substitute_id = internal_id;
|
eid.internal_id = internal_id;
|
||||||
|
eid.substitute_id = internal_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,8 @@ public:
|
||||||
*/
|
*/
|
||||||
inline FiosItem *Append()
|
inline FiosItem *Append()
|
||||||
{
|
{
|
||||||
return this->files.Append();
|
/*C++17: return &*/ this->files.emplace_back();
|
||||||
|
return &this->files.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -115,7 +115,7 @@ LanguageStrings *ReadRawLanguageStrings(const char *file)
|
||||||
while (i > 0 && (buffer[i - 1] == '\r' || buffer[i - 1] == '\n' || buffer[i - 1] == ' ')) i--;
|
while (i > 0 && (buffer[i - 1] == '\r' || buffer[i - 1] == '\n' || buffer[i - 1] == ' ')) i--;
|
||||||
buffer[i] = '\0';
|
buffer[i] = '\0';
|
||||||
|
|
||||||
*ret->lines.Append() = stredup(buffer, buffer + to_read - 1);
|
ret->lines.push_back(stredup(buffer, buffer + to_read - 1));
|
||||||
|
|
||||||
if (len > to_read) {
|
if (len > to_read) {
|
||||||
to_read = 0;
|
to_read = 0;
|
||||||
|
@ -194,7 +194,7 @@ struct TranslationWriter : LanguageWriter {
|
||||||
char *dest = MallocT<char>(length + 1);
|
char *dest = MallocT<char>(length + 1);
|
||||||
memcpy(dest, buffer, length);
|
memcpy(dest, buffer, length);
|
||||||
dest[length] = '\0';
|
dest[length] = '\0';
|
||||||
*this->strings->Append() = dest;
|
this->strings->push_back(dest);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ struct StringNameWriter : HeaderWriter {
|
||||||
|
|
||||||
void WriteStringID(const char *name, int stringid)
|
void WriteStringID(const char *name, int stringid)
|
||||||
{
|
{
|
||||||
if (stringid == (int)this->strings->size()) *this->strings->Append() = stredup(name);
|
if (stringid == (int)this->strings->size()) this->strings->push_back(stredup(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Finalise(const StringData &data)
|
void Finalise(const StringData &data)
|
||||||
|
@ -246,7 +246,7 @@ public:
|
||||||
{
|
{
|
||||||
if (strcmp(filename, exclude) == 0) return true;
|
if (strcmp(filename, exclude) == 0) return true;
|
||||||
|
|
||||||
*gs->raw_strings.Append() = ReadRawLanguageStrings(filename);
|
gs->raw_strings.push_back(ReadRawLanguageStrings(filename));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -269,7 +269,7 @@ GameStrings *LoadTranslations()
|
||||||
|
|
||||||
GameStrings *gs = new GameStrings();
|
GameStrings *gs = new GameStrings();
|
||||||
try {
|
try {
|
||||||
*gs->raw_strings.Append() = ReadRawLanguageStrings(filename);
|
gs->raw_strings.push_back(ReadRawLanguageStrings(filename));
|
||||||
|
|
||||||
/* Scan for other language files */
|
/* Scan for other language files */
|
||||||
LanguageScanner scanner(gs, filename);
|
LanguageScanner scanner(gs, filename);
|
||||||
|
@ -324,8 +324,8 @@ void GameStrings::Compile()
|
||||||
translation_reader.ParseFile();
|
translation_reader.ParseFile();
|
||||||
if (_errors != 0) throw std::exception();
|
if (_errors != 0) throw std::exception();
|
||||||
|
|
||||||
LanguageStrings *compiled = *this->compiled_strings.Append() = new LanguageStrings((*p)->language);
|
this->compiled_strings.push_back(new LanguageStrings((*p)->language));
|
||||||
TranslationWriter writer(&compiled->lines);
|
TranslationWriter writer(&this->compiled_strings.back()->lines);
|
||||||
writer.WriteLang(data);
|
writer.WriteLang(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ static DropDownList *BuildMapsizeDropDown()
|
||||||
for (uint i = MIN_MAP_SIZE_BITS; i <= MAX_MAP_SIZE_BITS; i++) {
|
for (uint i = MIN_MAP_SIZE_BITS; i <= MAX_MAP_SIZE_BITS; i++) {
|
||||||
DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
|
DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
|
||||||
item->SetParam(0, 1LL << i);
|
item->SetParam(0, 1LL << i);
|
||||||
*list->Append() = item;
|
list->push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -150,7 +150,7 @@ public:
|
||||||
ICULine(icu::ParagraphLayout::Line *l) : l(l)
|
ICULine(icu::ParagraphLayout::Line *l) : l(l)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < l->countRuns(); i++) {
|
for (int i = 0; i < l->countRuns(); i++) {
|
||||||
*this->Append() = new ICUVisualRun(l->getVisualRun(i));
|
this->push_back(new ICUVisualRun(l->getVisualRun(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~ICULine() { delete l; }
|
~ICULine() { delete l; }
|
||||||
|
@ -498,7 +498,7 @@ const ParagraphLayouter::Line *FallbackParagraphLayout::NextLine(int max_width)
|
||||||
if (*this->buffer == '\0') {
|
if (*this->buffer == '\0') {
|
||||||
/* Only a newline. */
|
/* Only a newline. */
|
||||||
this->buffer = NULL;
|
this->buffer = NULL;
|
||||||
*l->Append() = new FallbackVisualRun(this->runs.Begin()->second, this->buffer, 0, 0);
|
l->push_back(new FallbackVisualRun(this->runs.Begin()->second, this->buffer, 0, 0));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ const ParagraphLayouter::Line *FallbackParagraphLayout::NextLine(int max_width)
|
||||||
|
|
||||||
if (this->buffer == next_run) {
|
if (this->buffer == next_run) {
|
||||||
int w = l->GetWidth();
|
int w = l->GetWidth();
|
||||||
*l->Append() = new FallbackVisualRun(iter->second, begin, this->buffer - begin, w);
|
l->push_back(new FallbackVisualRun(iter->second, begin, this->buffer - begin, w));
|
||||||
iter++;
|
iter++;
|
||||||
assert(iter != this->runs.End());
|
assert(iter != this->runs.End());
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ const ParagraphLayouter::Line *FallbackParagraphLayout::NextLine(int max_width)
|
||||||
|
|
||||||
if (l->size() == 0 || last_char - begin != 0) {
|
if (l->size() == 0 || last_char - begin != 0) {
|
||||||
int w = l->GetWidth();
|
int w = l->GetWidth();
|
||||||
*l->Append() = new FallbackVisualRun(iter->second, begin, last_char - begin, w);
|
l->push_back(new FallbackVisualRun(iter->second, begin, last_char - begin, w));
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
@ -720,7 +720,7 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
|
||||||
/* Copy all lines into a local cache so we can reuse them later on more easily. */
|
/* Copy all lines into a local cache so we can reuse them later on more easily. */
|
||||||
const ParagraphLayouter::Line *l;
|
const ParagraphLayouter::Line *l;
|
||||||
while ((l = line.layout->NextLine(maxw)) != NULL) {
|
while ((l = line.layout->NextLine(maxw)) != NULL) {
|
||||||
*this->Append() = l;
|
this->push_back(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (c != '\0');
|
} while (c != '\0');
|
||||||
|
@ -834,7 +834,7 @@ Font *Layouter::GetFont(FontSize size, TextColour colour)
|
||||||
if (it != fonts[size].End()) return it->second;
|
if (it != fonts[size].End()) return it->second;
|
||||||
|
|
||||||
Font *f = new Font(size, colour);
|
Font *f = new Font(size, colour);
|
||||||
*fonts[size].Append() = FontColourMap::Pair(colour, f);
|
fonts[size].emplace_back(colour, f);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1140,7 +1140,7 @@ private:
|
||||||
|
|
||||||
const Company *c;
|
const Company *c;
|
||||||
FOR_ALL_COMPANIES(c) {
|
FOR_ALL_COMPANIES(c) {
|
||||||
*this->companies.Append() = c;
|
this->companies.push_back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->companies.shrink_to_fit();
|
this->companies.shrink_to_fit();
|
||||||
|
|
|
@ -129,8 +129,8 @@ private:
|
||||||
{
|
{
|
||||||
for (const Group **g = source->Begin(); g != source->End(); g++) {
|
for (const Group **g = source->Begin(); g != source->End(); g++) {
|
||||||
if ((*g)->parent != parent) continue;
|
if ((*g)->parent != parent) continue;
|
||||||
*this->groups.Append() = *g;
|
this->groups.push_back(*g);
|
||||||
*this->indents.Append() = indent;
|
this->indents.push_back(indent);
|
||||||
AddChildren(source, (*g)->index, indent + 1);
|
AddChildren(source, (*g)->index, indent + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ private:
|
||||||
const Group *g;
|
const Group *g;
|
||||||
FOR_ALL_GROUPS(g) {
|
FOR_ALL_GROUPS(g) {
|
||||||
if (g->owner == owner && g->vehicle_type == this->vli.vtype) {
|
if (g->owner == owner && g->vehicle_type == this->vli.vtype) {
|
||||||
*list.Append() = g;
|
list.push_back(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ HotkeyList::HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandler
|
||||||
global_hotkey_handler(global_hotkey_handler), ini_group(ini_group), items(items)
|
global_hotkey_handler(global_hotkey_handler), ini_group(ini_group), items(items)
|
||||||
{
|
{
|
||||||
if (_hotkey_lists == NULL) _hotkey_lists = new SmallVector<HotkeyList*, 16>();
|
if (_hotkey_lists == NULL) _hotkey_lists = new SmallVector<HotkeyList*, 16>();
|
||||||
*_hotkey_lists->Append() = this;
|
_hotkey_lists->push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
HotkeyList::~HotkeyList()
|
HotkeyList::~HotkeyList()
|
||||||
|
|
|
@ -1206,7 +1206,7 @@ protected:
|
||||||
|
|
||||||
const Industry *i;
|
const Industry *i;
|
||||||
FOR_ALL_INDUSTRIES(i) {
|
FOR_ALL_INDUSTRIES(i) {
|
||||||
*this->industries.Append() = i;
|
this->industries.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->industries.shrink_to_fit();
|
this->industries.shrink_to_fit();
|
||||||
|
@ -2415,12 +2415,13 @@ struct IndustryCargoesWindow : public Window {
|
||||||
_displayed_industries.set(it);
|
_displayed_industries.set(it);
|
||||||
|
|
||||||
this->fields.clear();
|
this->fields.clear();
|
||||||
CargoesRow *row = this->fields.Append();
|
/*C++17: CargoesRow &row = */ this->fields.emplace_back();
|
||||||
row->columns[0].MakeHeader(STR_INDUSTRY_CARGOES_PRODUCERS);
|
CargoesRow &row = this->fields.back();
|
||||||
row->columns[1].MakeEmpty(CFT_SMALL_EMPTY);
|
row.columns[0].MakeHeader(STR_INDUSTRY_CARGOES_PRODUCERS);
|
||||||
row->columns[2].MakeEmpty(CFT_SMALL_EMPTY);
|
row.columns[1].MakeEmpty(CFT_SMALL_EMPTY);
|
||||||
row->columns[3].MakeEmpty(CFT_SMALL_EMPTY);
|
row.columns[2].MakeEmpty(CFT_SMALL_EMPTY);
|
||||||
row->columns[4].MakeHeader(STR_INDUSTRY_CARGOES_CUSTOMERS);
|
row.columns[3].MakeEmpty(CFT_SMALL_EMPTY);
|
||||||
|
row.columns[4].MakeHeader(STR_INDUSTRY_CARGOES_CUSTOMERS);
|
||||||
|
|
||||||
const IndustrySpec *central_sp = GetIndustrySpec(it);
|
const IndustrySpec *central_sp = GetIndustrySpec(it);
|
||||||
bool houses_supply = HousesCanSupply(central_sp->accepts_cargo, lengthof(central_sp->accepts_cargo));
|
bool houses_supply = HousesCanSupply(central_sp->accepts_cargo, lengthof(central_sp->accepts_cargo));
|
||||||
|
@ -2430,12 +2431,13 @@ struct IndustryCargoesWindow : public Window {
|
||||||
int num_cust = CountMatchingAcceptingIndustries(central_sp->produced_cargo, lengthof(central_sp->produced_cargo)) + houses_accept;
|
int num_cust = CountMatchingAcceptingIndustries(central_sp->produced_cargo, lengthof(central_sp->produced_cargo)) + houses_accept;
|
||||||
int num_indrows = max(3, max(num_supp, num_cust)); // One is needed for the 'it' industry, and 2 for the cargo labels.
|
int num_indrows = max(3, max(num_supp, num_cust)); // One is needed for the 'it' industry, and 2 for the cargo labels.
|
||||||
for (int i = 0; i < num_indrows; i++) {
|
for (int i = 0; i < num_indrows; i++) {
|
||||||
CargoesRow *row = this->fields.Append();
|
/*C++17: CargoesRow &row = */ this->fields.emplace_back();
|
||||||
row->columns[0].MakeEmpty(CFT_EMPTY);
|
CargoesRow &row = this->fields.back();
|
||||||
row->columns[1].MakeCargo(central_sp->accepts_cargo, lengthof(central_sp->accepts_cargo));
|
row.columns[0].MakeEmpty(CFT_EMPTY);
|
||||||
row->columns[2].MakeEmpty(CFT_EMPTY);
|
row.columns[1].MakeCargo(central_sp->accepts_cargo, lengthof(central_sp->accepts_cargo));
|
||||||
row->columns[3].MakeCargo(central_sp->produced_cargo, lengthof(central_sp->produced_cargo));
|
row.columns[2].MakeEmpty(CFT_EMPTY);
|
||||||
row->columns[4].MakeEmpty(CFT_EMPTY);
|
row.columns[3].MakeCargo(central_sp->produced_cargo, lengthof(central_sp->produced_cargo));
|
||||||
|
row.columns[4].MakeEmpty(CFT_EMPTY);
|
||||||
}
|
}
|
||||||
/* Add central industry. */
|
/* Add central industry. */
|
||||||
int central_row = 1 + num_indrows / 2;
|
int central_row = 1 + num_indrows / 2;
|
||||||
|
@ -2493,12 +2495,13 @@ struct IndustryCargoesWindow : public Window {
|
||||||
_displayed_industries.reset();
|
_displayed_industries.reset();
|
||||||
|
|
||||||
this->fields.clear();
|
this->fields.clear();
|
||||||
CargoesRow *row = this->fields.Append();
|
/*C++17: CargoesRow &row = */ this->fields.emplace_back();
|
||||||
row->columns[0].MakeHeader(STR_INDUSTRY_CARGOES_PRODUCERS);
|
CargoesRow &row = this->fields.back();
|
||||||
row->columns[1].MakeEmpty(CFT_SMALL_EMPTY);
|
row.columns[0].MakeHeader(STR_INDUSTRY_CARGOES_PRODUCERS);
|
||||||
row->columns[2].MakeHeader(STR_INDUSTRY_CARGOES_CUSTOMERS);
|
row.columns[1].MakeEmpty(CFT_SMALL_EMPTY);
|
||||||
row->columns[3].MakeEmpty(CFT_SMALL_EMPTY);
|
row.columns[2].MakeHeader(STR_INDUSTRY_CARGOES_CUSTOMERS);
|
||||||
row->columns[4].MakeEmpty(CFT_SMALL_EMPTY);
|
row.columns[3].MakeEmpty(CFT_SMALL_EMPTY);
|
||||||
|
row.columns[4].MakeEmpty(CFT_SMALL_EMPTY);
|
||||||
|
|
||||||
bool houses_supply = HousesCanSupply(&cid, 1);
|
bool houses_supply = HousesCanSupply(&cid, 1);
|
||||||
bool houses_accept = HousesCanAccept(&cid, 1);
|
bool houses_accept = HousesCanAccept(&cid, 1);
|
||||||
|
@ -2506,12 +2509,13 @@ struct IndustryCargoesWindow : public Window {
|
||||||
int num_cust = CountMatchingAcceptingIndustries(&cid, 1) + houses_accept;
|
int num_cust = CountMatchingAcceptingIndustries(&cid, 1) + houses_accept;
|
||||||
int num_indrows = max(num_supp, num_cust);
|
int num_indrows = max(num_supp, num_cust);
|
||||||
for (int i = 0; i < num_indrows; i++) {
|
for (int i = 0; i < num_indrows; i++) {
|
||||||
CargoesRow *row = this->fields.Append();
|
/*C++17: CargoesRow &row = */ this->fields.emplace_back();
|
||||||
row->columns[0].MakeEmpty(CFT_EMPTY);
|
CargoesRow &row = this->fields.back();
|
||||||
row->columns[1].MakeCargo(&cid, 1);
|
row.columns[0].MakeEmpty(CFT_EMPTY);
|
||||||
row->columns[2].MakeEmpty(CFT_EMPTY);
|
row.columns[1].MakeCargo(&cid, 1);
|
||||||
row->columns[3].MakeEmpty(CFT_EMPTY);
|
row.columns[2].MakeEmpty(CFT_EMPTY);
|
||||||
row->columns[4].MakeEmpty(CFT_EMPTY);
|
row.columns[3].MakeEmpty(CFT_EMPTY);
|
||||||
|
row.columns[4].MakeEmpty(CFT_EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->fields[num_indrows].MakeCargoLabel(0, false); // Add cargo labels at the left bottom.
|
this->fields[num_indrows].MakeCargoLabel(0, false); // Add cargo labels at the left bottom.
|
||||||
|
@ -2708,7 +2712,7 @@ struct IndustryCargoesWindow : public Window {
|
||||||
DropDownList *lst = new DropDownList;
|
DropDownList *lst = new DropDownList;
|
||||||
const CargoSpec *cs;
|
const CargoSpec *cs;
|
||||||
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
|
||||||
*lst->Append() = new DropDownListStringItem(cs->name, cs->Index(), false);
|
lst->push_back(new DropDownListStringItem(cs->name, cs->Index(), false));
|
||||||
}
|
}
|
||||||
if (lst->size() == 0) {
|
if (lst->size() == 0) {
|
||||||
delete lst;
|
delete lst;
|
||||||
|
@ -2725,7 +2729,7 @@ struct IndustryCargoesWindow : public Window {
|
||||||
IndustryType ind = _sorted_industry_types[i];
|
IndustryType ind = _sorted_industry_types[i];
|
||||||
const IndustrySpec *indsp = GetIndustrySpec(ind);
|
const IndustrySpec *indsp = GetIndustrySpec(ind);
|
||||||
if (!indsp->enabled) continue;
|
if (!indsp->enabled) continue;
|
||||||
*lst->Append() = new DropDownListStringItem(indsp->name, ind, false);
|
lst->push_back(new DropDownListStringItem(indsp->name, ind, false));
|
||||||
}
|
}
|
||||||
if (lst->size() == 0) {
|
if (lst->size() == 0) {
|
||||||
delete lst;
|
delete lst;
|
||||||
|
|
|
@ -159,7 +159,7 @@ NodeID LinkGraph::AddNode(const Station *st)
|
||||||
const GoodsEntry &good = st->goods[this->cargo];
|
const GoodsEntry &good = st->goods[this->cargo];
|
||||||
|
|
||||||
NodeID new_node = this->Size();
|
NodeID new_node = this->Size();
|
||||||
this->nodes.Append();
|
this->nodes.emplace_back();
|
||||||
/* Avoid reducing the height of the matrix as that is expensive and we
|
/* Avoid reducing the height of the matrix as that is expensive and we
|
||||||
* most likely will increase it again later which is again expensive. */
|
* most likely will increase it again later which is again expensive. */
|
||||||
this->edges.Resize(new_node + 1U,
|
this->edges.Resize(new_node + 1U,
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "../console_func.h"
|
#include "../console_func.h"
|
||||||
#include "../console_internal.h"
|
#include "../console_internal.h"
|
||||||
|
|
||||||
|
|
||||||
/* SMF reader based on description at: http://www.somascape.org/midi/tech/mfile.html */
|
/* SMF reader based on description at: http://www.somascape.org/midi/tech/mfile.html */
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,7 +216,7 @@ static bool ReadTrackChunk(FILE *file, MidiFile &target)
|
||||||
case MIDIST_CONTROLLER:
|
case MIDIST_CONTROLLER:
|
||||||
case MIDIST_PITCHBEND:
|
case MIDIST_PITCHBEND:
|
||||||
/* 3 byte messages */
|
/* 3 byte messages */
|
||||||
data = block->data.Append(3);
|
data = grow(block->data, 3);
|
||||||
data[0] = status;
|
data[0] = status;
|
||||||
if (!chunk.ReadBuffer(&data[1], 2)) {
|
if (!chunk.ReadBuffer(&data[1], 2)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -226,7 +225,7 @@ static bool ReadTrackChunk(FILE *file, MidiFile &target)
|
||||||
case MIDIST_PROGCHG:
|
case MIDIST_PROGCHG:
|
||||||
case MIDIST_CHANPRESS:
|
case MIDIST_CHANPRESS:
|
||||||
/* 2 byte messages */
|
/* 2 byte messages */
|
||||||
data = block->data.Append(2);
|
data = grow(block->data, 2);
|
||||||
data[0] = status;
|
data[0] = status;
|
||||||
if (!chunk.ReadByte(data[1])) {
|
if (!chunk.ReadByte(data[1])) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -267,7 +266,7 @@ static bool ReadTrackChunk(FILE *file, MidiFile &target)
|
||||||
if (!chunk.ReadVariableLength(length)) {
|
if (!chunk.ReadVariableLength(length)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
byte *data = block->data.Append(length + 1);
|
byte *data = grow(block->data, length + 1);
|
||||||
data[0] = 0xF0;
|
data[0] = 0xF0;
|
||||||
if (!chunk.ReadBuffer(data + 1, length)) {
|
if (!chunk.ReadBuffer(data + 1, length)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -275,7 +274,7 @@ static bool ReadTrackChunk(FILE *file, MidiFile &target)
|
||||||
if (data[length] != 0xF7) {
|
if (data[length] != 0xF7) {
|
||||||
/* Engage Casio weirdo mode - convert to normal sysex */
|
/* Engage Casio weirdo mode - convert to normal sysex */
|
||||||
running_sysex = true;
|
running_sysex = true;
|
||||||
*block->data.Append() = 0xF7;
|
block->data.push_back(0xF7);
|
||||||
} else {
|
} else {
|
||||||
running_sysex = false;
|
running_sysex = false;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +284,7 @@ static bool ReadTrackChunk(FILE *file, MidiFile &target)
|
||||||
if (!chunk.ReadVariableLength(length)) {
|
if (!chunk.ReadVariableLength(length)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
byte *data = block->data.Append(length);
|
byte *data = grow(block->data, length);
|
||||||
if (!chunk.ReadBuffer(data, length)) {
|
if (!chunk.ReadBuffer(data, length)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +335,7 @@ static bool FixupMidiData(MidiFile &target)
|
||||||
merged_blocks.push_back(block);
|
merged_blocks.push_back(block);
|
||||||
last_ticktime = block.ticktime;
|
last_ticktime = block.ticktime;
|
||||||
} else {
|
} else {
|
||||||
byte *datadest = merged_blocks.back().data.Append(block.data.size());
|
byte *datadest = grow(merged_blocks.back().data, block.data.size());
|
||||||
memcpy(datadest, block.data.Begin(), block.data.size());
|
memcpy(datadest, block.data.Begin(), block.data.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,14 +507,14 @@ struct MpsMachine {
|
||||||
|
|
||||||
static void AddMidiData(MidiFile::DataBlock &block, byte b1, byte b2)
|
static void AddMidiData(MidiFile::DataBlock &block, byte b1, byte b2)
|
||||||
{
|
{
|
||||||
*block.data.Append() = b1;
|
block.data.push_back(b1);
|
||||||
*block.data.Append() = b2;
|
block.data.push_back(b2);
|
||||||
}
|
}
|
||||||
static void AddMidiData(MidiFile::DataBlock &block, byte b1, byte b2, byte b3)
|
static void AddMidiData(MidiFile::DataBlock &block, byte b1, byte b2, byte b3)
|
||||||
{
|
{
|
||||||
*block.data.Append() = b1;
|
block.data.push_back(b1);
|
||||||
*block.data.Append() = b2;
|
block.data.push_back(b2);
|
||||||
*block.data.Append() = b3;
|
block.data.push_back(b3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -100,7 +100,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // GE
|
||||||
if (ifa->ifa_broadaddr->sa_family != AF_INET) continue;
|
if (ifa->ifa_broadaddr->sa_family != AF_INET) continue;
|
||||||
|
|
||||||
NetworkAddress addr(ifa->ifa_broadaddr, sizeof(sockaddr));
|
NetworkAddress addr(ifa->ifa_broadaddr, sizeof(sockaddr));
|
||||||
if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) *broadcast->Append() = addr;
|
if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
|
||||||
}
|
}
|
||||||
freeifaddrs(ifap);
|
freeifaddrs(ifap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ TCPConnecter::TCPConnecter(const NetworkAddress &address) :
|
||||||
sock(INVALID_SOCKET),
|
sock(INVALID_SOCKET),
|
||||||
address(address)
|
address(address)
|
||||||
{
|
{
|
||||||
*_tcp_connecters.Append() = this;
|
_tcp_connecters.push_back(this);
|
||||||
if (!ThreadObject::New(TCPConnecter::ThreadEntry, this, &this->thread, "ottd:tcp")) {
|
if (!ThreadObject::New(TCPConnecter::ThreadEntry, this, &this->thread, "ottd:tcp")) {
|
||||||
this->Connect();
|
this->Connect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ NetworkHTTPSocketHandler::NetworkHTTPSocketHandler(SOCKET s,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*_http_connections.Append() = this;
|
_http_connections.push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Free whatever needs to be freed. */
|
/** Free whatever needs to be freed. */
|
||||||
|
|
|
@ -26,14 +26,14 @@ NetworkUDPSocketHandler::NetworkUDPSocketHandler(NetworkAddressList *bind)
|
||||||
{
|
{
|
||||||
if (bind != NULL) {
|
if (bind != NULL) {
|
||||||
for (NetworkAddress *addr = bind->Begin(); addr != bind->End(); addr++) {
|
for (NetworkAddress *addr = bind->Begin(); addr != bind->End(); addr++) {
|
||||||
*this->bind.Append() = *addr;
|
this->bind.push_back(*addr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* As hostname NULL and port 0/NULL don't go well when
|
/* As hostname NULL and port 0/NULL don't go well when
|
||||||
* resolving it we need to add an address for each of
|
* resolving it we need to add an address for each of
|
||||||
* the address families we support. */
|
* the address families we support. */
|
||||||
*this->bind.Append() = NetworkAddress(NULL, 0, AF_INET);
|
this->bind.emplace_back(nullptr, 0, AF_INET);
|
||||||
*this->bind.Append() = NetworkAddress(NULL, 0, AF_INET6);
|
this->bind.emplace_back(nullptr, 0, AF_INET6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -633,12 +633,12 @@ void NetworkAddServer(const char *b)
|
||||||
void GetBindAddresses(NetworkAddressList *addresses, uint16 port)
|
void GetBindAddresses(NetworkAddressList *addresses, uint16 port)
|
||||||
{
|
{
|
||||||
for (char **iter = _network_bind_list.Begin(); iter != _network_bind_list.End(); iter++) {
|
for (char **iter = _network_bind_list.Begin(); iter != _network_bind_list.End(); iter++) {
|
||||||
*addresses->Append() = NetworkAddress(*iter, port);
|
addresses->emplace_back(*iter, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No address, so bind to everything. */
|
/* No address, so bind to everything. */
|
||||||
if (addresses->size() == 0) {
|
if (addresses->size() == 0) {
|
||||||
*addresses->Append() = NetworkAddress("", port);
|
addresses->emplace_back("", port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,7 +650,7 @@ void NetworkRebuildHostList()
|
||||||
_network_host_list.Clear();
|
_network_host_list.Clear();
|
||||||
|
|
||||||
for (NetworkGameList *item = _network_game_list; item != NULL; item = item->next) {
|
for (NetworkGameList *item = _network_game_list; item != NULL; item = item->next) {
|
||||||
if (item->manually) *_network_host_list.Append() = stredup(item->address.GetAddressAsString(false));
|
if (item->manually) _network_host_list.push_back(stredup(item->address.GetAddressAsString(false)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct PacketReader : LoadFilter {
|
||||||
/* Allocate a new chunk and add the remaining data. */
|
/* Allocate a new chunk and add the remaining data. */
|
||||||
pbuf += to_write;
|
pbuf += to_write;
|
||||||
to_write = in_packet - to_write;
|
to_write = in_packet - to_write;
|
||||||
this->buf = *this->blocks.Append() = CallocT<byte>(CHUNK);
|
this->blocks.push_back(this->buf = CallocT<byte>(CHUNK));
|
||||||
this->bufe = this->buf + CHUNK;
|
this->bufe = this->buf + CHUNK;
|
||||||
|
|
||||||
memcpy(this->buf, pbuf, to_write);
|
memcpy(this->buf, pbuf, to_write);
|
||||||
|
|
|
@ -165,7 +165,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_INFO(Packet *p)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
*this->infos.Append() = ci;
|
this->infos.push_back(ci);
|
||||||
|
|
||||||
/* Incoming data means that we might need to reconsider dependencies */
|
/* Incoming data means that we might need to reconsider dependencies */
|
||||||
for (ContentIterator iter = this->infos.Begin(); iter != this->infos.End(); iter++) {
|
for (ContentIterator iter = this->infos.Begin(); iter != this->infos.End(); iter++) {
|
||||||
|
@ -278,7 +278,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
*this->infos.Append() = ci;
|
this->infos.push_back(ci);
|
||||||
} else {
|
} else {
|
||||||
delete ci;
|
delete ci;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContent(uint &files, uin
|
||||||
const ContentInfo *ci = *iter;
|
const ContentInfo *ci = *iter;
|
||||||
if (!ci->IsSelected() || ci->state == ContentInfo::ALREADY_HERE) continue;
|
if (!ci->IsSelected() || ci->state == ContentInfo::ALREADY_HERE) continue;
|
||||||
|
|
||||||
*content.Append() = ci->id;
|
content.push_back(ci->id);
|
||||||
bytes += ci->filesize;
|
bytes += ci->filesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,11 +579,11 @@ void ClientNetworkContentSocketHandler::OnReceiveData(const char *data, size_t l
|
||||||
if (this->http_response_index == -1) {
|
if (this->http_response_index == -1) {
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
/* Append the rest of the response. */
|
/* Append the rest of the response. */
|
||||||
memcpy(this->http_response.Append((uint)length), data, length);
|
memcpy(grow(this->http_response, (uint)length), data, length);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
/* Make sure the response is properly terminated. */
|
/* Make sure the response is properly terminated. */
|
||||||
*this->http_response.Append() = '\0';
|
this->http_response.push_back('\0');
|
||||||
|
|
||||||
/* And prepare for receiving the rest of the data. */
|
/* And prepare for receiving the rest of the data. */
|
||||||
this->http_response_index = 0;
|
this->http_response_index = 0;
|
||||||
|
@ -905,7 +905,7 @@ void ClientNetworkContentSocketHandler::ReverseLookupDependency(ConstContentVect
|
||||||
|
|
||||||
for (uint i = 0; i < ci->dependency_count; i++) {
|
for (uint i = 0; i < ci->dependency_count; i++) {
|
||||||
if (ci->dependencies[i] == child->id) {
|
if (ci->dependencies[i] == child->id) {
|
||||||
*parents.Append() = ci;
|
parents.push_back(ci);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ void ClientNetworkContentSocketHandler::ReverseLookupDependency(ConstContentVect
|
||||||
*/
|
*/
|
||||||
void ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(ConstContentVector &tree, const ContentInfo *child) const
|
void ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(ConstContentVector &tree, const ContentInfo *child) const
|
||||||
{
|
{
|
||||||
*tree.Append() = child;
|
tree.push_back(child);
|
||||||
|
|
||||||
/* First find all direct parents. We can't use the "normal" iterator as
|
/* First find all direct parents. We can't use the "normal" iterator as
|
||||||
* we are including stuff into the vector and as such the vector's data
|
* we are including stuff into the vector and as such the vector's data
|
||||||
|
|
|
@ -391,7 +391,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
|
||||||
|
|
||||||
for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) {
|
for (ConstContentIterator iter = _network_content_client.Begin(); iter != _network_content_client.End(); iter++) {
|
||||||
if ((*iter)->state == ContentInfo::DOES_NOT_EXIST) all_available = false;
|
if ((*iter)->state == ContentInfo::DOES_NOT_EXIST) all_available = false;
|
||||||
*this->content.Append() = *iter;
|
this->content.push_back(*iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetWidgetDisabledState(WID_NCL_SEARCH_EXTERNAL, this->auto_select && all_available);
|
this->SetWidgetDisabledState(WID_NCL_SEARCH_EXTERNAL, this->auto_select && all_available);
|
||||||
|
|
|
@ -253,7 +253,7 @@ protected:
|
||||||
this->servers.clear();
|
this->servers.clear();
|
||||||
|
|
||||||
for (NetworkGameList *ngl = _network_game_list; ngl != NULL; ngl = ngl->next) {
|
for (NetworkGameList *ngl = _network_game_list; ngl != NULL; ngl = ngl->next) {
|
||||||
*this->servers.Append() = ngl;
|
this->servers.push_back(ngl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply the filter condition immediately, if a search string has been provided. */
|
/* Apply the filter condition immediately, if a search string has been provided. */
|
||||||
|
@ -1737,9 +1737,7 @@ struct NetworkClientListPopupWindow : Window {
|
||||||
*/
|
*/
|
||||||
inline void AddAction(StringID name, ClientList_Action_Proc *proc)
|
inline void AddAction(StringID name, ClientList_Action_Proc *proc)
|
||||||
{
|
{
|
||||||
ClientListAction *action = this->actions.Append();
|
this->actions.push_back({name, proc});
|
||||||
action->name = name;
|
|
||||||
action->proc = proc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkClientListPopupWindow(WindowDesc *desc, int x, int y, ClientID client_id) :
|
NetworkClientListPopupWindow(WindowDesc *desc, int x, int y, ClientID client_id) :
|
||||||
|
|
|
@ -2101,7 +2101,7 @@ uint NetworkServerKickOrBanIP(const char *ip, bool ban)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!contains) *_network_ban_list.Append() = stredup(ip);
|
if (!contains) _network_ban_list.push_back(stredup(ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint n = 0;
|
uint n = 0;
|
||||||
|
|
|
@ -472,10 +472,7 @@ static StringIDMappingVector _string_to_grf_mapping;
|
||||||
static void AddStringForMapping(StringID source, StringID *target)
|
static void AddStringForMapping(StringID source, StringID *target)
|
||||||
{
|
{
|
||||||
*target = STR_UNDEFINED;
|
*target = STR_UNDEFINED;
|
||||||
StringIDMapping *item = _string_to_grf_mapping.Append();
|
_string_to_grf_mapping.push_back({_cur.grffile->grfid, source, target});
|
||||||
item->grfid = _cur.grffile->grfid;
|
|
||||||
item->source = source;
|
|
||||||
item->target = target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -659,11 +656,12 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
|
||||||
|
|
||||||
/* Reserve the engine slot */
|
/* Reserve the engine slot */
|
||||||
assert(_engine_mngr.size() == e->index);
|
assert(_engine_mngr.size() == e->index);
|
||||||
EngineIDMapping *eid = _engine_mngr.Append();
|
_engine_mngr.push_back({
|
||||||
eid->type = type;
|
scope_grfid, // Note: this is INVALID_GRFID if dynamic_engines is disabled, so no reservation
|
||||||
eid->grfid = scope_grfid; // Note: this is INVALID_GRFID if dynamic_engines is disabled, so no reservation
|
internal_id,
|
||||||
eid->internal_id = internal_id;
|
{static_cast<byte>(type)},
|
||||||
eid->substitute_id = min(internal_id, _engine_counts[type]); // substitute_id == _engine_counts[subtype] means "no substitute"
|
static_cast<uint8>(min(internal_id, _engine_counts[type])) // substitute_id == _engine_counts[subtype] means "no substitute"
|
||||||
|
});
|
||||||
|
|
||||||
if (engine_pool_size != Engine::GetPoolSize()) {
|
if (engine_pool_size != Engine::GetPoolSize()) {
|
||||||
/* Resize temporary engine data ... */
|
/* Resize temporary engine data ... */
|
||||||
|
@ -1909,18 +1907,19 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
|
||||||
tmp_layout.clear();
|
tmp_layout.clear();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* no relative bounding box support */
|
/* no relative bounding box support */
|
||||||
DrawTileSeqStruct *dtss = tmp_layout.Append();
|
/*C++17: DrawTileSeqStruct &dtss = */ tmp_layout.emplace_back();
|
||||||
MemSetT(dtss, 0);
|
DrawTileSeqStruct &dtss = tmp_layout.back();
|
||||||
|
MemSetT(&dtss, 0);
|
||||||
|
|
||||||
dtss->delta_x = buf->ReadByte();
|
dtss.delta_x = buf->ReadByte();
|
||||||
if (dtss->IsTerminator()) break;
|
if (dtss.IsTerminator()) break;
|
||||||
dtss->delta_y = buf->ReadByte();
|
dtss.delta_y = buf->ReadByte();
|
||||||
dtss->delta_z = buf->ReadByte();
|
dtss.delta_z = buf->ReadByte();
|
||||||
dtss->size_x = buf->ReadByte();
|
dtss.size_x = buf->ReadByte();
|
||||||
dtss->size_y = buf->ReadByte();
|
dtss.size_y = buf->ReadByte();
|
||||||
dtss->size_z = buf->ReadByte();
|
dtss.size_z = buf->ReadByte();
|
||||||
|
|
||||||
ReadSpriteLayoutSprite(buf, false, true, false, GSF_STATIONS, &dtss->image);
|
ReadSpriteLayoutSprite(buf, false, true, false, GSF_STATIONS, &dtss.image);
|
||||||
/* On error, bail out immediately. Temporary GRF data was already freed */
|
/* On error, bail out immediately. Temporary GRF data was already freed */
|
||||||
if (_cur.skip_sprites < 0) return CIR_DISABLED;
|
if (_cur.skip_sprites < 0) return CIR_DISABLED;
|
||||||
}
|
}
|
||||||
|
@ -2594,7 +2593,7 @@ static ChangeInfoResult LoadTranslationTable(uint gvid, int numinfo, ByteReader
|
||||||
translation_table.clear();
|
translation_table.clear();
|
||||||
for (int i = 0; i < numinfo; i++) {
|
for (int i = 0; i < numinfo; i++) {
|
||||||
uint32 item = buf->ReadDWord();
|
uint32 item = buf->ReadDWord();
|
||||||
*translation_table.Append() = BSWAP32(item);
|
translation_table.push_back(BSWAP32(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
return CIR_SUCCESS;
|
return CIR_SUCCESS;
|
||||||
|
@ -2799,14 +2798,14 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, By
|
||||||
if (map.openttd_id >= MAX_NUM_GENDERS) {
|
if (map.openttd_id >= MAX_NUM_GENDERS) {
|
||||||
grfmsg(1, "GlobalVarChangeInfo: Gender name %s is not known, ignoring", name);
|
grfmsg(1, "GlobalVarChangeInfo: Gender name %s is not known, ignoring", name);
|
||||||
} else {
|
} else {
|
||||||
*_cur.grffile->language_map[curidx].gender_map.Append() = map;
|
_cur.grffile->language_map[curidx].gender_map.push_back(map);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
map.openttd_id = lang->GetCaseIndex(name);
|
map.openttd_id = lang->GetCaseIndex(name);
|
||||||
if (map.openttd_id >= MAX_NUM_CASES) {
|
if (map.openttd_id >= MAX_NUM_CASES) {
|
||||||
grfmsg(1, "GlobalVarChangeInfo: Case name %s is not known, ignoring", name);
|
grfmsg(1, "GlobalVarChangeInfo: Case name %s is not known, ignoring", name);
|
||||||
} else {
|
} else {
|
||||||
*_cur.grffile->language_map[curidx].case_map.Append() = map;
|
_cur.grffile->language_map[curidx].case_map.push_back(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newgrf_id = buf->ReadByte();
|
newgrf_id = buf->ReadByte();
|
||||||
|
@ -4335,7 +4334,7 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, Byte
|
||||||
if (_cur.grffile->railtype_map[id + i] != INVALID_RAILTYPE) {
|
if (_cur.grffile->railtype_map[id + i] != INVALID_RAILTYPE) {
|
||||||
int n = buf->ReadByte();
|
int n = buf->ReadByte();
|
||||||
for (int j = 0; j != n; j++) {
|
for (int j = 0; j != n; j++) {
|
||||||
*_railtypes[_cur.grffile->railtype_map[id + i]].alternate_labels.Append() = BSWAP32(buf->ReadDWord());
|
_railtypes[_cur.grffile->railtype_map[id + i]].alternate_labels.push_back(BSWAP32(buf->ReadDWord()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4796,29 +4795,30 @@ static void NewSpriteGroup(ByteReader *buf)
|
||||||
/* Loop through the var adjusts. Unfortunately we don't know how many we have
|
/* Loop through the var adjusts. Unfortunately we don't know how many we have
|
||||||
* from the outset, so we shall have to keep reallocing. */
|
* from the outset, so we shall have to keep reallocing. */
|
||||||
do {
|
do {
|
||||||
DeterministicSpriteGroupAdjust *adjust = adjusts.Append();
|
/*C++17: DeterministicSpriteGroupAdjust &adjust = */ adjusts.emplace_back();
|
||||||
|
DeterministicSpriteGroupAdjust &adjust = adjusts.back();
|
||||||
|
|
||||||
/* The first var adjust doesn't have an operation specified, so we set it to add. */
|
/* The first var adjust doesn't have an operation specified, so we set it to add. */
|
||||||
adjust->operation = adjusts.size() == 1 ? DSGA_OP_ADD : (DeterministicSpriteGroupAdjustOperation)buf->ReadByte();
|
adjust.operation = adjusts.size() == 1 ? DSGA_OP_ADD : (DeterministicSpriteGroupAdjustOperation)buf->ReadByte();
|
||||||
adjust->variable = buf->ReadByte();
|
adjust.variable = buf->ReadByte();
|
||||||
if (adjust->variable == 0x7E) {
|
if (adjust.variable == 0x7E) {
|
||||||
/* Link subroutine group */
|
/* Link subroutine group */
|
||||||
adjust->subroutine = GetGroupFromGroupID(setid, type, buf->ReadByte());
|
adjust.subroutine = GetGroupFromGroupID(setid, type, buf->ReadByte());
|
||||||
} else {
|
} else {
|
||||||
adjust->parameter = IsInsideMM(adjust->variable, 0x60, 0x80) ? buf->ReadByte() : 0;
|
adjust.parameter = IsInsideMM(adjust.variable, 0x60, 0x80) ? buf->ReadByte() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
varadjust = buf->ReadByte();
|
varadjust = buf->ReadByte();
|
||||||
adjust->shift_num = GB(varadjust, 0, 5);
|
adjust.shift_num = GB(varadjust, 0, 5);
|
||||||
adjust->type = (DeterministicSpriteGroupAdjustType)GB(varadjust, 6, 2);
|
adjust.type = (DeterministicSpriteGroupAdjustType)GB(varadjust, 6, 2);
|
||||||
adjust->and_mask = buf->ReadVarSize(varsize);
|
adjust.and_mask = buf->ReadVarSize(varsize);
|
||||||
|
|
||||||
if (adjust->type != DSGA_TYPE_NONE) {
|
if (adjust.type != DSGA_TYPE_NONE) {
|
||||||
adjust->add_val = buf->ReadVarSize(varsize);
|
adjust.add_val = buf->ReadVarSize(varsize);
|
||||||
adjust->divmod_val = buf->ReadVarSize(varsize);
|
adjust.divmod_val = buf->ReadVarSize(varsize);
|
||||||
} else {
|
} else {
|
||||||
adjust->add_val = 0;
|
adjust.add_val = 0;
|
||||||
adjust->divmod_val = 0;
|
adjust.divmod_val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Continue reading var adjusts while bit 5 is set. */
|
/* Continue reading var adjusts while bit 5 is set. */
|
||||||
|
@ -7851,9 +7851,7 @@ static bool HandleParameterInfo(ByteReader *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id >= _cur.grfconfig->param_info.size()) {
|
if (id >= _cur.grfconfig->param_info.size()) {
|
||||||
uint num_to_add = id - _cur.grfconfig->param_info.size() + 1;
|
_cur.grfconfig->param_info.resize(id + 1);
|
||||||
GRFParameterInfo **newdata = _cur.grfconfig->param_info.Append(num_to_add);
|
|
||||||
MemSetT<GRFParameterInfo *>(newdata, 0, num_to_add);
|
|
||||||
}
|
}
|
||||||
if (_cur.grfconfig->param_info[id] == NULL) {
|
if (_cur.grfconfig->param_info[id] == NULL) {
|
||||||
_cur.grfconfig->param_info[id] = new GRFParameterInfo(id);
|
_cur.grfconfig->param_info[id] = new GRFParameterInfo(id);
|
||||||
|
@ -8405,7 +8403,7 @@ static void InitNewGRFFile(const GRFConfig *config)
|
||||||
}
|
}
|
||||||
|
|
||||||
newfile = new GRFFile(config);
|
newfile = new GRFFile(config);
|
||||||
*_grf_files.Append() = _cur.grffile = newfile;
|
_grf_files.push_back(_cur.grffile = newfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -666,7 +666,8 @@ uint32 NewGRFSpriteLayout::PrepareLayout(uint32 orig_offset, uint32 newgrf_groun
|
||||||
|
|
||||||
/* Create a copy of the spritelayout, so we can modify some values.
|
/* Create a copy of the spritelayout, so we can modify some values.
|
||||||
* Also include the groundsprite into the sequence for easier processing. */
|
* Also include the groundsprite into the sequence for easier processing. */
|
||||||
DrawTileSeqStruct *result = result_seq.Append();
|
/*C++17: DrawTileSeqStruct *result = &*/ result_seq.emplace_back();
|
||||||
|
DrawTileSeqStruct *result = &result_seq.back();
|
||||||
result->image = ground;
|
result->image = ground;
|
||||||
result->delta_x = 0;
|
result->delta_x = 0;
|
||||||
result->delta_y = 0;
|
result->delta_y = 0;
|
||||||
|
@ -674,10 +675,10 @@ uint32 NewGRFSpriteLayout::PrepareLayout(uint32 orig_offset, uint32 newgrf_groun
|
||||||
|
|
||||||
const DrawTileSeqStruct *dtss;
|
const DrawTileSeqStruct *dtss;
|
||||||
foreach_draw_tile_seq(dtss, this->seq) {
|
foreach_draw_tile_seq(dtss, this->seq) {
|
||||||
*result_seq.Append() = *dtss;
|
result_seq.push_back(*dtss);
|
||||||
}
|
}
|
||||||
result_seq.Append()->MakeTerminator();
|
result_seq.emplace_back() /*C++17: .MakeTerminator()*/;
|
||||||
|
result_seq.back().MakeTerminator();
|
||||||
/* Determine the var10 values the action-1-2-3 chains needs to be resolved for,
|
/* Determine the var10 values the action-1-2-3 chains needs to be resolved for,
|
||||||
* and apply the default sprite offsets (unless disabled). */
|
* and apply the default sprite offsets (unless disabled). */
|
||||||
const TileLayoutRegisters *regs = this->registers;
|
const TileLayoutRegisters *regs = this->registers;
|
||||||
|
|
|
@ -85,9 +85,9 @@ GRFConfig::GRFConfig(const GRFConfig &config) :
|
||||||
if (config.error != NULL) this->error = new GRFError(*config.error);
|
if (config.error != NULL) this->error = new GRFError(*config.error);
|
||||||
for (uint i = 0; i < config.param_info.size(); i++) {
|
for (uint i = 0; i < config.param_info.size(); i++) {
|
||||||
if (config.param_info[i] == NULL) {
|
if (config.param_info[i] == NULL) {
|
||||||
*this->param_info.Append() = NULL;
|
this->param_info.push_back(NULL);
|
||||||
} else {
|
} else {
|
||||||
*this->param_info.Append() = new GRFParameterInfo(*config.param_info[i]);
|
this->param_info.push_back(new GRFParameterInfo(*config.param_info[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -611,9 +611,9 @@ compatible_grf:
|
||||||
c->has_param_defaults = f->has_param_defaults;
|
c->has_param_defaults = f->has_param_defaults;
|
||||||
for (uint i = 0; i < f->param_info.size(); i++) {
|
for (uint i = 0; i < f->param_info.size(); i++) {
|
||||||
if (f->param_info[i] == NULL) {
|
if (f->param_info[i] == NULL) {
|
||||||
*c->param_info.Append() = NULL;
|
c->param_info.push_back(NULL);
|
||||||
} else {
|
} else {
|
||||||
*c->param_info.Append() = new GRFParameterInfo(*f->param_info[i]);
|
c->param_info.push_back(new GRFParameterInfo(*f->param_info[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1196,9 +1196,7 @@ static SmallVector<ListOrderChange, 16> _list_order_changes;
|
||||||
void AlterVehicleListOrder(EngineID engine, uint target)
|
void AlterVehicleListOrder(EngineID engine, uint target)
|
||||||
{
|
{
|
||||||
/* Add the list order change to a queue */
|
/* Add the list order change to a queue */
|
||||||
ListOrderChange *loc = _list_order_changes.Append();
|
_list_order_changes.push_back({engine, target});
|
||||||
loc->engine = engine;
|
|
||||||
loc->target = target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1231,7 +1229,7 @@ void CommitVehicleListOrderChanges()
|
||||||
SmallVector<EngineID, 16> ordering;
|
SmallVector<EngineID, 16> ordering;
|
||||||
Engine *e;
|
Engine *e;
|
||||||
FOR_ALL_ENGINES(e) {
|
FOR_ALL_ENGINES(e) {
|
||||||
*ordering.Append() = e->index;
|
ordering.push_back(e->index);
|
||||||
}
|
}
|
||||||
QSortT(ordering.Begin(), ordering.size(), EnginePreSort);
|
QSortT(ordering.Begin(), ordering.size(), EnginePreSort);
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ struct NewGRFParametersWindow : public Window {
|
||||||
|
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (uint32 i = par_info->min_value; i <= par_info->max_value; i++) {
|
for (uint32 i = par_info->min_value; i <= par_info->max_value; i++) {
|
||||||
*list->Append() = new DropDownListCharStringItem(GetGRFStringFromGRFText(par_info->value_names.Find(i)->second), i, false);
|
list->push_back(new DropDownListCharStringItem(GetGRFStringFromGRFText(par_info->value_names.Find(i)->second), i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowDropDownListAt(this, list, old_val, -1, wi_rect, COLOUR_ORANGE, true);
|
ShowDropDownListAt(this, list, old_val, -1, wi_rect, COLOUR_ORANGE, true);
|
||||||
|
@ -927,11 +927,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
|
|
||||||
/* Add 'None' option for clearing list */
|
/* Add 'None' option for clearing list */
|
||||||
*list->Append() = new DropDownListStringItem(STR_NONE, -1, false);
|
list->push_back(new DropDownListStringItem(STR_NONE, -1, false));
|
||||||
|
|
||||||
for (uint i = 0; i < _grf_preset_list.size(); i++) {
|
for (uint i = 0; i < _grf_preset_list.size(); i++) {
|
||||||
if (_grf_preset_list[i] != NULL) {
|
if (_grf_preset_list[i] != NULL) {
|
||||||
*list->Append() = new DropDownListCharStringItem(_grf_preset_list[i], i, false);
|
list->push_back(new DropDownListCharStringItem(_grf_preset_list[i], i, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1464,7 +1464,7 @@ private:
|
||||||
if (found) continue;
|
if (found) continue;
|
||||||
|
|
||||||
if (_settings_client.gui.newgrf_show_old_versions) {
|
if (_settings_client.gui.newgrf_show_old_versions) {
|
||||||
*this->avails.Append() = c;
|
this->avails.push_back(c);
|
||||||
} else {
|
} else {
|
||||||
const GRFConfig *best = FindGRFConfig(c->ident.grfid, HasBit(c->flags, GCF_INVALID) ? FGCM_NEWEST : FGCM_NEWEST_VALID);
|
const GRFConfig *best = FindGRFConfig(c->ident.grfid, HasBit(c->flags, GCF_INVALID) ? FGCM_NEWEST : FGCM_NEWEST_VALID);
|
||||||
/*
|
/*
|
||||||
|
@ -1475,7 +1475,7 @@ private:
|
||||||
* show that NewGRF!.
|
* show that NewGRF!.
|
||||||
*/
|
*/
|
||||||
if (best->version == 0 || best->ident.HasGrfIdentifier(c->ident.grfid, c->ident.md5sum)) {
|
if (best->version == 0 || best->ident.HasGrfIdentifier(c->ident.grfid, c->ident.md5sum)) {
|
||||||
*this->avails.Append() = c;
|
this->avails.push_back(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1558,7 +1558,7 @@ void ShowMissingContentWindow(const GRFConfig *list)
|
||||||
strecpy(ci->name, c->GetName(), lastof(ci->name));
|
strecpy(ci->name, c->GetName(), lastof(ci->name));
|
||||||
ci->unique_id = BSWAP32(c->ident.grfid);
|
ci->unique_id = BSWAP32(c->ident.grfid);
|
||||||
memcpy(ci->md5sum, HasBit(c->flags, GCF_COMPATIBLE) ? c->original_md5sum : c->ident.md5sum, sizeof(ci->md5sum));
|
memcpy(ci->md5sum, HasBit(c->flags, GCF_COMPATIBLE) ? c->original_md5sum : c->ident.md5sum, sizeof(ci->md5sum));
|
||||||
*cv.Append() = ci;
|
cv.push_back(ci);
|
||||||
}
|
}
|
||||||
ShowNetworkContentListWindow(cv.size() == 0 ? NULL : &cv, CONTENT_TYPE_NEWGRF);
|
ShowNetworkContentListWindow(cv.size() == 0 ? NULL : &cv, CONTENT_TYPE_NEWGRF);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ static SmallVector<SoundEntry, 8> _sounds;
|
||||||
*/
|
*/
|
||||||
SoundEntry *AllocateSound(uint num)
|
SoundEntry *AllocateSound(uint num)
|
||||||
{
|
{
|
||||||
SoundEntry *sound = _sounds.Append(num);
|
SoundEntry *sound = grow(_sounds, num);
|
||||||
MemSetT(sound, 0, num);
|
MemSetT(sound, 0, num);
|
||||||
return sound;
|
return sound;
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,9 +530,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearedObjectArea *cleared_area = _cleared_object_areas.Append();
|
_cleared_object_areas.push_back({tile, ta});
|
||||||
cleared_area->first_tile = tile;
|
|
||||||
cleared_area->area = ta;
|
|
||||||
|
|
||||||
if (flags & DC_EXEC) ReallyClearObjectTile(o);
|
if (flags & DC_EXEC) ReallyClearObjectTile(o);
|
||||||
|
|
||||||
|
|
|
@ -445,7 +445,7 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||||
|
|
||||||
if (dedicated_host != NULL) {
|
if (dedicated_host != NULL) {
|
||||||
_network_bind_list.Clear();
|
_network_bind_list.Clear();
|
||||||
*_network_bind_list.Append() = stredup(dedicated_host);
|
_network_bind_list.push_back(stredup(dedicated_host));
|
||||||
}
|
}
|
||||||
if (dedicated_port != 0) _settings_client.network.server_port = dedicated_port;
|
if (dedicated_port != 0) _settings_client.network.server_port = dedicated_port;
|
||||||
|
|
||||||
|
@ -1177,7 +1177,7 @@ static void CheckCaches()
|
||||||
SmallVector<TownCache, 4> old_town_caches;
|
SmallVector<TownCache, 4> old_town_caches;
|
||||||
Town *t;
|
Town *t;
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
MemCpyT(old_town_caches.Append(), &t->cache);
|
old_town_caches.push_back(t->cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void RebuildTownCaches();
|
extern void RebuildTownCaches();
|
||||||
|
@ -1195,7 +1195,7 @@ static void CheckCaches()
|
||||||
/* Check company infrastructure cache. */
|
/* Check company infrastructure cache. */
|
||||||
SmallVector<CompanyInfrastructure, 4> old_infrastructure;
|
SmallVector<CompanyInfrastructure, 4> old_infrastructure;
|
||||||
Company *c;
|
Company *c;
|
||||||
FOR_ALL_COMPANIES(c) MemCpyT(old_infrastructure.Append(), &c->infrastructure);
|
FOR_ALL_COMPANIES(c) old_infrastructure.push_back(c->infrastructure);
|
||||||
|
|
||||||
extern void AfterLoadCompanyStats();
|
extern void AfterLoadCompanyStats();
|
||||||
AfterLoadCompanyStats();
|
AfterLoadCompanyStats();
|
||||||
|
|
|
@ -1297,7 +1297,7 @@ public:
|
||||||
case WID_O_COND_VARIABLE: {
|
case WID_O_COND_VARIABLE: {
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (uint i = 0; i < lengthof(_order_conditional_variable); i++) {
|
for (uint i = 0; i < lengthof(_order_conditional_variable); i++) {
|
||||||
*list->Append() = new DropDownListStringItem(STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + _order_conditional_variable[i], _order_conditional_variable[i], false);
|
list->push_back(new DropDownListStringItem(STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + _order_conditional_variable[i], _order_conditional_variable[i], false));
|
||||||
}
|
}
|
||||||
ShowDropDownList(this, list, this->vehicle->GetOrder(this->OrderGetSel())->GetConditionVariable(), WID_O_COND_VARIABLE);
|
ShowDropDownList(this, list, this->vehicle->GetOrder(this->OrderGetSel())->GetConditionVariable(), WID_O_COND_VARIABLE);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
FontMap::const_iterator map = fontMapping.Begin();
|
FontMap::const_iterator map = fontMapping.Begin();
|
||||||
while (map < fontMapping.End() - 1 && map->first <= chars.location) map++;
|
while (map < fontMapping.End() - 1 && map->first <= chars.location) map++;
|
||||||
|
|
||||||
*this->Append() = new CoreTextVisualRun(run, map->second, buff);
|
this->push_back(new CoreTextVisualRun(run, map->second, buff));
|
||||||
}
|
}
|
||||||
CFRelease(line);
|
CFRelease(line);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1623,7 +1623,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
if (v != NULL && !HasPowerOnRail(v->railtype, totype)) {
|
if (v != NULL && !HasPowerOnRail(v->railtype, totype)) {
|
||||||
/* No power on new rail type, reroute. */
|
/* No power on new rail type, reroute. */
|
||||||
FreeTrainTrackReservation(v);
|
FreeTrainTrackReservation(v);
|
||||||
*vehicles_affected.Append() = v;
|
vehicles_affected.push_back(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1705,7 +1705,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
if (v != NULL && !HasPowerOnRail(v->railtype, totype)) {
|
if (v != NULL && !HasPowerOnRail(v->railtype, totype)) {
|
||||||
/* No power on new rail type, reroute. */
|
/* No power on new rail type, reroute. */
|
||||||
FreeTrainTrackReservation(v);
|
FreeTrainTrackReservation(v);
|
||||||
*vehicles_affected.Append() = v;
|
vehicles_affected.push_back(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2007,7 +2007,7 @@ DropDownList *GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
||||||
|
|
||||||
if (all_option) {
|
if (all_option) {
|
||||||
DropDownListStringItem *item = new DropDownListStringItem(STR_REPLACE_ALL_RAILTYPE, INVALID_RAILTYPE, false);
|
DropDownListStringItem *item = new DropDownListStringItem(STR_REPLACE_ALL_RAILTYPE, INVALID_RAILTYPE, false);
|
||||||
*list->Append() = item;
|
list->push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dimension d = { 0, 0 };
|
Dimension d = { 0, 0 };
|
||||||
|
@ -2038,7 +2038,7 @@ DropDownList *GetRailTypeDropDownList(bool for_replacement, bool all_option)
|
||||||
}
|
}
|
||||||
item->SetParam(0, rti->strings.menu_text);
|
item->SetParam(0, rti->strings.menu_text);
|
||||||
item->SetParam(1, rti->max_speed);
|
item->SetParam(1, rti->max_speed);
|
||||||
*list->Append() = item;
|
list->push_back(item);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2954,24 +2954,24 @@ bool AfterLoadGame()
|
||||||
cur_skip = prev_tile_skip;
|
cur_skip = prev_tile_skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint *this_skip = skip_frames.Append();
|
/*C++17: uint &this_skip = */ skip_frames.push_back(prev_tile_skip);
|
||||||
*this_skip = prev_tile_skip;
|
uint &this_skip = skip_frames.back();
|
||||||
|
|
||||||
/* The following 3 curves now take longer than before */
|
/* The following 3 curves now take longer than before */
|
||||||
switch (u->state) {
|
switch (u->state) {
|
||||||
case 2:
|
case 2:
|
||||||
cur_skip++;
|
cur_skip++;
|
||||||
if (u->frame <= (roadside ? 9 : 5)) *this_skip = cur_skip;
|
if (u->frame <= (roadside ? 9 : 5)) this_skip = cur_skip;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
cur_skip++;
|
cur_skip++;
|
||||||
if (u->frame <= (roadside ? 5 : 9)) *this_skip = cur_skip;
|
if (u->frame <= (roadside ? 5 : 9)) this_skip = cur_skip;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
cur_skip++;
|
cur_skip++;
|
||||||
if (u->frame <= (roadside ? 4 : 2)) *this_skip = cur_skip;
|
if (u->frame <= (roadside ? 4 : 2)) this_skip = cur_skip;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -42,14 +42,14 @@ static void Load_ANIT()
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
if (anim_list[i] == 0) break;
|
if (anim_list[i] == 0) break;
|
||||||
*_animated_tiles.Append() = anim_list[i];
|
_animated_tiles.push_back(anim_list[i]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint count = (uint)SlGetFieldLength() / sizeof(*_animated_tiles.Begin());
|
uint count = (uint)SlGetFieldLength() / sizeof(*_animated_tiles.Begin());
|
||||||
_animated_tiles.clear();
|
_animated_tiles.clear();
|
||||||
_animated_tiles.Append(count);
|
_animated_tiles.resize(_animated_tiles.size() + count);
|
||||||
SlArray(_animated_tiles.Begin(), count, SLE_UINT32);
|
SlArray(_animated_tiles.Begin(), count, SLE_UINT32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,8 @@ static void Load_EIDS()
|
||||||
_engine_mngr.clear();
|
_engine_mngr.clear();
|
||||||
|
|
||||||
while (SlIterateArray() != -1) {
|
while (SlIterateArray() != -1) {
|
||||||
EngineIDMapping *eid = _engine_mngr.Append();
|
/*C++17: EngineIDMapping *eid = &*/ _engine_mngr.emplace_back();
|
||||||
|
EngineIDMapping *eid = &_engine_mngr.back();
|
||||||
SlObject(eid, _engine_id_mapping_desc);
|
SlObject(eid, _engine_id_mapping_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,10 +153,10 @@ static void Load_GSTR()
|
||||||
LanguageStrings *ls = new LanguageStrings(_game_saveload_string != NULL ? _game_saveload_string : "");
|
LanguageStrings *ls = new LanguageStrings(_game_saveload_string != NULL ? _game_saveload_string : "");
|
||||||
for (uint i = 0; i < _game_saveload_strings; i++) {
|
for (uint i = 0; i < _game_saveload_strings; i++) {
|
||||||
SlObject(NULL, _game_language_string);
|
SlObject(NULL, _game_language_string);
|
||||||
*ls->lines.Append() = stredup(_game_saveload_string != NULL ? _game_saveload_string : "");
|
ls->lines.push_back(stredup(_game_saveload_string != NULL ? _game_saveload_string : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
*_current_data->raw_strings.Append() = ls;
|
_current_data->raw_strings.push_back(ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there were no strings in the savegame, set GameStrings to NULL */
|
/* If there were no strings in the savegame, set GameStrings to NULL */
|
||||||
|
|
|
@ -48,7 +48,7 @@ void AfterLoadLabelMaps()
|
||||||
RailType r = GetRailTypeByLabel(_railtype_list[i]);
|
RailType r = GetRailTypeByLabel(_railtype_list[i]);
|
||||||
if (r == INVALID_RAILTYPE) r = RAILTYPE_BEGIN;
|
if (r == INVALID_RAILTYPE) r = RAILTYPE_BEGIN;
|
||||||
|
|
||||||
*railtype_conversion_map.Append() = r;
|
railtype_conversion_map.push_back(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TileIndex t = 0; t < MapSize(); t++) {
|
for (TileIndex t = 0; t < MapSize(); t++) {
|
||||||
|
@ -114,7 +114,7 @@ static void Load_RAIL()
|
||||||
|
|
||||||
while (SlIterateArray() != -1) {
|
while (SlIterateArray() != -1) {
|
||||||
SlObject(&lo, _label_object_desc);
|
SlObject(&lo, _label_object_desc);
|
||||||
*_railtype_list.Append() = (RailTypeLabel)lo.label;
|
_railtype_list.push_back((RailTypeLabel)lo.label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ const SaveLoad *GetLinkGraphJobDesc()
|
||||||
char *&address = reinterpret_cast<char *&>(sl.address);
|
char *&address = reinterpret_cast<char *&>(sl.address);
|
||||||
address -= offset_gamesettings;
|
address -= offset_gamesettings;
|
||||||
address += offset_component;
|
address += offset_component;
|
||||||
*(saveloads.Append()) = sl;
|
saveloads.push_back(sl);
|
||||||
}
|
}
|
||||||
desc = GetSettingDescription(++setting);
|
desc = GetSettingDescription(++setting);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ const SaveLoad *GetLinkGraphJobDesc()
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
do {
|
do {
|
||||||
*(saveloads.Append()) = job_desc[i++];
|
saveloads.push_back(job_desc[i++]);
|
||||||
} while (saveloads[saveloads.size() - 1].cmd != SL_END);
|
} while (saveloads[saveloads.size() - 1].cmd != SL_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ static bool LoadOldAnimTileList(LoadgameState *ls, int num)
|
||||||
/* The first zero in the loaded array indicates the end of the list. */
|
/* The first zero in the loaded array indicates the end of the list. */
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
if (anim_list[i] == 0) break;
|
if (anim_list[i] == 0) break;
|
||||||
*_animated_tiles.Append() = anim_list[i];
|
_animated_tiles.push_back(anim_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -143,7 +143,7 @@ struct MemoryDumper {
|
||||||
/* Are we at the end of this chunk? */
|
/* Are we at the end of this chunk? */
|
||||||
if (this->buf == this->bufe) {
|
if (this->buf == this->bufe) {
|
||||||
this->buf = CallocT<byte>(MEMORY_CHUNK_SIZE);
|
this->buf = CallocT<byte>(MEMORY_CHUNK_SIZE);
|
||||||
*this->blocks.Append() = this->buf;
|
this->blocks.push_back(this->buf);
|
||||||
this->bufe = this->buf + MEMORY_CHUNK_SIZE;
|
this->bufe = this->buf + MEMORY_CHUNK_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,8 @@ static void Load_WAYP()
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
while ((index = SlIterateArray()) != -1) {
|
while ((index = SlIterateArray()) != -1) {
|
||||||
OldWaypoint *wp = _old_waypoints.Append();
|
/*C++17: OldWaypoint *wp = &*/ _old_waypoints.emplace_back();
|
||||||
|
OldWaypoint *wp = &_old_waypoints.back();
|
||||||
memset(wp, 0, sizeof(*wp));
|
memset(wp, 0, sizeof(*wp));
|
||||||
|
|
||||||
wp->index = index;
|
wp->index = index;
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace SQConvert {
|
||||||
sq_getstring(vm, -1, &tmp);
|
sq_getstring(vm, -1, &tmp);
|
||||||
char *tmp_str = stredup(tmp);
|
char *tmp_str = stredup(tmp);
|
||||||
sq_poptop(vm);
|
sq_poptop(vm);
|
||||||
*ptr->Append() = (void *)tmp_str;
|
ptr->push_back((void *)tmp_str);
|
||||||
str_validate(tmp_str, tmp_str + strlen(tmp_str));
|
str_validate(tmp_str, tmp_str + strlen(tmp_str));
|
||||||
return tmp_str;
|
return tmp_str;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ namespace SQConvert {
|
||||||
while (SQ_SUCCEEDED(sq_next(vm, -2))) {
|
while (SQ_SUCCEEDED(sq_next(vm, -2))) {
|
||||||
SQInteger tmp;
|
SQInteger tmp;
|
||||||
if (SQ_SUCCEEDED(sq_getinteger(vm, -1, &tmp))) {
|
if (SQ_SUCCEEDED(sq_getinteger(vm, -1, &tmp))) {
|
||||||
*data.Append() = (int32)tmp;
|
data.push_back((int32)tmp);
|
||||||
} else {
|
} else {
|
||||||
sq_pop(vm, 4);
|
sq_pop(vm, 4);
|
||||||
throw sq_throwerror(vm, "a member of an array used as parameter to a function is not numeric");
|
throw sq_throwerror(vm, "a member of an array used as parameter to a function is not numeric");
|
||||||
|
@ -151,7 +151,7 @@ namespace SQConvert {
|
||||||
arr->size = data.size();
|
arr->size = data.size();
|
||||||
memcpy(arr->array, data.Begin(), sizeof(int32) * data.size());
|
memcpy(arr->array, data.Begin(), sizeof(int32) * data.size());
|
||||||
|
|
||||||
*ptr->Append() = arr;
|
ptr->push_back(arr);
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -727,7 +727,7 @@ static void IniLoadSettingList(IniFile *ini, const char *grpname, StringList *li
|
||||||
list->Clear();
|
list->Clear();
|
||||||
|
|
||||||
for (const IniItem *item = group->item; item != NULL; item = item->next) {
|
for (const IniItem *item = group->item; item != NULL; item = item->next) {
|
||||||
if (item->name != NULL) *list->Append() = stredup(item->name);
|
if (item->name != NULL) list->push_back(stredup(item->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1777,7 +1777,7 @@ void GetGRFPresetList(GRFPresetList *list)
|
||||||
IniGroup *group;
|
IniGroup *group;
|
||||||
for (group = ini->group; group != NULL; group = group->next) {
|
for (group = ini->group; group != NULL; group = group->next) {
|
||||||
if (strncmp(group->name, "preset-", 7) == 0) {
|
if (strncmp(group->name, "preset-", 7) == 0) {
|
||||||
*list->Append() = stredup(group->name + 7);
|
list->push_back(stredup(group->name + 7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ static DropDownList *BuildSetDropDownList(int *selected_index, bool allow_select
|
||||||
|
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
*list->Append() = new DropDownListCharStringItem(T::GetSet(i)->name, i, !allow_selection && (*selected_index != i));
|
list->push_back(new DropDownListCharStringItem(T::GetSet(i)->name, i, !allow_selection && (*selected_index != i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -213,13 +213,13 @@ struct GameOptionsWindow : Window {
|
||||||
/* Add non-custom currencies; sorted naturally */
|
/* Add non-custom currencies; sorted naturally */
|
||||||
for (uint i = 0; i < CURRENCY_END; items++, i++) {
|
for (uint i = 0; i < CURRENCY_END; items++, i++) {
|
||||||
if (i == CURRENCY_CUSTOM) continue;
|
if (i == CURRENCY_CUSTOM) continue;
|
||||||
*list->Append() = new DropDownListStringItem(*items, i, HasBit(disabled, i));
|
list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i)));
|
||||||
}
|
}
|
||||||
QSortT(list->Begin(), list->size(), DropDownListStringItem::NatSortFunc);
|
QSortT(list->Begin(), list->size(), DropDownListStringItem::NatSortFunc);
|
||||||
|
|
||||||
/* Append custom currency at the end */
|
/* Append custom currency at the end */
|
||||||
*list->Append() = new DropDownListItem(-1, false); // separator line
|
list->push_back(new DropDownListItem(-1, false)); // separator line
|
||||||
*list->Append() = new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, CURRENCY_CUSTOM, HasBit(disabled, CURRENCY_CUSTOM));
|
list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, CURRENCY_CUSTOM, HasBit(disabled, CURRENCY_CUSTOM)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ struct GameOptionsWindow : Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||||
*list->Append() = new DropDownListStringItem(*items, i, HasBit(disabled, i));
|
list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -251,20 +251,20 @@ struct GameOptionsWindow : Window {
|
||||||
/* Add and sort newgrf townnames generators */
|
/* Add and sort newgrf townnames generators */
|
||||||
for (int i = 0; i < _nb_grf_names; i++) {
|
for (int i = 0; i < _nb_grf_names; i++) {
|
||||||
int result = _nb_orig_names + i;
|
int result = _nb_orig_names + i;
|
||||||
*list->Append() = new DropDownListStringItem(_grf_names[i], result, enabled_item != result && enabled_item >= 0);
|
list->push_back(new DropDownListStringItem(_grf_names[i], result, enabled_item != result && enabled_item >= 0));
|
||||||
}
|
}
|
||||||
QSortT(list->Begin(), list->size(), DropDownListStringItem::NatSortFunc);
|
QSortT(list->Begin(), list->size(), DropDownListStringItem::NatSortFunc);
|
||||||
|
|
||||||
int newgrf_size = list->size();
|
int newgrf_size = list->size();
|
||||||
/* Insert newgrf_names at the top of the list */
|
/* Insert newgrf_names at the top of the list */
|
||||||
if (newgrf_size > 0) {
|
if (newgrf_size > 0) {
|
||||||
*list->Append() = new DropDownListItem(-1, false); // separator line
|
list->push_back(new DropDownListItem(-1, false)); // separator line
|
||||||
newgrf_size++;
|
newgrf_size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add and sort original townnames generators */
|
/* Add and sort original townnames generators */
|
||||||
for (int i = 0; i < _nb_orig_names; i++) {
|
for (int i = 0; i < _nb_orig_names; i++) {
|
||||||
*list->Append() = new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, enabled_item != i && enabled_item >= 0);
|
list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_TOWN_NAME_ORIGINAL_ENGLISH + i, i, enabled_item != i && enabled_item >= 0));
|
||||||
}
|
}
|
||||||
QSortT(list->Begin() + newgrf_size, list->size() - newgrf_size, DropDownListStringItem::NatSortFunc);
|
QSortT(list->Begin() + newgrf_size, list->size() - newgrf_size, DropDownListStringItem::NatSortFunc);
|
||||||
break;
|
break;
|
||||||
|
@ -275,7 +275,7 @@ struct GameOptionsWindow : Window {
|
||||||
*selected_index = _settings_client.gui.autosave;
|
*selected_index = _settings_client.gui.autosave;
|
||||||
const StringID *items = _autosave_dropdown;
|
const StringID *items = _autosave_dropdown;
|
||||||
for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||||
*list->Append() = new DropDownListStringItem(*items, i, false);
|
list->push_back(new DropDownListStringItem(*items, i, false));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ struct GameOptionsWindow : Window {
|
||||||
list = new DropDownList();
|
list = new DropDownList();
|
||||||
for (uint i = 0; i < _languages.size(); i++) {
|
for (uint i = 0; i < _languages.size(); i++) {
|
||||||
if (&_languages[i] == _current_language) *selected_index = i;
|
if (&_languages[i] == _current_language) *selected_index = i;
|
||||||
*list->Append() = new DropDownListStringItem(SPECSTR_LANGUAGE_START + i, i, false);
|
list->push_back(new DropDownListStringItem(SPECSTR_LANGUAGE_START + i, i, false));
|
||||||
}
|
}
|
||||||
QSortT(list->Begin(), list->size(), DropDownListStringItem::NatSortFunc);
|
QSortT(list->Begin(), list->size(), DropDownListStringItem::NatSortFunc);
|
||||||
break;
|
break;
|
||||||
|
@ -296,7 +296,7 @@ struct GameOptionsWindow : Window {
|
||||||
list = new DropDownList();
|
list = new DropDownList();
|
||||||
*selected_index = GetCurRes();
|
*selected_index = GetCurRes();
|
||||||
for (int i = 0; i < _num_resolutions; i++) {
|
for (int i = 0; i < _num_resolutions; i++) {
|
||||||
*list->Append() = new DropDownListStringItem(SPECSTR_RESOLUTION_START + i, i, false);
|
list->push_back(new DropDownListStringItem(SPECSTR_RESOLUTION_START + i, i, false));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ struct GameOptionsWindow : Window {
|
||||||
*selected_index = ZOOM_LVL_OUT_4X - _gui_zoom;
|
*selected_index = ZOOM_LVL_OUT_4X - _gui_zoom;
|
||||||
const StringID *items = _gui_zoom_dropdown;
|
const StringID *items = _gui_zoom_dropdown;
|
||||||
for (int i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
for (int i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||||
*list->Append() = new DropDownListStringItem(*items, i, _settings_client.gui.zoom_min > ZOOM_LVL_OUT_4X - i);
|
list->push_back(new DropDownListStringItem(*items, i, _settings_client.gui.zoom_min > ZOOM_LVL_OUT_4X - i));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ struct GameOptionsWindow : Window {
|
||||||
*selected_index = ZOOM_LVL_OUT_4X - _font_zoom;
|
*selected_index = ZOOM_LVL_OUT_4X - _font_zoom;
|
||||||
const StringID *items = _font_zoom_dropdown;
|
const StringID *items = _font_zoom_dropdown;
|
||||||
for (int i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
for (int i = 0; *items != INVALID_STRING_ID; items++, i++) {
|
||||||
*list->Append() = new DropDownListStringItem(*items, i, false);
|
list->push_back(new DropDownListStringItem(*items, i, false));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1964,16 +1964,16 @@ struct GameSettingsWindow : Window {
|
||||||
* we don't want to allow comparing with new game's settings. */
|
* we don't want to allow comparing with new game's settings. */
|
||||||
bool disabled = mode == RM_CHANGED_AGAINST_NEW && settings_ptr == &_settings_newgame;
|
bool disabled = mode == RM_CHANGED_AGAINST_NEW && settings_ptr == &_settings_newgame;
|
||||||
|
|
||||||
*list->Append() = new DropDownListStringItem(_game_settings_restrict_dropdown[mode], mode, disabled);
|
list->push_back(new DropDownListStringItem(_game_settings_restrict_dropdown[mode], mode, disabled));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GS_TYPE_DROPDOWN:
|
case WID_GS_TYPE_DROPDOWN:
|
||||||
list = new DropDownList();
|
list = new DropDownList();
|
||||||
*list->Append() = new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL, ST_ALL, false);
|
list->push_back(new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_ALL, ST_ALL, false));
|
||||||
*list->Append() = new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME, ST_GAME, false);
|
list->push_back(new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_GAME_INGAME, ST_GAME, false));
|
||||||
*list->Append() = new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME, ST_COMPANY, false);
|
list->push_back(new DropDownListStringItem(_game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_DROPDOWN_COMPANY_INGAME, ST_COMPANY, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_CLIENT, ST_CLIENT, false);
|
list->push_back(new DropDownListStringItem(STR_CONFIG_SETTING_TYPE_DROPDOWN_CLIENT, ST_CLIENT, false));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -2130,7 +2130,7 @@ struct GameSettingsWindow : Window {
|
||||||
|
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (int i = sdb->min; i <= (int)sdb->max; i++) {
|
for (int i = sdb->min; i <= (int)sdb->max; i++) {
|
||||||
*list->Append() = new DropDownListStringItem(sdb->str_val + i - sdb->min, i, false);
|
list->push_back(new DropDownListStringItem(sdb->str_val + i - sdb->min, i, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowDropDownListAt(this, list, value, -1, wi_rect, COLOUR_ORANGE, true);
|
ShowDropDownListAt(this, list, value, -1, wi_rect, COLOUR_ORANGE, true);
|
||||||
|
|
|
@ -121,9 +121,10 @@ public:
|
||||||
text += stored_size;
|
text += stored_size;
|
||||||
}
|
}
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
OutputBuffer *block = this->output_buffer.Append();
|
/*C++17: OutputBuffer &block =*/ this->output_buffer.emplace_back();
|
||||||
block->Clear(); // Initialize the new block.
|
OutputBuffer &block = this->output_buffer.back();
|
||||||
int stored_size = block->Add(text, length);
|
block.Clear(); // Initialize the new block.
|
||||||
|
int stored_size = block.Add(text, length);
|
||||||
length -= stored_size;
|
length -= stored_size;
|
||||||
text += stored_size;
|
text += stored_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct SignList {
|
||||||
this->signs.clear();
|
this->signs.clear();
|
||||||
|
|
||||||
const Sign *si;
|
const Sign *si;
|
||||||
FOR_ALL_SIGNS(si) *this->signs.Append() = si;
|
FOR_ALL_SIGNS(si) this->signs.push_back(si);
|
||||||
|
|
||||||
this->signs.SetFilterState(true);
|
this->signs.SetFilterState(true);
|
||||||
this->FilterSignList();
|
this->FilterSignList();
|
||||||
|
|
|
@ -942,7 +942,7 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
|
||||||
if (HasBit(GetRailReservationTrackBits(tile_cur), track)) {
|
if (HasBit(GetRailReservationTrackBits(tile_cur), track)) {
|
||||||
Train *v = GetTrainForReservation(tile_cur, track);
|
Train *v = GetTrainForReservation(tile_cur, track);
|
||||||
if (v != NULL) {
|
if (v != NULL) {
|
||||||
*affected_vehicles.Append() = v;
|
affected_vehicles.push_back(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommandCost ret = DoCommand(tile_cur, 0, track, flags, CMD_REMOVE_SINGLE_RAIL);
|
CommandCost ret = DoCommand(tile_cur, 0, track, flags, CMD_REMOVE_SINGLE_RAIL);
|
||||||
|
@ -1386,7 +1386,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
|
||||||
/* Check for trains having a reservation for this tile. */
|
/* Check for trains having a reservation for this tile. */
|
||||||
Train *v = GetTrainForReservation(tile, AxisToTrack(GetRailStationAxis(tile)));
|
Train *v = GetTrainForReservation(tile, AxisToTrack(GetRailStationAxis(tile)));
|
||||||
if (v != NULL) {
|
if (v != NULL) {
|
||||||
*affected_vehicles.Append() = v;
|
affected_vehicles.push_back(v);
|
||||||
FreeTrainReservation(v);
|
FreeTrainReservation(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3538,7 +3538,7 @@ void DeleteStaleLinks(Station *from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found_to || !found_from) continue;
|
if (!found_to || !found_from) continue;
|
||||||
*(vehicles.Append()) = l->GetFirstSharedVehicle();
|
vehicles.push_back(l->GetFirstSharedVehicle());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto iter = vehicles.begin();
|
auto iter = vehicles.begin();
|
||||||
|
|
|
@ -189,14 +189,14 @@ protected:
|
||||||
if (st->goods[j].HasRating()) {
|
if (st->goods[j].HasRating()) {
|
||||||
num_waiting_cargo++; // count number of waiting cargo
|
num_waiting_cargo++; // count number of waiting cargo
|
||||||
if (HasBit(this->cargo_filter, j)) {
|
if (HasBit(this->cargo_filter, j)) {
|
||||||
*this->stations.Append() = st;
|
this->stations.push_back(st);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* stations without waiting cargo */
|
/* stations without waiting cargo */
|
||||||
if (num_waiting_cargo == 0 && this->include_empty) {
|
if (num_waiting_cargo == 0 && this->include_empty) {
|
||||||
*this->stations.Append() = st;
|
this->stations.push_back(st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2135,7 +2135,7 @@ static bool AddNearbyStation(TileIndex tile, void *user_data)
|
||||||
for (uint i = 0; i < _deleted_stations_nearby.size(); i++) {
|
for (uint i = 0; i < _deleted_stations_nearby.size(); i++) {
|
||||||
auto ts = _deleted_stations_nearby.begin() + i;
|
auto ts = _deleted_stations_nearby.begin() + i;
|
||||||
if (ts->tile == tile) {
|
if (ts->tile == tile) {
|
||||||
*_stations_nearby_list.Append() = _deleted_stations_nearby[i].station;
|
_stations_nearby_list.push_back(_deleted_stations_nearby[i].station);
|
||||||
_deleted_stations_nearby.erase(ts);
|
_deleted_stations_nearby.erase(ts);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
@ -2153,7 +2153,7 @@ static bool AddNearbyStation(TileIndex tile, void *user_data)
|
||||||
if (st->owner != _local_company || std::find(_stations_nearby_list.begin(), _stations_nearby_list.end(), sid) != _stations_nearby_list.end()) return false;
|
if (st->owner != _local_company || std::find(_stations_nearby_list.begin(), _stations_nearby_list.end(), sid) != _stations_nearby_list.end()) return false;
|
||||||
|
|
||||||
if (st->rect.BeforeAddRect(ctx->tile, ctx->w, ctx->h, StationRect::ADD_TEST).Succeeded()) {
|
if (st->rect.BeforeAddRect(ctx->tile, ctx->w, ctx->h, StationRect::ADD_TEST).Succeeded()) {
|
||||||
*_stations_nearby_list.Append() = sid;
|
_stations_nearby_list.push_back(sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // We want to include *all* nearby stations
|
return false; // We want to include *all* nearby stations
|
||||||
|
@ -2187,9 +2187,7 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join)
|
||||||
if (T::IsExpected(st) && !st->IsInUse() && st->owner == _local_company) {
|
if (T::IsExpected(st) && !st->IsInUse() && st->owner == _local_company) {
|
||||||
/* Include only within station spread (yes, it is strictly less than) */
|
/* Include only within station spread (yes, it is strictly less than) */
|
||||||
if (max(DistanceMax(ta.tile, st->xy), DistanceMax(TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1), st->xy)) < _settings_game.station.station_spread) {
|
if (max(DistanceMax(ta.tile, st->xy), DistanceMax(TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1), st->xy)) < _settings_game.station.station_spread) {
|
||||||
TileAndStation *ts = _deleted_stations_nearby.Append();
|
_deleted_stations_nearby.push_back({st->xy, st->index});
|
||||||
ts->tile = st->xy;
|
|
||||||
ts->station = st->index;
|
|
||||||
|
|
||||||
/* Add the station when it's within where we're going to build */
|
/* Add the station when it's within where we're going to build */
|
||||||
if (IsInsideBS(TileX(st->xy), TileX(ctx.tile), ctx.w) &&
|
if (IsInsideBS(TileX(st->xy), TileX(ctx.tile), ctx.w) &&
|
||||||
|
|
|
@ -57,7 +57,7 @@ protected:
|
||||||
const StoryPage *p;
|
const StoryPage *p;
|
||||||
FOR_ALL_STORY_PAGES(p) {
|
FOR_ALL_STORY_PAGES(p) {
|
||||||
if (this->IsPageAvailable(p)) {
|
if (this->IsPageAvailable(p)) {
|
||||||
*this->story_pages.Append() = p;
|
this->story_pages.push_back(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ protected:
|
||||||
const StoryPageElement *pe;
|
const StoryPageElement *pe;
|
||||||
FOR_ALL_STORY_PAGE_ELEMENTS(pe) {
|
FOR_ALL_STORY_PAGE_ELEMENTS(pe) {
|
||||||
if (pe->page == p->index) {
|
if (pe->page == p->index) {
|
||||||
*this->story_page_elements.Append() = pe;
|
this->story_page_elements.push_back(pe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ protected:
|
||||||
item = str_item;
|
item = str_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
*list->Append() = item;
|
list->push_back(item);
|
||||||
page_num++;
|
page_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ struct Buffer : SmallVector<byte, 256> {
|
||||||
*/
|
*/
|
||||||
void AppendByte(byte value)
|
void AppendByte(byte value)
|
||||||
{
|
{
|
||||||
*this->Append() = value;
|
this->push_back(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,19 +252,19 @@ struct Buffer : SmallVector<byte, 256> {
|
||||||
void AppendUtf8(uint32 value)
|
void AppendUtf8(uint32 value)
|
||||||
{
|
{
|
||||||
if (value < 0x80) {
|
if (value < 0x80) {
|
||||||
*this->Append() = value;
|
this->push_back(value);
|
||||||
} else if (value < 0x800) {
|
} else if (value < 0x800) {
|
||||||
*this->Append() = 0xC0 + GB(value, 6, 5);
|
this->push_back(0xC0 + GB(value, 6, 5));
|
||||||
*this->Append() = 0x80 + GB(value, 0, 6);
|
this->push_back(0x80 + GB(value, 0, 6));
|
||||||
} else if (value < 0x10000) {
|
} else if (value < 0x10000) {
|
||||||
*this->Append() = 0xE0 + GB(value, 12, 4);
|
this->push_back(0xE0 + GB(value, 12, 4));
|
||||||
*this->Append() = 0x80 + GB(value, 6, 6);
|
this->push_back(0x80 + GB(value, 6, 6));
|
||||||
*this->Append() = 0x80 + GB(value, 0, 6);
|
this->push_back(0x80 + GB(value, 0, 6));
|
||||||
} else if (value < 0x110000) {
|
} else if (value < 0x110000) {
|
||||||
*this->Append() = 0xF0 + GB(value, 18, 3);
|
this->push_back(0xF0 + GB(value, 18, 3));
|
||||||
*this->Append() = 0x80 + GB(value, 12, 6);
|
this->push_back(0x80 + GB(value, 12, 6));
|
||||||
*this->Append() = 0x80 + GB(value, 6, 6);
|
this->push_back(0x80 + GB(value, 6, 6));
|
||||||
*this->Append() = 0x80 + GB(value, 0, 6);
|
this->push_back(0x80 + GB(value, 0, 6));
|
||||||
} else {
|
} else {
|
||||||
strgen_warning("Invalid unicode value U+0x%X", value);
|
strgen_warning("Invalid unicode value U+0x%X", value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -634,8 +634,8 @@ public:
|
||||||
this->char_itr = icu::BreakIterator::createCharacterInstance(icu::Locale(_current_language != NULL ? _current_language->isocode : "en"), status);
|
this->char_itr = icu::BreakIterator::createCharacterInstance(icu::Locale(_current_language != NULL ? _current_language->isocode : "en"), status);
|
||||||
this->word_itr = icu::BreakIterator::createWordInstance(icu::Locale(_current_language != NULL ? _current_language->isocode : "en"), status);
|
this->word_itr = icu::BreakIterator::createWordInstance(icu::Locale(_current_language != NULL ? _current_language->isocode : "en"), status);
|
||||||
|
|
||||||
*this->utf16_str.Append() = '\0';
|
this->utf16_str.push_back('\0');
|
||||||
*this->utf16_to_utf8.Append() = 0;
|
this->utf16_to_utf8.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~IcuStringIterator()
|
virtual ~IcuStringIterator()
|
||||||
|
@ -660,17 +660,17 @@ public:
|
||||||
|
|
||||||
WChar c = Utf8Consume(&s);
|
WChar c = Utf8Consume(&s);
|
||||||
if (c < 0x10000) {
|
if (c < 0x10000) {
|
||||||
*this->utf16_str.Append() = (UChar)c;
|
this->utf16_str.push_back((UChar)c);
|
||||||
} else {
|
} else {
|
||||||
/* Make a surrogate pair. */
|
/* Make a surrogate pair. */
|
||||||
*this->utf16_str.Append() = (UChar)(0xD800 + ((c - 0x10000) >> 10));
|
this->utf16_str.push_back((UChar)(0xD800 + ((c - 0x10000) >> 10)));
|
||||||
*this->utf16_str.Append() = (UChar)(0xDC00 + ((c - 0x10000) & 0x3FF));
|
this->utf16_str.push_back((UChar)(0xDC00 + ((c - 0x10000) & 0x3FF)));
|
||||||
*this->utf16_to_utf8.Append() = idx;
|
this->utf16_to_utf8.push_back(idx);
|
||||||
}
|
}
|
||||||
*this->utf16_to_utf8.Append() = idx;
|
this->utf16_to_utf8.push_back(idx);
|
||||||
}
|
}
|
||||||
*this->utf16_str.Append() = '\0';
|
this->utf16_str.push_back('\0');
|
||||||
*this->utf16_to_utf8.Append() = s - string_base;
|
this->utf16_to_utf8.push_back(s - string_base);
|
||||||
|
|
||||||
UText text = UTEXT_INITIALIZER;
|
UText text = UTEXT_INITIALIZER;
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
|
|
|
@ -76,9 +76,8 @@ void StringFilter::SetFilterTerm(const char *str)
|
||||||
|
|
||||||
/* Add to word */
|
/* Add to word */
|
||||||
if (word == NULL) {
|
if (word == NULL) {
|
||||||
word = this->word_index.Append();
|
/*C++17: word = &*/ this->word_index.push_back({dest, false});
|
||||||
word->start = dest;
|
word = &this->word_index.back();
|
||||||
word->match = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(dest, pos, len);
|
memcpy(dest, pos, len);
|
||||||
|
|
|
@ -1932,7 +1932,7 @@ static void GetLanguageList(const char *path)
|
||||||
} else if (GetLanguage(lmd.newgrflangid) != NULL) {
|
} else if (GetLanguage(lmd.newgrflangid) != NULL) {
|
||||||
DEBUG(misc, 3, "%s's language ID is already known", lmd.file);
|
DEBUG(misc, 3, "%s's language ID is already known", lmd.file);
|
||||||
} else {
|
} else {
|
||||||
*_languages.Append() = lmd;
|
_languages.push_back(lmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
|
@ -48,20 +48,20 @@ TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, Text
|
||||||
for (i = 0; i < _text_effects.size(); i++) {
|
for (i = 0; i < _text_effects.size(); i++) {
|
||||||
if (_text_effects[i].string_id == INVALID_STRING_ID) break;
|
if (_text_effects[i].string_id == INVALID_STRING_ID) break;
|
||||||
}
|
}
|
||||||
if (i == _text_effects.size()) _text_effects.Append();
|
if (i == _text_effects.size()) _text_effects.emplace_back();
|
||||||
|
|
||||||
TextEffect *te = _text_effects.data() + i;
|
TextEffect &te = _text_effects[i];
|
||||||
|
|
||||||
/* Start defining this object */
|
/* Start defining this object */
|
||||||
te->string_id = msg;
|
te.string_id = msg;
|
||||||
te->duration = duration;
|
te.duration = duration;
|
||||||
te->params_1 = GetDParam(0);
|
te.params_1 = GetDParam(0);
|
||||||
te->params_2 = GetDParam(1);
|
te.params_2 = GetDParam(1);
|
||||||
te->mode = mode;
|
te.mode = mode;
|
||||||
|
|
||||||
/* Make sure we only dirty the new area */
|
/* Make sure we only dirty the new area */
|
||||||
te->width_normal = 0;
|
te.width_normal = 0;
|
||||||
te->UpdatePosition(center, y, msg);
|
te.UpdatePosition(center, y, msg);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,11 +365,11 @@ static void Xunzip(byte **bufp, size_t *sizep)
|
||||||
str_validate(p, this->text + filesize, SVS_REPLACE_WITH_QUESTION_MARK | SVS_ALLOW_NEWLINE);
|
str_validate(p, this->text + filesize, SVS_REPLACE_WITH_QUESTION_MARK | SVS_ALLOW_NEWLINE);
|
||||||
|
|
||||||
/* Split the string on newlines. */
|
/* Split the string on newlines. */
|
||||||
*this->lines.Append() = p;
|
this->lines.push_back(p);
|
||||||
for (; *p != '\0'; p++) {
|
for (; *p != '\0'; p++) {
|
||||||
if (*p == '\n') {
|
if (*p == '\n') {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
*this->lines.Append() = p + 1;
|
this->lines.push_back(p + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,10 +285,10 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
|
|
||||||
if (timetable_all) {
|
if (timetable_all) {
|
||||||
for (Vehicle *w = v->orders.list->GetFirstSharedVehicle(); w != NULL; w = w->NextShared()) {
|
for (Vehicle *w = v->orders.list->GetFirstSharedVehicle(); w != NULL; w = w->NextShared()) {
|
||||||
*vehs.Append() = w;
|
vehs.push_back(w);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*vehs.Append() = v;
|
vehs.push_back(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
int total_duration = v->orders.list->GetTimetableTotalDuration();
|
int total_duration = v->orders.list->GetTimetableTotalDuration();
|
||||||
|
|
|
@ -198,7 +198,7 @@ static void PopupMainToolbMenu(Window *w, int widget, StringID string, int count
|
||||||
{
|
{
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
*list->Append() = new DropDownListStringItem(string + i, i, false);
|
list->push_back(new DropDownListStringItem(string + i, i, false));
|
||||||
}
|
}
|
||||||
PopupMainToolbMenu(w, widget, list, 0);
|
PopupMainToolbMenu(w, widget, list, 0);
|
||||||
}
|
}
|
||||||
|
@ -224,27 +224,27 @@ static void PopupMainCompanyToolbMenu(Window *w, int widget, int grey = 0)
|
||||||
if (!_networking) break;
|
if (!_networking) break;
|
||||||
|
|
||||||
/* Add the client list button for the companies menu */
|
/* Add the client list button for the companies menu */
|
||||||
*list->Append() = new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_CLIENT_LIST, CTMN_CLIENT_LIST, false);
|
list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_CLIENT_LIST, CTMN_CLIENT_LIST, false));
|
||||||
|
|
||||||
if (_local_company == COMPANY_SPECTATOR) {
|
if (_local_company == COMPANY_SPECTATOR) {
|
||||||
*list->Append() = new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_NEW_COMPANY, CTMN_NEW_COMPANY, NetworkMaxCompaniesReached());
|
list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_NEW_COMPANY, CTMN_NEW_COMPANY, NetworkMaxCompaniesReached()));
|
||||||
} else {
|
} else {
|
||||||
*list->Append() = new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_SPECTATE, CTMN_SPECTATE, NetworkMaxSpectatorsReached());
|
list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_SPECTATE, CTMN_SPECTATE, NetworkMaxSpectatorsReached()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_TN_STORY:
|
case WID_TN_STORY:
|
||||||
*list->Append() = new DropDownListStringItem(STR_STORY_BOOK_SPECTATOR, CTMN_SPECTATOR, false);
|
list->push_back(new DropDownListStringItem(STR_STORY_BOOK_SPECTATOR, CTMN_SPECTATOR, false));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_TN_GOAL:
|
case WID_TN_GOAL:
|
||||||
*list->Append() = new DropDownListStringItem(STR_GOALS_SPECTATOR, CTMN_SPECTATOR, false);
|
list->push_back(new DropDownListStringItem(STR_GOALS_SPECTATOR, CTMN_SPECTATOR, false));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
|
||||||
if (!Company::IsValidID(c)) continue;
|
if (!Company::IsValidID(c)) continue;
|
||||||
*list->Append() = new DropDownListCompanyItem(c, false, HasBit(grey, c));
|
list->push_back(new DropDownListCompanyItem(c, false, HasBit(grey, c)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupMainToolbMenu(w, widget, list, _local_company == COMPANY_SPECTATOR ? (widget == WID_TN_COMPANIES ? CTMN_CLIENT_LIST : CTMN_SPECTATOR) : (int)_local_company);
|
PopupMainToolbMenu(w, widget, list, _local_company == COMPANY_SPECTATOR ? (widget == WID_TN_COMPANIES ? CTMN_CLIENT_LIST : CTMN_SPECTATOR) : (int)_local_company);
|
||||||
|
@ -318,24 +318,24 @@ enum OptionMenuEntries {
|
||||||
static CallBackFunction ToolbarOptionsClick(Window *w)
|
static CallBackFunction ToolbarOptionsClick(Window *w)
|
||||||
{
|
{
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
*list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_GAME_OPTIONS, OME_GAMEOPTIONS, false);
|
list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_GAME_OPTIONS, OME_GAMEOPTIONS, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_CONFIG_SETTINGS_TREE, OME_SETTINGS, false);
|
list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_CONFIG_SETTINGS_TREE, OME_SETTINGS, false));
|
||||||
/* Changes to the per-AI settings don't get send from the server to the clients. Clients get
|
/* Changes to the per-AI settings don't get send from the server to the clients. Clients get
|
||||||
* the settings once they join but never update it. As such don't show the window at all
|
* the settings once they join but never update it. As such don't show the window at all
|
||||||
* to network clients. */
|
* to network clients. */
|
||||||
if (!_networking || _network_server) *list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_SCRIPT_SETTINGS, OME_SCRIPT_SETTINGS, false);
|
if (!_networking || _network_server) list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_SCRIPT_SETTINGS, OME_SCRIPT_SETTINGS, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_NEWGRF_SETTINGS, OME_NEWGRFSETTINGS, false);
|
list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_NEWGRF_SETTINGS, OME_NEWGRFSETTINGS, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS, OME_TRANSPARENCIES, false);
|
list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS, OME_TRANSPARENCIES, false));
|
||||||
*list->Append() = new DropDownListItem(-1, false);
|
list->push_back(new DropDownListItem(-1, false));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_TOWN_NAMES_DISPLAYED, OME_SHOW_TOWNNAMES, false, HasBit(_display_opt, DO_SHOW_TOWN_NAMES));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TOWN_NAMES_DISPLAYED, OME_SHOW_TOWNNAMES, false, HasBit(_display_opt, DO_SHOW_TOWN_NAMES)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_STATION_NAMES_DISPLAYED, OME_SHOW_STATIONNAMES, false, HasBit(_display_opt, DO_SHOW_STATION_NAMES));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_STATION_NAMES_DISPLAYED, OME_SHOW_STATIONNAMES, false, HasBit(_display_opt, DO_SHOW_STATION_NAMES)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_WAYPOINTS_DISPLAYED, OME_SHOW_WAYPOINTNAMES, false, HasBit(_display_opt, DO_SHOW_WAYPOINT_NAMES));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_WAYPOINTS_DISPLAYED, OME_SHOW_WAYPOINTNAMES, false, HasBit(_display_opt, DO_SHOW_WAYPOINT_NAMES)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_SIGNS_DISPLAYED, OME_SHOW_SIGNS, false, HasBit(_display_opt, DO_SHOW_SIGNS));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_SIGNS_DISPLAYED, OME_SHOW_SIGNS, false, HasBit(_display_opt, DO_SHOW_SIGNS)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_SHOW_COMPETITOR_SIGNS, OME_SHOW_COMPETITOR_SIGNS, false, HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_SHOW_COMPETITOR_SIGNS, OME_SHOW_COMPETITOR_SIGNS, false, HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_ANIMATION, OME_FULL_ANIMATION, false, HasBit(_display_opt, DO_FULL_ANIMATION));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_ANIMATION, OME_FULL_ANIMATION, false, HasBit(_display_opt, DO_FULL_ANIMATION)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_DETAIL, OME_FULL_DETAILS, false, HasBit(_display_opt, DO_FULL_DETAIL));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_DETAIL, OME_FULL_DETAILS, false, HasBit(_display_opt, DO_FULL_DETAIL)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_BUILDINGS, OME_TRANSPARENTBUILDINGS, false, IsTransparencySet(TO_HOUSES));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_BUILDINGS, OME_TRANSPARENTBUILDINGS, false, IsTransparencySet(TO_HOUSES)));
|
||||||
*list->Append() = new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_SIGNS, OME_SHOW_STATIONSIGNS, false, IsTransparencySet(TO_SIGNS));
|
list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_SIGNS, OME_SHOW_STATIONSIGNS, false, IsTransparencySet(TO_SIGNS)));
|
||||||
|
|
||||||
ShowDropDownList(w, list, 0, WID_TN_SETTINGS, 140, true, true);
|
ShowDropDownList(w, list, 0, WID_TN_SETTINGS, 140, true, true);
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
|
@ -464,10 +464,10 @@ enum MapMenuEntries {
|
||||||
static CallBackFunction ToolbarMapClick(Window *w)
|
static CallBackFunction ToolbarMapClick(Window *w)
|
||||||
{
|
{
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
*list->Append() = new DropDownListStringItem(STR_MAP_MENU_MAP_OF_WORLD, MME_SHOW_SMALLMAP, false);
|
list->push_back(new DropDownListStringItem(STR_MAP_MENU_MAP_OF_WORLD, MME_SHOW_SMALLMAP, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_MAP_MENU_EXTRA_VIEW_PORT, MME_SHOW_EXTRAVIEWPORTS, false);
|
list->push_back(new DropDownListStringItem(STR_MAP_MENU_EXTRA_VIEW_PORT, MME_SHOW_EXTRAVIEWPORTS, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_MAP_MENU_LINGRAPH_LEGEND, MME_SHOW_LINKGRAPH, false);
|
list->push_back(new DropDownListStringItem(STR_MAP_MENU_LINGRAPH_LEGEND, MME_SHOW_LINKGRAPH, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_MAP_MENU_SIGN_LIST, MME_SHOW_SIGNLISTS, false);
|
list->push_back(new DropDownListStringItem(STR_MAP_MENU_SIGN_LIST, MME_SHOW_SIGNLISTS, false));
|
||||||
PopupMainToolbMenu(w, WID_TN_SMALL_MAP, list, 0);
|
PopupMainToolbMenu(w, WID_TN_SMALL_MAP, list, 0);
|
||||||
return CBF_NONE;
|
return CBF_NONE;
|
||||||
}
|
}
|
||||||
|
@ -475,11 +475,11 @@ static CallBackFunction ToolbarMapClick(Window *w)
|
||||||
static CallBackFunction ToolbarScenMapTownDir(Window *w)
|
static CallBackFunction ToolbarScenMapTownDir(Window *w)
|
||||||
{
|
{
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
*list->Append() = new DropDownListStringItem(STR_MAP_MENU_MAP_OF_WORLD, MME_SHOW_SMALLMAP, false);
|
list->push_back(new DropDownListStringItem(STR_MAP_MENU_MAP_OF_WORLD, MME_SHOW_SMALLMAP, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_MAP_MENU_EXTRA_VIEW_PORT, MME_SHOW_EXTRAVIEWPORTS, false);
|
list->push_back(new DropDownListStringItem(STR_MAP_MENU_EXTRA_VIEW_PORT, MME_SHOW_EXTRAVIEWPORTS, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_MAP_MENU_SIGN_LIST, MME_SHOW_SIGNLISTS, false);
|
list->push_back(new DropDownListStringItem(STR_MAP_MENU_SIGN_LIST, MME_SHOW_SIGNLISTS, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_TOWN_MENU_TOWN_DIRECTORY, MME_SHOW_TOWNDIRECTORY, false);
|
list->push_back(new DropDownListStringItem(STR_TOWN_MENU_TOWN_DIRECTORY, MME_SHOW_TOWNDIRECTORY, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_INDUSTRY_MENU_INDUSTRY_DIRECTORY, MME_SHOW_INDUSTRYDIRECTORY, false);
|
list->push_back(new DropDownListStringItem(STR_INDUSTRY_MENU_INDUSTRY_DIRECTORY, MME_SHOW_INDUSTRYDIRECTORY, false));
|
||||||
PopupMainToolbMenu(w, WID_TE_SMALL_MAP, list, 0);
|
PopupMainToolbMenu(w, WID_TE_SMALL_MAP, list, 0);
|
||||||
return CBF_NONE;
|
return CBF_NONE;
|
||||||
}
|
}
|
||||||
|
@ -897,7 +897,7 @@ static CallBackFunction ToolbarBuildRoadClick(Window *w)
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
|
|
||||||
/* Road is always visible and available. */
|
/* Road is always visible and available. */
|
||||||
*list->Append() = new DropDownListIconItem(SPR_IMG_ROAD_X_DIR, PAL_NONE, STR_ROAD_MENU_ROAD_CONSTRUCTION, ROADTYPE_ROAD, false);
|
list->push_back(new DropDownListIconItem(SPR_IMG_ROAD_X_DIR, PAL_NONE, STR_ROAD_MENU_ROAD_CONSTRUCTION, ROADTYPE_ROAD, false));
|
||||||
|
|
||||||
/* Tram is only visible when there will be a tram, and available when that has been introduced. */
|
/* Tram is only visible when there will be a tram, and available when that has been introduced. */
|
||||||
Engine *e;
|
Engine *e;
|
||||||
|
@ -905,7 +905,7 @@ static CallBackFunction ToolbarBuildRoadClick(Window *w)
|
||||||
if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
|
if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
|
||||||
if (!HasBit(e->info.misc_flags, EF_ROAD_TRAM)) continue;
|
if (!HasBit(e->info.misc_flags, EF_ROAD_TRAM)) continue;
|
||||||
|
|
||||||
*list->Append() = new DropDownListIconItem(SPR_IMG_TRAMWAY_X_DIR, PAL_NONE, STR_ROAD_MENU_TRAM_CONSTRUCTION, ROADTYPE_TRAM, !HasBit(c->avail_roadtypes, ROADTYPE_TRAM));
|
list->push_back(new DropDownListIconItem(SPR_IMG_TRAMWAY_X_DIR, PAL_NONE, STR_ROAD_MENU_TRAM_CONSTRUCTION, ROADTYPE_TRAM, !HasBit(c->avail_roadtypes, ROADTYPE_TRAM)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ShowDropDownList(w, list, _last_built_roadtype, WID_TN_ROADS, 140, true, true);
|
ShowDropDownList(w, list, _last_built_roadtype, WID_TN_ROADS, 140, true, true);
|
||||||
|
|
|
@ -654,7 +654,7 @@ private:
|
||||||
|
|
||||||
const Town *t;
|
const Town *t;
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
*this->towns.Append() = t;
|
this->towns.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->towns.shrink_to_fit();
|
this->towns.shrink_to_fit();
|
||||||
|
|
|
@ -823,7 +823,7 @@ typedef SmallVector<Train *, 16> TrainList;
|
||||||
*/
|
*/
|
||||||
static void MakeTrainBackup(TrainList &list, Train *t)
|
static void MakeTrainBackup(TrainList &list, Train *t)
|
||||||
{
|
{
|
||||||
for (; t != NULL; t = t->Next()) *list.Append() = t;
|
for (; t != NULL; t = t->Next()) list.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -280,7 +280,8 @@ static void GetCargoSummaryOfArticulatedVehicle(const Train *v, CargoSummary *su
|
||||||
|
|
||||||
CargoSummaryItem *item = &*std::find(summary->begin(), summary->end(), new_item);
|
CargoSummaryItem *item = &*std::find(summary->begin(), summary->end(), new_item);
|
||||||
if (item == summary->End()) {
|
if (item == summary->End()) {
|
||||||
item = summary->Append();
|
/*C++17: item = &*/ summary->emplace_back();
|
||||||
|
item = &summary->back();
|
||||||
item->cargo = new_item.cargo;
|
item->cargo = new_item.cargo;
|
||||||
item->subtype = new_item.subtype;
|
item->subtype = new_item.subtype;
|
||||||
item->capacity = 0;
|
item->capacity = 0;
|
||||||
|
|
|
@ -681,9 +681,8 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
|
||||||
* Do this for all tiles (like trees), not only objects. */
|
* Do this for all tiles (like trees), not only objects. */
|
||||||
ClearedObjectArea *coa = FindClearedObject(end_tile);
|
ClearedObjectArea *coa = FindClearedObject(end_tile);
|
||||||
if (coa == NULL) {
|
if (coa == NULL) {
|
||||||
coa = _cleared_object_areas.Append();
|
/*C++17: coa = &*/ _cleared_object_areas.push_back({end_tile, TileArea(end_tile, 1, 1)});
|
||||||
coa->first_tile = end_tile;
|
coa = &_cleared_object_areas.back();
|
||||||
coa->area = TileArea(end_tile, 1, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hide the tile from the terraforming command */
|
/* Hide the tile from the terraforming command */
|
||||||
|
|
|
@ -2283,9 +2283,7 @@ void Vehicle::GetConsistFreeCapacities(SmallMap<CargoID, uint> &capacities) cons
|
||||||
if (v->cargo_cap == 0) continue;
|
if (v->cargo_cap == 0) continue;
|
||||||
SmallPair<CargoID, uint> *pair = capacities.Find(v->cargo_type);
|
SmallPair<CargoID, uint> *pair = capacities.Find(v->cargo_type);
|
||||||
if (pair == capacities.End()) {
|
if (pair == capacities.End()) {
|
||||||
pair = capacities.Append();
|
capacities.push_back({v->cargo_type, v->cargo_cap - v->cargo.StoredCount()});
|
||||||
pair->first = v->cargo_type;
|
|
||||||
pair->second = v->cargo_cap - v->cargo.StoredCount();
|
|
||||||
} else {
|
} else {
|
||||||
pair->second += v->cargo_cap - v->cargo.StoredCount();
|
pair->second += v->cargo_cap - v->cargo.StoredCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,11 +417,7 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||||
* - We have to call the refit cost callback with the pre-refit configuration of the chain because we want refit and
|
* - We have to call the refit cost callback with the pre-refit configuration of the chain because we want refit and
|
||||||
* autorefit to behave the same, and we need its result for auto_refit_allowed.
|
* autorefit to behave the same, and we need its result for auto_refit_allowed.
|
||||||
*/
|
*/
|
||||||
RefitResult *result = refit_result.Append();
|
refit_result.push_back({v, amount, mail_capacity, actual_subtype});
|
||||||
result->v = v;
|
|
||||||
result->capacity = amount;
|
|
||||||
result->mail_capacity = mail_capacity;
|
|
||||||
result->subtype = actual_subtype;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
|
|
@ -168,13 +168,13 @@ DropDownList *BaseVehicleListWindow::BuildActionDropdownList(bool show_autorepla
|
||||||
{
|
{
|
||||||
DropDownList *list = new DropDownList();
|
DropDownList *list = new DropDownList();
|
||||||
|
|
||||||
if (show_autoreplace) *list->Append() = new DropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, ADI_REPLACE, false);
|
if (show_autoreplace) list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, ADI_REPLACE, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, ADI_SERVICE, false);
|
list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_SEND_FOR_SERVICING, ADI_SERVICE, false));
|
||||||
*list->Append() = new DropDownListStringItem(this->vehicle_depot_name[this->vli.vtype], ADI_DEPOT, false);
|
list->push_back(new DropDownListStringItem(this->vehicle_depot_name[this->vli.vtype], ADI_DEPOT, false));
|
||||||
|
|
||||||
if (show_group) {
|
if (show_group) {
|
||||||
*list->Append() = new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, ADI_ADD_SHARED, false);
|
list->push_back(new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, ADI_ADD_SHARED, false));
|
||||||
*list->Append() = new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, ADI_REMOVE_ALL, false);
|
list->push_back(new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, ADI_REMOVE_ALL, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -438,10 +438,7 @@ struct RefitWindow : public Window {
|
||||||
bool first_vehicle = this->list[current_index].size() == 0;
|
bool first_vehicle = this->list[current_index].size() == 0;
|
||||||
if (first_vehicle) {
|
if (first_vehicle) {
|
||||||
/* Keeping the current subtype is always an option. It also serves as the option in case of no subtypes */
|
/* Keeping the current subtype is always an option. It also serves as the option in case of no subtypes */
|
||||||
RefitOption *option = this->list[current_index].Append();
|
this->list[current_index].push_back({cid, 0xFF, STR_EMPTY});
|
||||||
option->cargo = cid;
|
|
||||||
option->subtype = 0xFF;
|
|
||||||
option->string = STR_EMPTY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the vehicle's callback mask for cargo suffixes.
|
/* Check the vehicle's callback mask for cargo suffixes.
|
||||||
|
|
|
@ -85,7 +85,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
|
||||||
if (t->IsArticulatedPart() || t->IsRearDualheaded()) continue;
|
if (t->IsArticulatedPart() || t->IsRearDualheaded()) continue;
|
||||||
if (t->track != TRACK_BIT_DEPOT) continue;
|
if (t->track != TRACK_BIT_DEPOT) continue;
|
||||||
if (wagons != NULL && t->First()->IsFreeWagon()) {
|
if (wagons != NULL && t->First()->IsFreeWagon()) {
|
||||||
if (individual_wagons || t->IsFreeWagon()) *wagons->Append() = t;
|
if (individual_wagons || t->IsFreeWagon()) wagons->push_back(t);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -98,7 +98,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine
|
||||||
|
|
||||||
if (!v->IsPrimaryVehicle()) continue;
|
if (!v->IsPrimaryVehicle()) continue;
|
||||||
|
|
||||||
*engines->Append() = v;
|
engines->push_back(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure the lists are not wasting too much space. If the lists are fresh
|
/* Ensure the lists are not wasting too much space. If the lists are fresh
|
||||||
|
@ -128,7 +128,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT))
|
if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT))
|
||||||
&& order->GetDestination() == vli.index) {
|
&& order->GetDestination() == vli.index) {
|
||||||
*list->Append() = v;
|
list->push_back(v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||||
if (v == NULL || v->type != vli.vtype || !v->IsPrimaryVehicle()) return false;
|
if (v == NULL || v->type != vli.vtype || !v->IsPrimaryVehicle()) return false;
|
||||||
|
|
||||||
for (; v != NULL; v = v->NextShared()) {
|
for (; v != NULL; v = v->NextShared()) {
|
||||||
*list->Append() = v;
|
list->push_back(v);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (v->type == vli.vtype && v->IsPrimaryVehicle() &&
|
if (v->type == vli.vtype && v->IsPrimaryVehicle() &&
|
||||||
v->owner == vli.company && GroupIsInGroup(v->group_id, vli.index)) {
|
v->owner == vli.company && GroupIsInGroup(v->group_id, vli.index)) {
|
||||||
*list->Append() = v;
|
list->push_back(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -161,7 +161,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||||
case VL_STANDARD:
|
case VL_STANDARD:
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (v->type == vli.vtype && v->owner == vli.company && v->IsPrimaryVehicle()) {
|
if (v->type == vli.vtype && v->owner == vli.company && v->IsPrimaryVehicle()) {
|
||||||
*list->Append() = v;
|
list->push_back(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -173,7 +173,7 @@ bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if (order->IsType(OT_GOTO_DEPOT) && !(order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) && order->GetDestination() == vli.index) {
|
if (order->IsType(OT_GOTO_DEPOT) && !(order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) && order->GetDestination() == vli.index) {
|
||||||
*list->Append() = v;
|
list->push_back(v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,13 +499,14 @@ static void AddTileSpriteToDraw(SpriteID image, PaletteID pal, int32 x, int32 y,
|
||||||
{
|
{
|
||||||
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
||||||
|
|
||||||
TileSpriteToDraw *ts = _vd.tile_sprites_to_draw.Append();
|
/*C++17: TileSpriteToDraw &ts = */ _vd.tile_sprites_to_draw.emplace_back();
|
||||||
ts->image = image;
|
TileSpriteToDraw &ts = _vd.tile_sprites_to_draw.back();
|
||||||
ts->pal = pal;
|
ts.image = image;
|
||||||
ts->sub = sub;
|
ts.pal = pal;
|
||||||
|
ts.sub = sub;
|
||||||
Point pt = RemapCoords(x, y, z);
|
Point pt = RemapCoords(x, y, z);
|
||||||
ts->x = pt.x + extra_offs_x;
|
ts.x = pt.x + extra_offs_x;
|
||||||
ts->y = pt.y + extra_offs_y;
|
ts.y = pt.y + extra_offs_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -708,29 +709,30 @@ void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParentSpriteToDraw *ps = _vd.parent_sprites_to_draw.Append();
|
/*C++17: ParentSpriteToDraw &ps = */ _vd.parent_sprites_to_draw.emplace_back();
|
||||||
ps->x = tmp_x;
|
ParentSpriteToDraw &ps = _vd.parent_sprites_to_draw.back();
|
||||||
ps->y = tmp_y;
|
ps.x = tmp_x;
|
||||||
|
ps.y = tmp_y;
|
||||||
|
|
||||||
ps->left = tmp_left;
|
ps.left = tmp_left;
|
||||||
ps->top = tmp_top;
|
ps.top = tmp_top;
|
||||||
|
|
||||||
ps->image = image;
|
ps.image = image;
|
||||||
ps->pal = pal;
|
ps.pal = pal;
|
||||||
ps->sub = sub;
|
ps.sub = sub;
|
||||||
ps->xmin = x + bb_offset_x;
|
ps.xmin = x + bb_offset_x;
|
||||||
ps->xmax = x + max(bb_offset_x, w) - 1;
|
ps.xmax = x + max(bb_offset_x, w) - 1;
|
||||||
|
|
||||||
ps->ymin = y + bb_offset_y;
|
ps.ymin = y + bb_offset_y;
|
||||||
ps->ymax = y + max(bb_offset_y, h) - 1;
|
ps.ymax = y + max(bb_offset_y, h) - 1;
|
||||||
|
|
||||||
ps->zmin = z + bb_offset_z;
|
ps.zmin = z + bb_offset_z;
|
||||||
ps->zmax = z + max(bb_offset_z, dz) - 1;
|
ps.zmax = z + max(bb_offset_z, dz) - 1;
|
||||||
|
|
||||||
ps->comparison_done = false;
|
ps.comparison_done = false;
|
||||||
ps->first_child = -1;
|
ps.first_child = -1;
|
||||||
|
|
||||||
_vd.last_child = &ps->first_child;
|
_vd.last_child = &ps.first_child;
|
||||||
|
|
||||||
if (_vd.combine_sprites == SPRITE_COMBINE_PENDING) _vd.combine_sprites = SPRITE_COMBINE_ACTIVE;
|
if (_vd.combine_sprites == SPRITE_COMBINE_PENDING) _vd.combine_sprites = SPRITE_COMBINE_ACTIVE;
|
||||||
}
|
}
|
||||||
|
@ -826,33 +828,35 @@ void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool tran
|
||||||
|
|
||||||
*_vd.last_child = _vd.child_screen_sprites_to_draw.size();
|
*_vd.last_child = _vd.child_screen_sprites_to_draw.size();
|
||||||
|
|
||||||
ChildScreenSpriteToDraw *cs = _vd.child_screen_sprites_to_draw.Append();
|
/*C++17: ChildScreenSpriteToDraw &cs = */ _vd.child_screen_sprites_to_draw.emplace_back();
|
||||||
cs->image = image;
|
ChildScreenSpriteToDraw &cs = _vd.child_screen_sprites_to_draw.back();
|
||||||
cs->pal = pal;
|
cs.image = image;
|
||||||
cs->sub = sub;
|
cs.pal = pal;
|
||||||
cs->x = scale ? x * ZOOM_LVL_BASE : x;
|
cs.sub = sub;
|
||||||
cs->y = scale ? y * ZOOM_LVL_BASE : y;
|
cs.x = scale ? x * ZOOM_LVL_BASE : x;
|
||||||
cs->next = -1;
|
cs.y = scale ? y * ZOOM_LVL_BASE : y;
|
||||||
|
cs.next = -1;
|
||||||
|
|
||||||
/* Append the sprite to the active ChildSprite list.
|
/* Append the sprite to the active ChildSprite list.
|
||||||
* If the active ParentSprite is a foundation, update last_foundation_child as well.
|
* If the active ParentSprite is a foundation, update last_foundation_child as well.
|
||||||
* Note: ChildSprites of foundations are NOT sequential in the vector, as selection sprites are added at last. */
|
* Note: ChildSprites of foundations are NOT sequential in the vector, as selection sprites are added at last. */
|
||||||
if (_vd.last_foundation_child[0] == _vd.last_child) _vd.last_foundation_child[0] = &cs->next;
|
if (_vd.last_foundation_child[0] == _vd.last_child) _vd.last_foundation_child[0] = &cs.next;
|
||||||
if (_vd.last_foundation_child[1] == _vd.last_child) _vd.last_foundation_child[1] = &cs->next;
|
if (_vd.last_foundation_child[1] == _vd.last_child) _vd.last_foundation_child[1] = &cs.next;
|
||||||
_vd.last_child = &cs->next;
|
_vd.last_child = &cs.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2, Colours colour, uint16 width)
|
static void AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2, Colours colour, uint16 width)
|
||||||
{
|
{
|
||||||
assert(width != 0);
|
assert(width != 0);
|
||||||
StringSpriteToDraw *ss = _vd.string_sprites_to_draw.Append();
|
/*C++17: StringSpriteToDraw &ss = */ _vd.string_sprites_to_draw.emplace_back();
|
||||||
ss->string = string;
|
StringSpriteToDraw &ss = _vd.string_sprites_to_draw.back();
|
||||||
ss->x = x;
|
ss.string = string;
|
||||||
ss->y = y;
|
ss.x = x;
|
||||||
ss->params[0] = params_1;
|
ss.y = y;
|
||||||
ss->params[1] = params_2;
|
ss.params[0] = params_1;
|
||||||
ss->width = width;
|
ss.params[1] = params_2;
|
||||||
ss->colour = colour;
|
ss.width = width;
|
||||||
|
ss.colour = colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1588,7 +1592,7 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
|
||||||
|
|
||||||
ParentSpriteToDraw *psd_end = _vd.parent_sprites_to_draw.End();
|
ParentSpriteToDraw *psd_end = _vd.parent_sprites_to_draw.End();
|
||||||
for (ParentSpriteToDraw *it = _vd.parent_sprites_to_draw.Begin(); it != psd_end; it++) {
|
for (ParentSpriteToDraw *it = _vd.parent_sprites_to_draw.Begin(); it != psd_end; it++) {
|
||||||
*_vd.parent_sprites_to_sort.Append() = it;
|
_vd.parent_sprites_to_sort.push_back(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
_vp_sprite_sorter(&_vd.parent_sprites_to_sort);
|
_vp_sprite_sorter(&_vd.parent_sprites_to_sort);
|
||||||
|
|
|
@ -509,7 +509,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
|
||||||
|
|
||||||
for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) {
|
for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) {
|
||||||
if (!HasBit(hidden_mask, i)) {
|
if (!HasBit(hidden_mask, i)) {
|
||||||
*list->Append() = new DropDownListStringItem(strings[i], i, HasBit(disabled_mask, i));
|
list->push_back(new DropDownListStringItem(strings[i], i, HasBit(disabled_mask, i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ WindowDesc::WindowDesc(WindowPosition def_pos, const char *ini_key, int16 def_wi
|
||||||
default_height_trad(def_height_trad)
|
default_height_trad(def_height_trad)
|
||||||
{
|
{
|
||||||
if (_window_descs == NULL) _window_descs = new SmallVector<WindowDesc*, 16>();
|
if (_window_descs == NULL) _window_descs = new SmallVector<WindowDesc*, 16>();
|
||||||
*_window_descs->Append() = this;
|
_window_descs->push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowDesc::~WindowDesc()
|
WindowDesc::~WindowDesc()
|
||||||
|
@ -3242,7 +3242,7 @@ void Window::InvalidateData(int data, bool gui_scope)
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
if (!gui_scope) {
|
if (!gui_scope) {
|
||||||
/* Schedule GUI-scope invalidation for next redraw. */
|
/* Schedule GUI-scope invalidation for next redraw. */
|
||||||
*this->scheduled_invalidation_data.Append() = data;
|
this->scheduled_invalidation_data.push_back(data);
|
||||||
}
|
}
|
||||||
this->OnInvalidateData(data, gui_scope);
|
this->OnInvalidateData(data, gui_scope);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue