How do ships generate money?

What i mean is there must be code somewhere that tells the game that ships arranged in a continuous link generate money when a merchant is built.If you could find out how that is done you may be able to alter an emissary to be a trader and to boost the income of a province he resides in but only in conjunction with a link to a building in the same manner as ships.

I was planning on adding NobleWomen to my game,based on Princesses so i could marry them off to generals.They would affect nothing apart from loyalty however.