Fix multiple serious bugs in factory placement code.
Merge branch 'ncn-devel' of git://github.com/neroden/simutrans.git into 11.x