I found a bug in this mod. When you have no cities (for example, right at the start of the game, or when playing with the require complete kill option) and kill a creature that would provide food, the game crashes completely and sends you immediately back to the desktop.
I am currently working on fixing this issue.
/*** FOODFROMANIMALS 8/14/07 by DPII START ***/
if (!pDefender->isBarbarian())
{
pNearestCity = GC.getMapINLINE().findCity(getX_INLINE(), getY_INLINE(), pDefender->getOwnerINLINE(), NO_TEAM, true, false);
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
if (GC.getUnitInfo(getUnitType()).getYieldFromKill(iI) > 0)
{
iYield = GC.getUnitInfo(getUnitType()).getYieldFromKill((YieldTypes)iI);
switch ((YieldTypes)iI)
{
case YIELD_FOOD:
pNearestCity->changeFood(iYield);
break;
case YIELD_PRODUCTION:
pNearestCity->changeProduction(iYield);
break;
}
szBuffer = gDLL->getText("TXT_KEY_MISC_YIELD_FROM_UNIT", GC.getUnitInfo(pDefender->getUnitType()).getTextKeyWide(), iYield, GC.getYieldInfo((YieldTypes)iI).getChar(), pNearestCity->getNameKey());
gDLL->getInterfaceIFace()->addMessage(pNearestCity->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, ARTFILEMGR.getInterfaceArtInfo("WORLDBUILDER_CITY_EDIT")->getPath(), MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), pDefender->getX_INLINE(), pDefender->getY_INLINE(), true, true);
}
}
}
/*** FOODFROMANIMALS END ***/
/*** FOODFROMANIMALS 8/14/07 by DPII START ***/
if (!pDefender->isBarbarian())
{
pNearestCity = GC.getMapINLINE().findCity(getX_INLINE(), getY_INLINE(), pDefender->getOwnerINLINE(), NO_TEAM, true, false);
[B] if(pNearestCity != NULL)
{
[/B] for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
if (GC.getUnitInfo(getUnitType()).getYieldFromKill(iI) > 0)
{
iYield = GC.getUnitInfo(getUnitType()).getYieldFromKill((YieldTypes)iI);
switch ((YieldTypes)iI)
{
case YIELD_FOOD:
pNearestCity->changeFood(iYield);
break;
case YIELD_PRODUCTION:
pNearestCity->changeProduction(iYield);
break;
}
szBuffer = gDLL->getText("TXT_KEY_MISC_YIELD_FROM_UNIT", GC.getUnitInfo(pDefender->getUnitType()).getTextKeyWide(), iYield, GC.getYieldInfo((YieldTypes)iI).getChar(), pNearestCity->getNameKey());
gDLL->getInterfaceIFace()->addMessage(pNearestCity->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, ARTFILEMGR.getInterfaceArtInfo("WORLDBUILDER_CITY_EDIT")->getPath(), MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), pDefender->getX_INLINE(), pDefender->getY_INLINE(), true, true);
}
}
[B] }[/B]
}
/*** FOODFROMANIMALS END ***/
The values are already stored in the CvPlayer class, so you'd just have to add new XML tags (and the SDK code to read them obviously) to make this work.
Actually once it is re-uploaded and I play with it you can SORT OF do that with the changes I will be making. I want these fields in PromotionInfos instead of UnitInfos for my usesShould be pretty easy to move it from the one area to the other, and once loaded up for Promotions you can just have the Tech provide a Free Promotion to all units to accomplish your goal.