Hi
I have a large tile world of char world[1000][1000] describing land and sea in my gameworld ( 0 is sea, 1 is land).
Upon creating a new game I need to place "ports" on coast-tiles close to cities (land-tiles with any adjacent sea-tile).
I do this now:
pick a random city
pick a random tile which is between 10 and 15 tiles away from the city (random x and y from the city)
check if that tile is land
check if it has sea-tiles adjacent
check if the port is too close to any other port
create port
Repeat until x ports are created in the world.
This is a bit slow since i find A LOT of sea tiles or land tiles not having sea neighbours. Seems like a primitive method.
Maybe it doenst matter much since its just when starting a new campaign, but still... Any sugesstions to a better method?
Thanks
Erik