Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back()
This commit is contained in:
@@ -2954,24 +2954,24 @@ bool AfterLoadGame()
|
||||
cur_skip = prev_tile_skip;
|
||||
}
|
||||
|
||||
uint *this_skip = skip_frames.Append();
|
||||
*this_skip = prev_tile_skip;
|
||||
/*C++17: uint &this_skip = */ skip_frames.push_back(prev_tile_skip);
|
||||
uint &this_skip = skip_frames.back();
|
||||
|
||||
/* The following 3 curves now take longer than before */
|
||||
switch (u->state) {
|
||||
case 2:
|
||||
cur_skip++;
|
||||
if (u->frame <= (roadside ? 9 : 5)) *this_skip = cur_skip;
|
||||
if (u->frame <= (roadside ? 9 : 5)) this_skip = cur_skip;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
cur_skip++;
|
||||
if (u->frame <= (roadside ? 5 : 9)) *this_skip = cur_skip;
|
||||
if (u->frame <= (roadside ? 5 : 9)) this_skip = cur_skip;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
cur_skip++;
|
||||
if (u->frame <= (roadside ? 4 : 2)) *this_skip = cur_skip;
|
||||
if (u->frame <= (roadside ? 4 : 2)) this_skip = cur_skip;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -42,14 +42,14 @@ static void Load_ANIT()
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (anim_list[i] == 0) break;
|
||||
*_animated_tiles.Append() = anim_list[i];
|
||||
_animated_tiles.push_back(anim_list[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
uint count = (uint)SlGetFieldLength() / sizeof(*_animated_tiles.Begin());
|
||||
_animated_tiles.clear();
|
||||
_animated_tiles.Append(count);
|
||||
_animated_tiles.resize(_animated_tiles.size() + count);
|
||||
SlArray(_animated_tiles.Begin(), count, SLE_UINT32);
|
||||
}
|
||||
|
||||
|
@@ -190,7 +190,8 @@ static void Load_EIDS()
|
||||
_engine_mngr.clear();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -153,10 +153,10 @@ static void Load_GSTR()
|
||||
LanguageStrings *ls = new LanguageStrings(_game_saveload_string != NULL ? _game_saveload_string : "");
|
||||
for (uint i = 0; i < _game_saveload_strings; i++) {
|
||||
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 */
|
||||
|
@@ -48,7 +48,7 @@ void AfterLoadLabelMaps()
|
||||
RailType r = GetRailTypeByLabel(_railtype_list[i]);
|
||||
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++) {
|
||||
@@ -114,7 +114,7 @@ static void Load_RAIL()
|
||||
|
||||
while (SlIterateArray() != -1) {
|
||||
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);
|
||||
address -= offset_gamesettings;
|
||||
address += offset_component;
|
||||
*(saveloads.Append()) = sl;
|
||||
saveloads.push_back(sl);
|
||||
}
|
||||
desc = GetSettingDescription(++setting);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ const SaveLoad *GetLinkGraphJobDesc()
|
||||
|
||||
int i = 0;
|
||||
do {
|
||||
*(saveloads.Append()) = job_desc[i++];
|
||||
saveloads.push_back(job_desc[i++]);
|
||||
} 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. */
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (anim_list[i] == 0) break;
|
||||
*_animated_tiles.Append() = anim_list[i];
|
||||
_animated_tiles.push_back(anim_list[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -143,7 +143,7 @@ struct MemoryDumper {
|
||||
/* Are we at the end of this chunk? */
|
||||
if (this->buf == this->bufe) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -178,7 +178,8 @@ static void Load_WAYP()
|
||||
int index;
|
||||
|
||||
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));
|
||||
|
||||
wp->index = index;
|
||||
|
Reference in New Issue
Block a user