Nightinggale
Deity
- Joined
- Feb 2, 2009
- Messages
- 5,383
CvGame::setFatherTeam() in CvGame.cpp. It stores the ID of the team owning the father to m_ja_eFatherTeam, which is a just-in-time array. JIT arrays is something I added. They behave mostly like normal C style arrays, but they have automated memory allocation as well as functions for savegames.There is possibly a map or array holding fathers assigned to players. To allow AI and Human reuse the same father I would probably need to allocate a map per each player and store/load this info in saved game too. Anyway, thanks for info.
What would likely be needed instead would be a JIT array of PlayerBitmap. It will then provide one bit for each team, which is enough to tell if a team has the father or not. Storing this data isn't the issue, nor is adding it to the savegames.
The real issue is that some parts of the code assumes fathers to only be present for one team. This mean it will be needed to locate everywhere it is used. One example would be where it skips asking if you want some FF if it is already owned by another team.
Maybe the easy way would be to alway return NO_TEAM for CvGame::getFatherTeam() and add a new one for a team asking if this team has the FF in the argument.
We would also need a game option to tell if FF should be per game or per team as well as saving all this in savegames.
I don't see any reason why this shouldn't work. It might be a bit of a task for somebody, who is new to the source code, but then again it could be considered a decent introduction to the code

I'm not quite sure what to do about the array telling which turn each FF joined teams. Maybe add one for each player. Remember JIT arrays use 8/12 bytes if they only contain default data meaning adding arrays, which aren't always used will not eat up memory.