Change the node structure. Now the x,y, g_cost and f_cost are S8. This will work until the cost will not be bigger than 127. I done this change to occupy less memory.