The algorithm itself does not need to be changed. A-star can work on any type of graph. A grid is a graph. Graphs have nodes and edges. Nodes are the places your search algorithm can visit. Edges are the connections between nodes.
Empty grids have graphs like this:
+E+E+E+E+E+E+E+E+E+E+
E E E E E E E E E E E
+E+E+E+E+E+E+E+E+E+E+
E E E E E E E E E E E
+E+E+E+E+E+E+E+E+E+E+
E E E E E E E E E E E
+E+E+E+E+E+E+E+E+E+E+
Grids with occupied squares have graphs like this
+E+E+E+E+E+E+E+E+E+E+
E E E E E E E E E E
+E+E+ +E+E+E+E+E+E+
E E E E E E E E E
+E+E+E+E+E+E+ +E+E+
E E E E E E E E E E
+E+E+E+E+E+E+E+E+E+E+
Grids with walls on their cell edges have graphs like this:
+E+E+E+E+ +E+E+E+E+E+
E E E E E E E E E E E
+E+E+ +E+ +E+ +E+E+E+
E E E E E E E E E E E
+E+E+ +E+ +E+ +E+E+E+
E E E E E E E E E E E
+E+E+ +E+E+E+ +E+E+E+
When adding nodes to the list you add the neighboring node [icode]if(!grid.edgeBlocked(currentCell, aNeighbor) && !grid.isOccupied(aNeighbor))[/icode] instead of [icode]if(!grid.isOccupied(aNeighbor))[/icode]