xienwolf
Deity
finalImprovement is defined on a more global scale. You are actually calling that one against something more fundamental even than the CvPlot, as such you don't have to target it at anything at all. If you imported some of my AI upgrades it is used more often (over in CvUnitAI, and I think also CvPlayerAI) and has a new functionality of needing you to pass in a player number so you know that the final improvement is a Town and not an Enclave for all but the Kuriotates. Anyways, you don't want to use pLoopPlot->finalImprovement, you just want to use finalImprovement again using the base improvement of what is on the other plot against the base improvment of what is on this plot.
Don't forget to make sure that your function for checking range is written loose enough to allow you to specify specific improvements (other than yourself) which you must be a certain range from. Then you could do something like restrict Lion's Dens to 5 tiles away from a Wolf's Den, but allow them to be adjacent to one another, resulting in areas which build up specific types of animals if left untouched.
Don't forget to make sure that your function for checking range is written loose enough to allow you to specify specific improvements (other than yourself) which you must be a certain range from. Then you could do something like restrict Lion's Dens to 5 tiles away from a Wolf's Den, but allow them to be adjacent to one another, resulting in areas which build up specific types of animals if left untouched.