void CvUnit::gift(bool bTestTransport)
{
CvUnit* pGiftUnit;
CvWString szBuffer;
PlayerTypes eOwner;
if (!canGift(false, bTestTransport))
{
return;
}
std::vector<CvUnit*> aCargoUnits;
getCargoUnits(aCargoUnits);
for (uint i = 0; i < aCargoUnits.size(); ++i)
{
aCargoUnits[i]->gift(false);
}
FAssertMsg(plot()->getOwnerINLINE() != NO_PLAYER, "plot()->getOwnerINLINE() is not expected to be equal with NO_PLAYER");
pGiftUnit = GET_PLAYER(plot()->getOwnerINLINE()).initUnit(getUnitType(), getX_INLINE(), getY_INLINE(), AI_getUnitAIType());
FAssertMsg(pGiftUnit != NULL, "GiftUnit is not assigned a valid value");
eOwner = getOwnerINLINE();
pGiftUnit->convert(this);
[B]GET_PLAYER(pGiftUnit->getOwnerINLINE()).AI_changePeacetimeGrantValue(eOwner, (pGiftUnit->getUnitInfo().getProductionCost() / 5));[/B]
szBuffer = gDLL->getText("TXT_KEY_MISC_GIFTED_UNIT_TO_YOU", GET_PLAYER(eOwner).getNameKey(), pGiftUnit->getNameKey());
gDLL->getInterfaceIFace()->addMessage(pGiftUnit->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_UNITGIFTED", MESSAGE_TYPE_INFO, pGiftUnit->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), pGiftUnit->getX_INLINE(), pGiftUnit->getY_INLINE(), true, true);
// Python Event
CvEventReporter::getInstance().unitGifted(pGiftUnit, getOwnerINLINE(), plot());
}