Great.

I get it now.

Well OK now we have finished the file reading. So I have my values for cordinates and track nos. I check if type is X or Y and accordingly set them as x1 or x2 etc.

Now I come to filling up my list with these values.

I had some conditions for the same i.e. I compare my values of x1 x2 y1 and y2 and then get the element of the list which I am supposed to fill.

So I will have to call this function for filling my list inside the file read function i.e. decode (just at the beginning so that the check is done everytime).

This is my funtion for filling the list:

Code:

void fill_list (int x1, int x2, int y1, int y2, int trackno1, int trackno2)
{
if (x1==0 && x2==0 && y1==0 && y2==0)
{
goto END;
}
else
{
if (x1==x2)
{
if (y1==y2)
{
temp=Layout[17-y1][x1].Array[19+trackno2];
temp=temp->nextptr;
temp->line_used=1;
temp=Layout[17-y1][x1].Array[19-trackno1];
temp=temp->nextptr;
temp=temp->nextptr;
temp->line_used=1;
}
else
{
if (y2==y1+1)
{
temp=Layout[17-y1][x1].Array[19-trackno1];
temp->line_used=1;
temp=Layout[17-y1][x1].Array[9-trackno2];
temp=temp->nextptr;
temp->line_used=1;
}
else
{
if (y2 > y1+1)
{
temp=Layout[17-(y2-1)][x1].Array[19+trackno2];
temp->line_used=1;
temp=Layout[17-(y2-1)][x1].Array[9-trackno2];
temp=temp->nextptr;
temp=temp->nextptr;
temp->line_used=1;
}
}
}
}
else
{
if (y1==y2)
{
if (x1==x2+1)
{
temp=Layout[17-y2][x2].Array[19+trackno2];
temp=temp->nextptr;
temp=temp->nextptr;
temp=temp->nextptr;
temp->line_used=1;
temp=Layout[17-y2][x2].Array[29+trackno1];
temp=temp->nextptr;
temp=temp->nextptr;
temp->line_used=1;
}
else
{
if (x1 > x2+1)
{
temp=Layout[17-y1][x1-1].Array[19-trackno1];
temp=temp->nextptr;
temp=temp->nextptr;
temp=temp->nextptr;
temp->line_used=1;
temp=Layout[17-y1][x1-1].Array[29+trackno1];
temp=temp->nextptr;
temp->line_used=1;
}
}
}
else
{
if (y2==y1+1)
{
temp=Layout[17-y1][x2].Array[9-trackno2];
temp=temp->nextptr;
temp=temp->nextptr;
temp=temp->nextptr;
temp->line_used=1;
temp=Layout[17-y1][x2].Array[29+trackno1];
temp->line_used=1;
}
}
}
END:
}

Does this part require any change to it. It is compiling if I run only this part.