Determine c ++ position of a player in a grid

So I'm doing a Pacman-like game. The game has tiles / grid. I keep the node data in a structure:

struct node

{
std :: pair  Node; // position of the node 
    float f = 0,
h = 0,
g = 0;
std :: pair  Previous;
bool iswall = false;
sf :: Vector2f rectCenter = sf :: Vector2f (0, 0);
sf :: Vector2f position;

};

I use the structure to calculate a path, to check if the cell is an obstacle (or not), etc.

In general, I use the arrays and a for loop to draw the grid:

for (int i = 0; i <col; i ++)
for (int j = 0; j <row; j ++)
{
/ * Default color is black * /
box[i][j].setFillColor (sf :: Color :: Black);
box[i][j].setOutlineColor (sf :: Color :: Yellow);
box[i][j].setOutlineThickness (-1);
box[i][j].setSize (sf :: Vector2f (w, h));
box[i][j].setPosition (sf :: Vector2f (i * w, j * h));
sf :: FloatRect fbox = box[i][j].getGlobalBounds ();
}

[[[[Enter the image description here1

I also use the strcut to create specific nodes (current position, start node, end node).

and I draw it like that in the man:

                                // displays the start node as green
if (i == crntNodex && j == crntNodey)
{
box[i][j].setFillColor (sf :: Color :: Green);
}

Now the problem I face is a function that can retrieve the player's current node (blue square on the green cell). My attempt was to check if the cell contained the player

std :: pair AIEnemy :: getNodePosition (sf :: RectangleShape * grid, int i, int j)
{

if (box.contains (rect.getPosition (). x, rect.getPosition (). y))
{
Return std :: pair(i, j);
}
}

But it is not efficient (and not updated). Is there a way to coordinate game objects in a grid?