After throwing a quick look at the provided code it seems this is a "Sample algorithm". This path-finding algorithm is cell based and does not support different terrain weights and rarely even uses different path wight for diagonal paths.
Extending your algorithm to support diagonal movement won't be so hard as you just need to calculate values for four additional neighboring cells. But if you do plan on having different weight for diagonal movement you will have to change F,G,H to floating point values since cost for diagonal movement would be 1,41.
And if you want to add different weights based on different terrain you will have to add additional value W to each of your cells. This value stores how difficult is to traverse through certain cell and is usually stored just as multiplier. So you calculate final weight of traveling through that cell by multiplying default wight with this multiplier. So if it is larger than 1 you gain speed boost and if it smaller you are being slowed down.
Once you add diagonal movement and different cell weights you basically have a cell based A* path-finding algorithm at your hand.
You can read more about cell based A* path-finding algorithm and how it works here:
http://www.policyalmanac.org/games/aStarTutorial.htm

But I would recommend that you rather look for node-based A* path-finding algorithm instead. Why?
Main advantages of node based path-finding algorithm is that you are no longer limited to the fixed sized grid. You are able to use teleporters for creating shortcuts across your map. And since in node based path-finding each node stores possible paths to other nodes and each of these paths can have its own weight this means that you can have different path weight when going from one A to node B than when going from node B to node A. This is useful for simulating going uphill or downhill.
Another big advantage of node based path-finding is the ability to implement heuristics path-finding where multiple heuristics levels share same nodes. Somewhere on one of my computers I have nice article about heuristic path-finding but I don't find it right now.
And another advantage is that it is rather easy to modify the node graph at any time which is very useful when you game have dynamic maps.
Now the disadvantage of node based path-finding algorithm in comparison to a cell based is that it uses more memory for storing the node-graph. But on today computers I don't think that should pose much problem.