Two things I can see:
You don't need any loops for your place function. You need to work out how to convert the current mouse co-ordinates to an array index, then simply make that array index equal to the current tile. You would also need to deselect the previously current tile, so it may be easier to implement this using global variables instead.
Secondly, replace
DrawImage tiles,x*50,y*50,map[mapx-1,mapy-1]
with
DrawImage tiles,x*50,y*50,map[x,y]
You need to use the variables for your indices, not your constant upper bounds.
Ryan
You don't need any loops for your place function. You need to work out how to convert the current mouse co-ordinates to an array index, then simply make that array index equal to the current tile. You would also need to deselect the previously current tile, so it may be easier to implement this using global variables instead.
Secondly, replace
DrawImage tiles,x*50,y*50,map[mapx-1,mapy-1]
with
DrawImage tiles,x*50,y*50,map[x,y]
You need to use the variables for your indices, not your constant upper bounds.
Ryan