I am creating a C ++ game application. I have a map presented as a 2-dimensional std::vector object of Tile objects.
I need to update this map when moving a player. From the server application, I get a row or column with a new part of the global map, which should be placed on the client’s local map, for example:

In Figure 1, a local map before the player moves. The top line is filled with objects 1, in the center with 2 and bottom with 0. Now, when the player goes up, I get a new top line filled with objects 3, and all the rest should be omitted, and the previous bottom line should disappear.
I can do this only by moving the required objects to for loops, but I thought that if there is some kind of algorithm in the standard library or preferred by many, an effective way to achieve this kind of modifications.
EDIT:
Sorry, I did not understand that there would be a difference between performing this operation for a row and a column, but there really is. Therefore, I also edited my header, because sometimes I also need to do this for a column.
dziwna
source share