Codechange: Replace SmallVector::Length() with std::vector::size()
This commit is contained in:
@@ -25,8 +25,8 @@ extern SmallVector<TileIndex, 256> _animated_tiles;
|
||||
*/
|
||||
static void Save_ANIT()
|
||||
{
|
||||
SlSetLength(_animated_tiles.Length() * sizeof(*_animated_tiles.Begin()));
|
||||
SlArray(_animated_tiles.Begin(), _animated_tiles.Length(), SLE_UINT32);
|
||||
SlSetLength(_animated_tiles.size() * sizeof(*_animated_tiles.Begin()));
|
||||
SlArray(_animated_tiles.Begin(), _animated_tiles.size(), SLE_UINT32);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -132,7 +132,7 @@ static const SaveLoad _game_language_string[] = {
|
||||
static void SaveReal_GSTR(LanguageStrings *ls)
|
||||
{
|
||||
_game_saveload_string = ls->language;
|
||||
_game_saveload_strings = ls->lines.Length();
|
||||
_game_saveload_strings = ls->lines.size();
|
||||
|
||||
SlObject(NULL, _game_language_header);
|
||||
for (uint i = 0; i < _game_saveload_strings; i++) {
|
||||
@@ -160,7 +160,7 @@ static void Load_GSTR()
|
||||
}
|
||||
|
||||
/* If there were no strings in the savegame, set GameStrings to NULL */
|
||||
if (_current_data->raw_strings.Length() == 0) {
|
||||
if (_current_data->raw_strings.size() == 0) {
|
||||
delete _current_data;
|
||||
_current_data = NULL;
|
||||
return;
|
||||
@@ -174,7 +174,7 @@ static void Save_GSTR()
|
||||
{
|
||||
if (_current_data == NULL) return;
|
||||
|
||||
for (uint i = 0; i < _current_data->raw_strings.Length(); i++) {
|
||||
for (uint i = 0; i < _current_data->raw_strings.size(); i++) {
|
||||
SlSetArrayIndex(i);
|
||||
SlAutolength((AutolengthProc *)SaveReal_GSTR, _current_data->raw_strings[i]);
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ static SmallVector<RailTypeLabel, RAILTYPE_END> _railtype_list;
|
||||
*/
|
||||
static bool NeedRailTypeConversion()
|
||||
{
|
||||
for (uint i = 0; i < _railtype_list.Length(); i++) {
|
||||
for (uint i = 0; i < _railtype_list.size(); i++) {
|
||||
if ((RailType)i < RAILTYPE_END) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo((RailType)i);
|
||||
if (rti->label != _railtype_list[i]) return true;
|
||||
@@ -44,7 +44,7 @@ void AfterLoadLabelMaps()
|
||||
if (NeedRailTypeConversion()) {
|
||||
SmallVector<RailType, RAILTYPE_END> railtype_conversion_map;
|
||||
|
||||
for (uint i = 0; i < _railtype_list.Length(); i++) {
|
||||
for (uint i = 0; i < _railtype_list.size(); i++) {
|
||||
RailType r = GetRailTypeByLabel(_railtype_list[i]);
|
||||
if (r == INVALID_RAILTYPE) r = RAILTYPE_BEGIN;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ const SaveLoad *GetLinkGraphJobDesc()
|
||||
static const char *prefix = "linkgraph.";
|
||||
|
||||
/* Build the SaveLoad array on first call and don't touch it later on */
|
||||
if (saveloads.Length() == 0) {
|
||||
if (saveloads.size() == 0) {
|
||||
size_t offset_gamesettings = cpp_offsetof(GameSettings, linkgraph);
|
||||
size_t offset_component = cpp_offsetof(LinkGraphJob, settings);
|
||||
|
||||
@@ -83,7 +83,7 @@ const SaveLoad *GetLinkGraphJobDesc()
|
||||
int i = 0;
|
||||
do {
|
||||
*(saveloads.Append()) = job_desc[i++];
|
||||
} while (saveloads[saveloads.Length() - 1].cmd != SL_END);
|
||||
} while (saveloads[saveloads.size() - 1].cmd != SL_END);
|
||||
}
|
||||
|
||||
return &saveloads[0];
|
||||
|
@@ -175,7 +175,7 @@ struct MemoryDumper {
|
||||
*/
|
||||
size_t GetSize() const
|
||||
{
|
||||
return this->blocks.Length() * MEMORY_CHUNK_SIZE - (this->bufe - this->buf);
|
||||
return this->blocks.size() * MEMORY_CHUNK_SIZE - (this->bufe - this->buf);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -96,7 +96,7 @@ void MoveWaypointsToBaseStations()
|
||||
}
|
||||
}
|
||||
|
||||
if (!Waypoint::CanAllocateItem(_old_waypoints.Length())) SlError(STR_ERROR_TOO_MANY_STATIONS_LOADING);
|
||||
if (!Waypoint::CanAllocateItem(_old_waypoints.size())) SlError(STR_ERROR_TOO_MANY_STATIONS_LOADING);
|
||||
|
||||
/* All saveload conversions have been done. Create the new waypoints! */
|
||||
for (OldWaypoint *wp = _old_waypoints.Begin(); wp != _old_waypoints.End(); wp++) {
|
||||
|
Reference in New Issue
Block a user