Ekmek
on steam: ekmek_e
Ok I figured out this code:
and I see it comes from this sdk code:
So my code works, kind of. When I build the building it says the corporation is there (i do not want the HQ there) and it shows it in the city screen but it does not show up above the citybar (weird)
I just wonder is it based on this part (icorp, 1, 1, 1) and what does announce and arrows do?
Code:
# Petromod
if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_REFINERY"):
icorp = CvUtil.findInfoTypeNum[B](gc.getCorporationInfo, gc.getNumCorporationInfos(), "CORPORATION_3")
pCity.setHasCorporation(icorp, 1, 1, 1)[/B]
# Petromod
and I see it comes from this sdk code:
Code:
void CvCity::setHasCorporation(CorporationTypes eIndex, bool bNewValue, bool bAnnounce, bool bArrows)
Spoiler :
Code:
void CvCity::setHasCorporation(CorporationTypes eIndex, bool bNewValue, bool bAnnounce, bool bArrows)
{
FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
FAssertMsg(eIndex < GC.getNumCorporationInfos(), "eIndex expected to be < GC.getNumCorporationInfos()");
if (isHasCorporation(eIndex) != bNewValue)
{
if (bNewValue)
{
bool bReplacedHeadquarters = false;
for (int iCorp = 0; iCorp < GC.getNumCorporationInfos(); ++iCorp)
{
if (iCorp != eIndex && isHasCorporation((CorporationTypes)iCorp))
{
if (GC.getGameINLINE().isCompetingCorporation((CorporationTypes)iCorp, eIndex))
{
if (GC.getGameINLINE().getHeadquarters((CorporationTypes)iCorp) == this)
{
GC.getGameINLINE().replaceCorporation((CorporationTypes)iCorp, eIndex);
bReplacedHeadquarters = true;
}
else
{
setHasCorporation((CorporationTypes)iCorp, false, false);
}
}
}
}
if (bReplacedHeadquarters)
{
return; // already set the corporation in this city
}
}
m_pabHasCorporation[eIndex] = bNewValue;
GET_PLAYER(getOwnerINLINE()).changeHasCorporationCount(eIndex, ((isHasCorporation(eIndex)) ? 1 : -1));
CvCity* pHeadquarters = GC.getGameINLINE().getHeadquarters(eIndex);
if (NULL != pHeadquarters)
{
pHeadquarters->updateCorporation();
}
updateCorporation();
AI_setAssignWorkDirty(true);
setInfoDirty(true);
if (isHasCorporation(eIndex))
{
GC.getGameINLINE().makeCorporationFounded(eIndex, getOwnerINLINE());
}
if (bAnnounce)
{
for (int iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
if (getOwnerINLINE() == iI || GET_PLAYER((PlayerTypes)iI).hasHeadquarters(eIndex))
{
CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_CORPORATION_SPREAD", GC.getCorporationInfo(eIndex).getTextKeyWide(), getNameKey());
gDLL->getInterfaceIFace()->addMessage(((PlayerTypes)iI), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, GC.getCorporationInfo(eIndex).getSound(), MESSAGE_TYPE_MAJOR_EVENT, GC.getCorporationInfo(eIndex).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), getX_INLINE(), getY_INLINE(), bArrows, bArrows);
if (getOwnerINLINE() == iI)
{
CvWStringBuffer szBonusString;
GAMETEXT.setCorporationHelpCity(szBonusString, eIndex, this);
CvWString szBonusList;
bool bFirst = true;
for (int iJ = 0; iJ < GC.getDefineINT("NUM_CORPORATION_PREREQ_BONUSES"); ++iJ)
{
int iBonus = GC.getCorporationInfo(eIndex).getPrereqBonus(iJ);
if (iBonus != NO_BONUS)
{
CvWString szTemp;
szTemp.Format(L"%s", GC.getBonusInfo((BonusTypes)iBonus).getDescription());
setListHelp(szBonusList, L"", szTemp, L", ", bFirst);
bFirst = false;
}
}
szBuffer = gDLL->getText("TXT_KEY_MISC_CORPORATION_SPREAD_BONUS", GC.getCorporationInfo(eIndex).getTextKeyWide(), szBonusString.getCString(), getNameKey(), szBonusList.GetCString());
gDLL->getInterfaceIFace()->addMessage(((PlayerTypes)iI), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, GC.getCorporationInfo(eIndex).getSound(), MESSAGE_TYPE_MINOR_EVENT, GC.getCorporationInfo(eIndex).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), getX_INLINE(), getY_INLINE(), bArrows, bArrows);
}
}
}
}
}
if (bNewValue)
{
// Python Event
gDLL->getEventReporterIFace()->corporationSpread(eIndex, getOwnerINLINE(), this);
}
else
{
// Python Event
gDLL->getEventReporterIFace()->corporationRemove(eIndex, getOwnerINLINE(), this);
}
}
}
So my code works, kind of. When I build the building it says the corporation is there (i do not want the HQ there) and it shows it in the city screen but it does not show up above the citybar (weird)
I just wonder is it based on this part (icorp, 1, 1, 1) and what does announce and arrows do?