I'm creating game application in C++. I have map represented as 2-dimensional std::vector
of Tile
objects.
I need to update that map as player moves. From server application I get row or column with a new part of global map, which should be placed in local client's map, for example:
In a figure 1 there's a local map before player moves. Top row is filled with objects 1, center with 2 and bottom with 0. Now when player moves up, I get new top row filled with objects 3 and all the others should go down, and the previous bottom row should disappear.
I can do it just by moving required objects in for
loops, but I was thinking if there's already some kind of algorithm in standard library or prefered by many, efficient way to achieve this kind of modifications.
EDIT:
Sorry I didn't realize that there would a difference between doing this operation for row and for column, but indeed there is. So I also editted my title, because I sometimes need to do it for column too.