Nightinggale
Deity
- Joined
- Feb 2, 2009
- Messages
- 5,281
I just had another idea. Usually a C++ class is split into one header file and one cpp file, both with the classname as filename. However that is to make the code human readable and we can place the cpp code wherever we like as long as we include the header. I want to exploit this by moving all the readWrite functions into a single cpp file.
This file will not focus on classes, but rather savegames. By moving everything savegame related into a single file and not using that file for anything else, we can get git to provide a log for that file, that is a log of changes in the savegame format. Keeping everything in one place will also help getting an overview of how and what is saved.
I started thinking in those lines when it hit me that the savegame version string should be the first to be saved. If we have savegame compatibility issues and a savegame is unreadable for whatever reason, getting the string before it gives up on loading the savegame would be a good idea. However that approach naturally came with a new question: which read/readWrite function is called first? CvGame is a likely candidate, but I'm not sure. I realized I would have to debug to tell the load order of all read functions, which then came with the question: where are "all" those functions? They are spread out all over the code with usually only a single one in each file. If we are to make savegame compatibilty a priority, we better conquer the savegame format once and for all.
Looks like adding a version string to savegames had become somewhat bigger than I first planned, but at the same time I really like this approach. It will be much easier to figure out what we can and can't do. Having a single file would also be a valid place to document the overall savegame structure and other savegame related documentation. The top part with comments might become a big bigger than the average cpp file
I remember the improvement stuff as being more complex than the rest. Normal allow/modifiers would be 2D as it has say UnitClass and modifier. Improvements ahve ImprovementType, TerrainType, and modifier. Routes are somewhat the same and I can't remember if there are more tags using 3D. I need to read more on how they are set up as I remember them as something not that tricky to set up for the xml modders, but I can't remember what I came up with.
This file will not focus on classes, but rather savegames. By moving everything savegame related into a single file and not using that file for anything else, we can get git to provide a log for that file, that is a log of changes in the savegame format. Keeping everything in one place will also help getting an overview of how and what is saved.
I started thinking in those lines when it hit me that the savegame version string should be the first to be saved. If we have savegame compatibility issues and a savegame is unreadable for whatever reason, getting the string before it gives up on loading the savegame would be a good idea. However that approach naturally came with a new question: which read/readWrite function is called first? CvGame is a likely candidate, but I'm not sure. I realized I would have to debug to tell the load order of all read functions, which then came with the question: where are "all" those functions? They are spread out all over the code with usually only a single one in each file. If we are to make savegame compatibilty a priority, we better conquer the savegame format once and for all.
Looks like adding a version string to savegames had become somewhat bigger than I first planned, but at the same time I really like this approach. It will be much easier to figure out what we can and can't do. Having a single file would also be a valid place to document the overall savegame structure and other savegame related documentation. The top part with comments might become a big bigger than the average cpp file
Yeah I can look into those. In fact maybe I should take over. When I asked you to look into it, I had problems getting CivEffects to run stable and had too much to do for one person. Now CivEffects seems to work and there is little dll work left. At the same time we reached the xml verification stage. I think it would make more sense if you start to focus on xml now to fix the glitches the CivEffect conversions script made.I just pushed another batch of textmgr additions. That's a pain in the rump. There is still a bunch to go so if you want to knock some of that out it be great. The getAllowsImprovementslooks the most confusing and I've been skipping it
I remember the improvement stuff as being more complex than the rest. Normal allow/modifiers would be 2D as it has say UnitClass and modifier. Improvements ahve ImprovementType, TerrainType, and modifier. Routes are somewhat the same and I can't remember if there are more tags using 3D. I need to read more on how they are set up as I remember them as something not that tricky to set up for the xml modders, but I can't remember what I came up with.