Build plan draft
Just off the top of my head, there are some problems. Theoretically, what if in the future I use a 256x256 map or something and there's no way for a single truck to transport it without running out of fuel. I have to add a check to see if a truck would run out of fuel on the way to or from a supplier and whether it needs to fuel up somewhere. This complicates the data structures. Let's say there's an "errand" (job) structure that holds "trip" structures, each with a path. An errand would consist of several trips. First might be a trip to gas station, then to the supplier, then to the demander. There shouldn't be any unusual cases that would require extra considerations to get the cheapest fuel cost. Like, if a certain gas station has really cheap fuel but only a limited amount, so all combinations of gas stations, demanders, and suppliers would be required for a truck to figure out which is the most profitable errand/job it should take up.
And I haven't even mentioned overseas transport. An errand might require resources to be picked up from one building on one island, transported by truck to a harbour, by ship to another island, where another truck transports it to its final destination.
And I was thinking of actually running the simulation, as it would normally run, only in an instant, to do the cost estimates. That would require a lot of restructuring. I would have to duplicate the unit, building, road, etc. structures. And pass everything as arguments instead of using globals. Maybe it's better to use heuristics (cheap guesses) or leave it all up to the player to choose the supplier, transporters, etc. But I'm making an AI opponent, so there will already be some kind of heuristic. Or will there be? AI opponents don't necessarily have to compare choices and estimate costs because they can just "cheat" and figure out what to build and where. But maybe that's another topic: what to build and where, as opposed to how much it will cost.
Maybe this is all too complicated. Maybe I should go back to an earlier design again and just let the player choose the supplier for each building. I didn't have the problem of land-sea-land transport before though.