Trade routes implemented : step 3/5 is complete!

The trading system is now implemented, completing the 3rd task of the 5 remaining! I am now moving to the 4th one : technologies.

There is 4 different types of commercial activities in Ymir.
The first one is the most primitive and basic one : manually loading resources into a group carrier units, travelling to destination and unloading the goods from their inventory.
The second one is the most common one among games of this genre : trading offers to sell and buy amounts of resources at  specific prices. You can put any material resource for sale and it will be available for sale to anyone in your trading network.
The third one is more advanced: Trade Routes. They allow for the constant transfer of a resource instead of a one-time sale. For instance, with a trade route, you can arrange to constantly transfer a certain amount of food produced in a farming region to your capital.
The fourth one is related to trade routes as well: to work, a trade route needs a service called Cargo. Cargo represents the fact ships and caravans are required to constantly carry the goods along a trade route.

You can produce this service by building docks in your city. This special service can be ‘rented’ from any of the cities of your trading network, and when you open a trade route, you have to choose an “operator” : the city that will provide the required cargo service for this trade route and deal with the transportation of goods. You can choose your own city for this, but also any city of your trading network that has enough cargo available.  The cargo required for a trade route depends on the volume of resources traded, but its also affected exponentially by the total distance of the trade route.
Now this is where it gets interesting : the distance is calculated from the operator’s location. This means that choosing an operator in the middle of your trade route will make it A LOT cheaper than choosing to operate the route yourself from one end of the route, where the distance factor is maximal.
This also means that strategically placed cities can thrive simply by ‘operating’ trade routes, without producing anything themselves, but simply by providing cargo to others and effectively becoming a “trading node”. Cargo generates incomes for your traders, which in turn generates tax revenues for the city. But on top of that, cities can raise a customs tariff, taxing a percentage of the value of all goods of every trade route operated by the city, generating additional income.

When you sell goods via trade route or regular sales, the generated income doesn’t belong to you ( the state ) but to the owners of the sold resources ( local producers in your city ).
When you buy goods however, it is you (the state) that buys them at the price specified in the offer. The imported goods therefore belong to you, and not to local producers in your city.
Later on, If these goods generate incomes ( by beeing sold to local population via merchants or consumed by industries ect .. ) , the generated incomes will this time go directly to the state, potentially reimbursing you the cost of importation. For instance, if you import tomatoes at a price of 2 but that they are worth 3 on the local market of your city,  you could very well generate profits for yourself.
However , trade routes are expensive as not only do you have to pay upfront for the imported goods but you also need to pay for the cargo service, and to eventually pay a customs tariff.

The cost of a trade route includes 3 things : the cost of the imported goods themselves (paid to the exporting city), the cost of the cargo service to carry the goods (paid to the operator) and the cost of the customs tariff (paird to the operator).

You can only trade with your own cities , or cities belonging to a state that has given you access to its trade ( via a diplomatic treaty ). You will only be able to sell and see the trade offers from cities of your trading network.

When selling something, you are free to sell it at any price regardless of its local price in your region. The offer will then be visible from any region that has trading rights with yours.