Changeset - r23525:e8acc751d575
[Not reviewed]
master
0 2 0
Henry Wilson - 6 years ago 2018-09-24 19:18:16
m3henry@googlemail.com
Codechange: Replaced SmallVector::ErasePreservingOrder(it, count) with std::vector::erase()
2 files changed with 3 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/animated_tile.cpp
Show inline comments
 
@@ -27,10 +27,10 @@ SmallVector<TileIndex, 256> _animated_ti
 
 */
 
void DeleteAnimatedTile(TileIndex tile)
 
{
 
	TileIndex *to_remove = &*std::find(_animated_tiles.begin(), _animated_tiles.end(), tile);
 
	if (to_remove != _animated_tiles.End()) {
 
	auto to_remove = std::find(_animated_tiles.begin(), _animated_tiles.end(), tile);
 
	if (to_remove != _animated_tiles.end()) {
 
		/* The order of the remaining elements must stay the same, otherwise the animation loop may miss a tile. */
 
		_animated_tiles.ErasePreservingOrder(to_remove);
 
		_animated_tiles.erase(to_remove);
 
		MarkTileDirtyByTile(tile);
 
	}
 
}
src/core/smallvec_type.hpp
Show inline comments
 
@@ -149,16 +149,6 @@ public:
 
	}
 

	
 
	/**
 
	 * Remove items from the vector while preserving the order of other items.
 
	 * @param item First item to remove.
 
	 * @param count Number of consecutive items to remove.
 
	 */
 
	inline void ErasePreservingOrder(T *item, uint count = 1)
 
	{
 
		this->ErasePreservingOrder(item - this->Begin(), count);
 
	}
 

	
 
	/**
 
	 * Tests whether a item is present in the vector, and appends it to the end if not.
 
	 * The '!=' operator of T is used for comparison.
 
	 * @param item Item to test for
0 comments (0 inline, 0 general)