Castor_Troy
Warlord
Hello, I`ve busted my head trying to find the problem, i am inexperienced in C++ so possibly/hopefully the solution is really simple: the code is from FFH2(thought i should have no problems with that just a simple identify and merge job). But here goes this is what i have put in my source code:
Notes:
CvInfos.cpp:
CvInfos.h:
CvCity.cpp:
CvGameTextMsg.cpp:
XML tags:
CyInfoInterface1.cpp:
P.S.
Could i be missing some codes from the FFH2 regarding the effect ? Although possible i checked it three times and excluded all the prereqCiv they had for Civic, Events, Projects, Improvements
Notes:
Spoiler :
1. The compiling gives no errors, all the tags are at their specific place( i use K-Mod source files as a basis).
2.Tried to compile without the readPass3 since i had no ideea what it does, it compiles but still doesnt work.
3.The function doesnt work properly nor display the civ requirement anywhere.
4.The XML gives also no errors the tag is where it is supposed to be. The game doesnt crash ran on AIAutoPlay hundreds of turns no crash
2.Tried to compile without the readPass3 since i had no ideea what it does, it compiles but still doesnt work.
3.The function doesnt work properly nor display the civ requirement anywhere.
4.The XML gives also no errors the tag is where it is supposed to be. The game doesnt crash ran on AIAutoPlay hundreds of turns no crash
CvInfos.cpp:
Spoiler :
m_iPrereqReligion(NO_RELIGION),
m_iPrereqCiv(NO_CIVILIZATION), // Separatio
m_iPrereqCorporation(NO_CORPORATION),
__________________________________________
int CvBuildingInfo::getPrereqReligion() const
{
return m_iPrereqReligion;
}
// Separatio START
int CvBuildingInfo::getPrereqCiv() const
{
return m_iPrereqCiv;
}
// Separatio END
int CvBuildingInfo::getPrereqCorporation() const
{
return m_iPrereqCorporation;
}
___________________________________________
stream->Read(&m_iPrereqReligion);
stream->Read(&m_iPrereqCiv); // Separatio
stream->Read(&m_iPrereqCorporation);
___________________________________________
stream->Write(m_iPrereqReligion);
stream->Write(m_iPrereqCiv); // Separatio
stream->Write(m_iPrereqCorporation);
___________________________________________
pXML->GetChildXmlValByName(szTextVal, "PrereqReligion");
m_iPrereqReligion = pXML->FindInInfoClass(szTextVal);
pXML->GetChildXmlValByName(szTextVal, "PrereqCiv"); // Separatio
m_aszExtraXMLforPass3.push_back(szTextVal);
pXML->GetChildXmlValByName(szTextVal, "PrereqCorporation");
m_iPrereqCorporation = pXML->FindInInfoClass(szTextVal);
___________________________________________
// Separatio START
bool CvBuildingInfo::readPass3()
{
if (m_aszExtraXMLforPass3.size() < 1)
{
FAssert(false);
return false;
}
m_iPrereqCiv = GC.getInfoTypeForString(m_aszExtraXMLforPass3[0]);
m_aszExtraXMLforPass3.clear();
return true;
}
// Separatio END
m_iPrereqCiv(NO_CIVILIZATION), // Separatio
m_iPrereqCorporation(NO_CORPORATION),
__________________________________________
int CvBuildingInfo::getPrereqReligion() const
{
return m_iPrereqReligion;
}
// Separatio START
int CvBuildingInfo::getPrereqCiv() const
{
return m_iPrereqCiv;
}
// Separatio END
int CvBuildingInfo::getPrereqCorporation() const
{
return m_iPrereqCorporation;
}
___________________________________________
stream->Read(&m_iPrereqReligion);
stream->Read(&m_iPrereqCiv); // Separatio
stream->Read(&m_iPrereqCorporation);
___________________________________________
stream->Write(m_iPrereqReligion);
stream->Write(m_iPrereqCiv); // Separatio
stream->Write(m_iPrereqCorporation);
___________________________________________
pXML->GetChildXmlValByName(szTextVal, "PrereqReligion");
m_iPrereqReligion = pXML->FindInInfoClass(szTextVal);
pXML->GetChildXmlValByName(szTextVal, "PrereqCiv"); // Separatio
m_aszExtraXMLforPass3.push_back(szTextVal);
pXML->GetChildXmlValByName(szTextVal, "PrereqCorporation");
m_iPrereqCorporation = pXML->FindInInfoClass(szTextVal);
___________________________________________
// Separatio START
bool CvBuildingInfo::readPass3()
{
if (m_aszExtraXMLforPass3.size() < 1)
{
FAssert(false);
return false;
}
m_iPrereqCiv = GC.getInfoTypeForString(m_aszExtraXMLforPass3[0]);
m_aszExtraXMLforPass3.clear();
return true;
}
// Separatio END
CvInfos.h:
Spoiler :
int getPrereqReligion() const;
int getPrereqCiv() const; // Separatio
int getPrereqCorporation() const;
___________________________________________
int m_iPrereqReligion;
int m_iPrereqCiv; // Separatio
int m_iPrereqCorporation;
___________________________________________
bool readPass3(); // Separatio
int getPrereqCiv() const; // Separatio
int getPrereqCorporation() const;
___________________________________________
int m_iPrereqReligion;
int m_iPrereqCiv; // Separatio
int m_iPrereqCorporation;
___________________________________________
bool readPass3(); // Separatio
CvCity.cpp:
Spoiler :
in CvCity::canConstruct
if (GC.getBuildingInfo(eBuilding).getPrereqReligion() != NO_RELIGION)
{
if (!(isHasReligion((ReligionTypes)(GC.getBuildingInfo(eBuilding).getPrereqReligion()))))
{
return false;
}
}
// Separatio START
if (GC.getBuildingInfo(eBuilding).getPrereqCiv() != NO_CIVILIZATION)
{
if (GC.getBuildingInfo(eBuilding).getPrereqCiv() != getCivilizationType())
{
return false;
}
}
// Separatio END
if (GC.getBuildingInfo(eBuilding).getPrereqReligion() != NO_RELIGION)
{
if (!(isHasReligion((ReligionTypes)(GC.getBuildingInfo(eBuilding).getPrereqReligion()))))
{
return false;
}
}
// Separatio START
if (GC.getBuildingInfo(eBuilding).getPrereqCiv() != NO_CIVILIZATION)
{
if (GC.getBuildingInfo(eBuilding).getPrereqCiv() != getCivilizationType())
{
return false;
}
}
// Separatio END
CvGameTextMsg.cpp:
Spoiler :
// Separatio START
// if ((eDefaultBuilding != NO_BUILDING) && (eUniqueBuilding != NO_BUILDING))
if (eDefaultBuilding != NO_BUILDING
&& (eUniqueBuilding != NO_BUILDING
|| GC.getBuildingInfo(eDefaultBuilding).getPrereqCiv() == eCivilization))
// Separatio END
___________________________________________
// Separatio START
// szBuffer.Format((bLinks ? L"<link=literal>%s</link> - (<link=literal>%s</link>)" : L"%s - (%s)"),
// GC.getBuildingInfo(eDefaultBuilding).getDescription(),
// GC.getBuildingInfo(eUniqueBuilding).getDescription());
if (GC.getBuildingInfo(eDefaultBuilding).getPrereqCiv() != eCivilization)
{
szBuffer.Format((bLinks ? L"<link=literal>%s</link> - (<link=literal>%s</link>)" : L"%s - (%s)"),
GC.getBuildingInfo(eDefaultBuilding).getDescription(),
GC.getBuildingInfo(eUniqueBuilding).getDescription());
}
else
{
szBuffer.Format((bLinks ? L"<link=literal>%s</link>" : L"%s"),
GC.getBuildingInfo(eDefaultBuilding).getDescription());
}
// Separatio END
// if ((eDefaultBuilding != NO_BUILDING) && (eUniqueBuilding != NO_BUILDING))
if (eDefaultBuilding != NO_BUILDING
&& (eUniqueBuilding != NO_BUILDING
|| GC.getBuildingInfo(eDefaultBuilding).getPrereqCiv() == eCivilization))
// Separatio END
___________________________________________
// Separatio START
// szBuffer.Format((bLinks ? L"<link=literal>%s</link> - (<link=literal>%s</link>)" : L"%s - (%s)"),
// GC.getBuildingInfo(eDefaultBuilding).getDescription(),
// GC.getBuildingInfo(eUniqueBuilding).getDescription());
if (GC.getBuildingInfo(eDefaultBuilding).getPrereqCiv() != eCivilization)
{
szBuffer.Format((bLinks ? L"<link=literal>%s</link> - (<link=literal>%s</link>)" : L"%s - (%s)"),
GC.getBuildingInfo(eDefaultBuilding).getDescription(),
GC.getBuildingInfo(eUniqueBuilding).getDescription());
}
else
{
szBuffer.Format((bLinks ? L"<link=literal>%s</link>" : L"%s"),
GC.getBuildingInfo(eDefaultBuilding).getDescription());
}
// Separatio END
XML tags:
Spoiler :
<PrereqReligion>NONE</PrereqReligion>
<PrereqCiv>CIVILIZATION_CORDUBA</PrereqCiv> //Separatio
<PrereqCorporation>NONE</PrereqCorporation>
<PrereqCiv>CIVILIZATION_CORDUBA</PrereqCiv> //Separatio
<PrereqCorporation>NONE</PrereqCorporation>
CyInfoInterface1.cpp:
Spoiler :
.def("getPrereqReligion", &CvBuildingInfo::getPrereqReligion, "int ()")
.def("getPrereqCiv", &CvBuildingInfo::getPrereqCiv, "int ()") // Separatio
.def("getPrereqCorporation", &CvBuildingInfo::getPrereqCorporation, "int ()")
.def("getPrereqCiv", &CvBuildingInfo::getPrereqCiv, "int ()") // Separatio
.def("getPrereqCorporation", &CvBuildingInfo::getPrereqCorporation, "int ()")
P.S.
Could i be missing some codes from the FFH2 regarding the effect ? Although possible i checked it three times and excluded all the prereqCiv they had for Civic, Events, Projects, Improvements