diff options
author | Henry Wilson <m3henry@googlemail.com> | 2018-09-23 12:23:54 +0100 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-03-26 20:15:57 +0000 |
commit | a690936ed75e96627be0e2ecafee2360a71e8d3c (patch) | |
tree | 1221c131b8fe3a51cf43a6bd7d89a51c431c559d /src/saveload | |
parent | 56ae855dc20b27593c9a454d5a09d8f892a6c71f (diff) | |
download | openttd-a690936ed75e96627be0e2ecafee2360a71e8d3c.tar.xz |
Codechange: Replace SmallVector::Length() with std::vector::size()
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/animated_tile_sl.cpp | 4 | ||||
-rw-r--r-- | src/saveload/game_sl.cpp | 6 | ||||
-rw-r--r-- | src/saveload/labelmaps_sl.cpp | 4 | ||||
-rw-r--r-- | src/saveload/linkgraph_sl.cpp | 4 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 2 | ||||
-rw-r--r-- | src/saveload/waypoint_sl.cpp | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/src/saveload/animated_tile_sl.cpp b/src/saveload/animated_tile_sl.cpp index 6db0561cd..36571c418 100644 --- a/src/saveload/animated_tile_sl.cpp +++ b/src/saveload/animated_tile_sl.cpp @@ -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); } /** diff --git a/src/saveload/game_sl.cpp b/src/saveload/game_sl.cpp index 325ae1c9d..ff48ab135 100644 --- a/src/saveload/game_sl.cpp +++ b/src/saveload/game_sl.cpp @@ -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]); } diff --git a/src/saveload/labelmaps_sl.cpp b/src/saveload/labelmaps_sl.cpp index b57a89f20..a25abe722 100644 --- a/src/saveload/labelmaps_sl.cpp +++ b/src/saveload/labelmaps_sl.cpp @@ -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; diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp index 76390a010..1ff247042 100644 --- a/src/saveload/linkgraph_sl.cpp +++ b/src/saveload/linkgraph_sl.cpp @@ -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]; diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index f066d014d..2aa19af81 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -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); } }; diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp index 2567c2c93..5e3a391f0 100644 --- a/src/saveload/waypoint_sl.cpp +++ b/src/saveload/waypoint_sl.cpp @@ -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++) { |