CvCity::setupWonderGraphics()
- Defined in
- CvCity.cpp, line 1245
- Class
- CvCity
- Hook name
CivHooks::CvCity_setupWonderGraphics
Hooks
static bool BeforeCvCity_setupWonderGraphics(CvCity* self);static void AfterCvCity_setupWonderGraphics(CvCity* self);static void ReplaceCvCity_setupWonderGraphics(void (*original)(CvCity*), CvCity* self);CivRegisterBefore<CivHooks::CvCity_setupWonderGraphics>(host, &BeforeCvCity_setupWonderGraphics);CivRegisterAfter<CivHooks::CvCity_setupWonderGraphics>(host, &AfterCvCity_setupWonderGraphics);CivRegisterReplace<CivHooks::CvCity_setupWonderGraphics>(host, &ReplaceCvCity_setupWonderGraphics);
Code
1245void CvCity::setupWonderGraphics()1246{1247 VALIDATE_OBJECT1248 PlayerTypes ePlayerID = getOwner();1249 for(int eBuildingType = 0; eBuildingType < GC.getNumBuildingInfos(); eBuildingType++)1250 {1251 const BuildingTypes eBuilding = static_cast<BuildingTypes>(eBuildingType);1252 CvBuildingEntry* buildingInfo = GC.getBuildingInfo(eBuilding);12531254 //Only work with valid buildings.1255 if(buildingInfo == NULL)1256 continue;12571258 // if this building exists1259 int iExists = m_pCityBuildings->GetNumRealBuilding(eBuilding);1260 int iPreferredPosition = buildingInfo->GetPreferredDisplayPosition();1261 if(iPreferredPosition > 0)1262 {1263 if(iExists > 0)1264 {1265 // display the wonder1266 auto_ptr<ICvPlot1> pDllPlot(new CvDllPlot(plot()));1267 gDLL->GameplayWonderCreated(ePlayerID, pDllPlot.get(), eBuilding, 1);1268 }1269 else1270 {1271 if (isWorldWonderClass(buildingInfo->GetBuildingClassInfo()))1272 {1273 bool bShowHalfBuilt = false;1274 // Are we are constructing it?1275 if (eBuilding == getProductionBuilding())1276 {1277 bShowHalfBuilt = true;1278 }1279 else1280 {1281 // Is it part of an international project?1282 LeagueProjectTypes eThisBuildingProject = NO_LEAGUE_PROJECT;1283 for (int i = 0; i < GC.getNumLeagueProjectInfos(); i++)1284 {1285 LeagueProjectTypes eProject = (LeagueProjectTypes)i;1286 CvLeagueProjectEntry* pProjectInfo = GC.getLeagueProjectInfo(eProject);1287 if (pProjectInfo != NULL && pProjectInfo->GetRewardTier3() != NO_LEAGUE_PROJECT_REWARD) // Only check top reward tier1288 {1289 CvLeagueProjectRewardEntry* pRewardInfo = GC.getLeagueProjectRewardInfo(pProjectInfo->GetRewardTier3());1290 if (pRewardInfo != NULL && pRewardInfo->GetBuilding() == eBuilding)1291 {1292 eThisBuildingProject = eProject;1293 break;1294 }1295 }1296 }1297 if (eThisBuildingProject != NO_LEAGUE_PROJECT)1298 {1299 // Have we contributed anything to it?1300 if (GC.getGame().GetGameLeagues()->GetNumActiveLeagues() > 0)1301 {1302 CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetActiveLeague();1303 if (pLeague != NULL)1304 {1305 if (pLeague->IsProjectActive(eThisBuildingProject) && pLeague->GetMemberContribution(ePlayerID, eThisBuildingProject) > 0)1306 {1307 // Only show the graphic in the capital, since that is where the wonder would go1308 if (isCapital())1309 {1310 bShowHalfBuilt = true;1311 }1312 }1313 }1314 }1315 }13161317 1318 }13191320 if (bShowHalfBuilt)1321 {1322 auto_ptr<ICvPlot1> pDllPlot(new CvDllPlot(plot()));1323 gDLL->GameplayWonderCreated(ePlayerID, pDllPlot.get(), eBuilding, 0);1324 }1325 }1326 }1327 }1328 }1329}
Calls
- CvBuildingEntry::GetBuildingClassInfo() const
- CvBuildingEntry::GetPreferredDisplayPosition() const
- CvCity::getOwner() const
- CvCity::getProductionBuilding() const
- CvCity::isCapital() const
- CvCity::plot() const
- CvCityBuildings::GetNumRealBuilding(BuildingTypes) const
- CvDllPlot::CvDllPlot(CvPlot *)
- CvGame::GetGameLeagues()
- CvGameLeagues::GetActiveLeague()
- CvGameLeagues::GetNumActiveLeagues()
- CvGlobals::getBuildingInfo(BuildingTypes)
- CvGlobals::getDLLIFace()
- CvGlobals::getGame()
- CvGlobals::getLeagueProjectInfo(LeagueProjectTypes)
- CvGlobals::getLeagueProjectRewardInfo(LeagueProjectRewardTypes)
- CvGlobals::getNumBuildingInfos()
- CvGlobals::getNumLeagueProjectInfos()
- CvLeague::GetMemberContribution(PlayerTypes, LeagueProjectTypes) const
- CvLeague::IsProjectActive(LeagueProjectTypes) const
- CvLeagueProjectEntry::GetRewardTier3() const
- CvLeagueProjectRewardEntry::GetBuilding() const
ICvEngineUtility1::GameplayWonderCreated- isWorldWonderClass(const CvBuildingClassInfo &)
std::auto_ptr::auto_ptrstd::auto_ptr::get