// Returns true if build finished...
bool CvPlot::changeBuildProgress(BuildTypes eBuild, int iChange, TeamTypes eTeam)
{
CvCity* pCity;
CvWString szBuffer;
int iProduction;
bool bFinished;
bFinished = false;
if (iChange != 0)
{
if (NULL == m_paiBuildProgress)
{
m_paiBuildProgress = new short[GC.getNumBuildInfos()];
for (int iI = 0; iI < GC.getNumBuildInfos(); ++iI)
{
m_paiBuildProgress[iI] = 0;
}
}
m_paiBuildProgress[eBuild] += iChange;
FAssert(getBuildProgress(eBuild) >= 0);
if (getBuildProgress(eBuild) >= getBuildTime(eBuild))
{
m_paiBuildProgress[eBuild] = 0;
if (GC.getBuildInfo(eBuild).getImprovement() != NO_IMPROVEMENT)
{
setImprovementType((ImprovementTypes)GC.getBuildInfo(eBuild).getImprovement());
}
if (GC.getBuildInfo(eBuild).getRoute() != NO_ROUTE)
{
setRouteType((RouteTypes)GC.getBuildInfo(eBuild).getRoute(), true);
}
if (getFeatureType() != NO_FEATURE)
{
if (GC.getBuildInfo(eBuild).isFeatureRemove(getFeatureType()))
{
FAssertMsg(eTeam != NO_TEAM, "eTeam should be valid");
iProduction = getFeatureProduction(eBuild, eTeam, &pCity);
if (iProduction > 0)
{
pCity->changeFeatureProduction(iProduction);
szBuffer = gDLL->getText("TXT_KEY_MISC_CLEARING_FEATURE_BONUS", GC.getFeatureInfo(getFeatureType()).getTextKeyWide(), iProduction, pCity->getNameKey());
gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, ARTFILEMGR.getInterfaceArtInfo("WORLDBUILDER_CITY_EDIT")->getPath(), MESSAGE_TYPE_INFO, GC.getFeatureInfo(getFeatureType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), getX_INLINE(), getY_INLINE(), true, true);
}
// Python Event
gDLL->getEventReporterIFace()->plotFeatureRemoved(this, getFeatureType(), pCity);
setFeatureType(NO_FEATURE);
}
}
bFinished = true;
}
}
return bFinished;
}