AZSportsFan
Oct 09, 2008, 12:21 AM
From Hydro Plant thread...
Illuminatus, who has offered to do some text and civilopedia work, has inquired about the possibility of having a seperate list of names for sea bases, as existed in SMAC. I've had a look at the SDK myself to see how city names are assigned. The central function seems to be "CvWString CvPlayer::getNewCityName() const". The way to make sea base names possible seems obvious: add a seperate list of them in CIV4CivilizationInfos.xml. Then in the above-mentioned function check if the new city is built on water. If so, extract a name from the sea base name list. If the base is on land or if the list of sea base names has been already fully used, switch to the list of land base names and the rest that follows in that function.
Problem however is, I have no idea how the list of city names is created!!
The function talks about headCityNameNode()
This leads to "CLLNode<CvWString>* CvPlayer::headCityNameNode() const" and a certain thingie called "m_cityNames". Problem here is, I have no idea whatsoever how content is added to this m_cityNames (I assume) list. That string is only referenced in CvPlayer.cpp.
Likewise, the list of city names is extracted from the XML in CvInfos.cpp, resulting in stuff like 'm_paszCityNames', but that is referenced nowhere outside CvInfos.cpp.
So I don't know... do you understand how city names are assigned?
It looks to be pretty straightforward. As you have said, the city names are defined in CIV4CivilizationInfos.xml. We would need a new element on the civ for SeaBases. The SeaBases are read into CvCivilizationInfo class in CvInfos, where they become available through a new function getSeaBaseNames(int i).
In CvPlayer, when a new city is founded, getNewCityName is called, which first goes through the list of names already used by the player (this may be just "run-time player-defined" city names which it will try to reuse if available, but I am not positive) to see if any are not current city names, and if one is not found (generally the case), getCivilizationCityName() is called to get a random name from the civ city list until it finds one that is not currently in use. If it still doesn't find one, then it tries to get one from a random civ, and so one.
So we would need to do a few things - add a variable for run-time player-defined sea base names, and civ-defined sea base names, determine whether or not the plot is land or sea, and then select a name accordingly. Straightforward in algorithm, but I will see about implementation.
I will try this out when I get some time later this week.
Illuminatus, who has offered to do some text and civilopedia work, has inquired about the possibility of having a seperate list of names for sea bases, as existed in SMAC. I've had a look at the SDK myself to see how city names are assigned. The central function seems to be "CvWString CvPlayer::getNewCityName() const". The way to make sea base names possible seems obvious: add a seperate list of them in CIV4CivilizationInfos.xml. Then in the above-mentioned function check if the new city is built on water. If so, extract a name from the sea base name list. If the base is on land or if the list of sea base names has been already fully used, switch to the list of land base names and the rest that follows in that function.
Problem however is, I have no idea how the list of city names is created!!
The function talks about headCityNameNode()
This leads to "CLLNode<CvWString>* CvPlayer::headCityNameNode() const" and a certain thingie called "m_cityNames". Problem here is, I have no idea whatsoever how content is added to this m_cityNames (I assume) list. That string is only referenced in CvPlayer.cpp.
Likewise, the list of city names is extracted from the XML in CvInfos.cpp, resulting in stuff like 'm_paszCityNames', but that is referenced nowhere outside CvInfos.cpp.
So I don't know... do you understand how city names are assigned?
It looks to be pretty straightforward. As you have said, the city names are defined in CIV4CivilizationInfos.xml. We would need a new element on the civ for SeaBases. The SeaBases are read into CvCivilizationInfo class in CvInfos, where they become available through a new function getSeaBaseNames(int i).
In CvPlayer, when a new city is founded, getNewCityName is called, which first goes through the list of names already used by the player (this may be just "run-time player-defined" city names which it will try to reuse if available, but I am not positive) to see if any are not current city names, and if one is not found (generally the case), getCivilizationCityName() is called to get a random name from the civ city list until it finds one that is not currently in use. If it still doesn't find one, then it tries to get one from a random civ, and so one.
So we would need to do a few things - add a variable for run-time player-defined sea base names, and civ-defined sea base names, determine whether or not the plot is land or sea, and then select a name accordingly. Straightforward in algorithm, but I will see about implementation.
I will try this out when I get some time later this week.