ThorHammerz
zzz
- Joined
- Jul 31, 2014
- Messages
- 836
Hi all,
Background: I implemented a function to give a building X yields of faith dependent on the number of mountains, with the code in CvPlayer.cpp looking something like
However, the issue I'm finding is that when I sell the building back, the game would act as if I had just added an additional building (i.e. the yield bonus would increase), and this could be repeated (theoretically, I only got my faith bonus to 1,000~ or so before I got bored) an infinite number of times.
As the custom logging file I set up showed the number of mountains detected around the city to be constant (x5), I am wondering if there was something like a delete-cache function that I forgot to implement?
Background: I implemented a function to give a building X yields of faith dependent on the number of mountains, with the code in CvPlayer.cpp looking something like
Spoiler :
Code:
#ifdef Imperial_Num_Nearby_Mountain
int iNumNearbyMountain = 0;
int FaithPerMountain = 0;
int FaithFromMountains = 0;
iNumNearbyMountain = pLoopCity->GetNumMountain();
#endif
#ifdef Imperial_NearbyMountainYield
FaithPerMountain = pBuildingInfo->FaithPerNearbyMountain();
FaithFromMountains = FaithPerMountain * iNumNearbyMountain;
Imperial_Logging(iNumNearbyMountain, FaithPerMountain); // logging.
pLoopCity->ChangeFaithPerTurnFromBuildings(FaithFromMountains);
#endif
However, the issue I'm finding is that when I sell the building back, the game would act as if I had just added an additional building (i.e. the yield bonus would increase), and this could be repeated (theoretically, I only got my faith bonus to 1,000~ or so before I got bored) an infinite number of times.
As the custom logging file I set up showed the number of mountains detected around the city to be constant (x5), I am wondering if there was something like a delete-cache function that I forgot to implement?