That should just be for (int i = 0; i < nr_economies; ++i).
Basically the write code iterates through all economy and for each one searches a map object that is part of this economy. The objects id is then written to the file. On load, the map object is found and it's economy loads the data that was saved. Rather convoluted, but necessary as we can not guarantee that economies are created in the same order as in the original game on load.
That should just be for (int i = 0; i < nr_economies; ++i).
Basically the write code iterates through all economy and for each one searches a map object that is part of this economy. The objects id is then written to the file. On load, the map object is found and it's economy loads the data that was saved. Rather convoluted, but necessary as we can not guarantee that economies are created in the same order as in the original game on load.