diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-12-15 00:22:04 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-12-15 00:29:30 +0100 |
commit | 79240eab1ee4abb2882a40c7ac18e4915b4dc820 (patch) | |
tree | 98abb3c8ccf490efa459ed29fe7f28699c8d9928 /src/viewport.cpp | |
parent | cc1679e3171bf6982164c4072a773fdd687ea885 (diff) | |
download | openttd-79240eab1ee4abb2882a40c7ac18e4915b4dc820.tar.xz |
Codechange: Make use of the improved C++17 emplace_back function.
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index e28a2e606..bf1f34acd 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -498,8 +498,7 @@ static void AddTileSpriteToDraw(SpriteID image, PaletteID pal, int32 x, int32 y, { assert((image & SPRITE_MASK) < MAX_SPRITES); - /*C++17: TileSpriteToDraw &ts = */ _vd.tile_sprites_to_draw.emplace_back(); - TileSpriteToDraw &ts = _vd.tile_sprites_to_draw.back(); + TileSpriteToDraw &ts = _vd.tile_sprites_to_draw.emplace_back(); ts.image = image; ts.pal = pal; ts.sub = sub; @@ -708,8 +707,7 @@ void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, return; } - /*C++17: ParentSpriteToDraw &ps = */ _vd.parent_sprites_to_draw.emplace_back(); - ParentSpriteToDraw &ps = _vd.parent_sprites_to_draw.back(); + ParentSpriteToDraw &ps = _vd.parent_sprites_to_draw.emplace_back(); ps.x = tmp_x; ps.y = tmp_y; @@ -827,8 +825,7 @@ void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool tran *_vd.last_child = (uint)_vd.child_screen_sprites_to_draw.size(); - /*C++17: ChildScreenSpriteToDraw &cs = */ _vd.child_screen_sprites_to_draw.emplace_back(); - ChildScreenSpriteToDraw &cs = _vd.child_screen_sprites_to_draw.back(); + ChildScreenSpriteToDraw &cs = _vd.child_screen_sprites_to_draw.emplace_back(); cs.image = image; cs.pal = pal; cs.sub = sub; @@ -847,8 +844,7 @@ void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool tran static void AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2, Colours colour, uint16 width) { assert(width != 0); - /*C++17: StringSpriteToDraw &ss = */ _vd.string_sprites_to_draw.emplace_back(); - StringSpriteToDraw &ss = _vd.string_sprites_to_draw.back(); + StringSpriteToDraw &ss = _vd.string_sprites_to_draw.emplace_back(); ss.string = string; ss.x = x; ss.y = y; |