I will attempt to help further.
This is just for a example, it is not fleshed out properly and is only to give you an idea what next step could be
You will probably need few things like:
int Get_Vertex_ID(int posX, int posY);//This function will take two arguments, witch represent position of a unti for example
//And will return a ID of vertex to check collision with
For example:
if you pass x=100 y=100 and you map have following characteristics:
tile_Width = 4, tile_Height = 4, tile_Size = 32, mapSizeX = tile_Width*tile_Size...
0 4 8 12
16 20 24 28
32 36 40 44
48 52 56 60
Function with x=100 y=100 would return 40 and thus you do only one to maximum of four collision detections(if your unit is same size as the tile, in case it is bigger...) and there is better code then you intended
But with this there are few problems.
One is that if the collision for Vertex_ID = 40 is walkable and (44,56,60) is unwalkable your unit is on that place so you need to do additional checking
int Get_Vertex_ID(int posX, int posY)
{
if(posX%32 != 0)
Tiles_To_Check_X = 2;
else
Tiles_To_Check_X = 1;
}
But then again there is another problem with this.
What if the unit is at Vertex_ID = 60 and tries moving right or down.
The code above would produce error cause the program tried accessing above Vertex_Array range.(Vertex_Count = 60) but the program tried accesing 64 or higher ^^