TC01
Deity
I want to add an XML tag to goodies that will allow me to set a required improvement for that goody. So I could, say, make the barbarian spawning goodies only occur on a "Barbarian Village" improvement, and make the others only occur on the regular Goody Hut. (that's not actually what I want to do, it's just an example.
I added this code to CvPlayer::canReceiveGoody:
The problem is, now no goodies are received at all, no matter which improvement I move on to. I tried increasing the "NUM_DO_GOODY_ATTEMPTS" global define from 10 to 100, but that didn't fix the issue.
I then tried removing all the RequiredImprovement tags from all goodies (they default to NO_IMPROVEMENT), and things worked again. So the problem is the comparison against the plot's improvement type. For some reason it doesn't think that the plot improvement type equals the required improvement... even when it does.
Maybe it's just my relative inexperience in the DLL, but I have no idea why. So... any ideas?
I added this code to CvPlayer::canReceiveGoody:
Code:
if (GC.getGoodyInfo(eGoody).getRequiredImprovement() != NO_IMPROVEMENT)
{
if (pPlot->getImprovementType() != GC.getGoodyInfo(eGoody).getRequiredImprovement())
{
return false;
}
}
The problem is, now no goodies are received at all, no matter which improvement I move on to. I tried increasing the "NUM_DO_GOODY_ATTEMPTS" global define from 10 to 100, but that didn't fix the issue.
I then tried removing all the RequiredImprovement tags from all goodies (they default to NO_IMPROVEMENT), and things worked again. So the problem is the comparison against the plot's improvement type. For some reason it doesn't think that the plot improvement type equals the required improvement... even when it does.
Maybe it's just my relative inexperience in the DLL, but I have no idea why. So... any ideas?