// Pick cotton/hay/etc... // use the // IT_CROPS = transforms into a "ripe" variety then is used up on reaping. // IT_FOLIAGE = is not consumed on reap (unless eaten then will regrow invis) // bool CItem::Plant_Use(CChar *pChar) { ADDTOCALLSTACK("CItem::Plant_Use"); if ( !pChar ) return false; if ( !pChar->CanSeeItem(this) ) // might be invis underground return false; const CItemBase *pItemDef = Item_GetDef(); ITEMID_TYPE iFruitID = static_cast<ITEMID_TYPE>(RES_GET_INDEX(pItemDef->m_ttCrops.m_idFruit)); // if it's reapable at this stage if ( iFruitID <= 0 ) { // not ripe. (but we could just eat it if we are herbivorous ?) pChar->SysMessageDefault(DEFMSG_CROPS_NOT_RIPE); return true; } if ( m_itCrop.m_ReapFruitID ) iFruitID = static_cast<ITEMID_TYPE>(RES_GET_INDEX(m_itCrop.m_ReapFruitID)); if ( iFruitID ) { CItem *pItemFruit = CItem::CreateScript(iFruitID, pChar); if ( pItemFruit ) pChar->ItemBounce(pItemFruit); } else pChar->SysMessageDefault(DEFMSG_CROPS_NO_FRUIT); Plant_CropReset(); pChar->UpdateAnimate(ANIM_BOW); pChar->Sound(0x13e); return true; }
bool CItem::Plant_Use( CChar * pChar ) { ADDTOCALLSTACK("CItem::Plant_Use"); // Pick cotton/hay/etc... // use the // IT_CROPS = transforms into a "ripe" variety then is used up on reaping. // IT_FOLIAGE = is not consumed on reap (unless eaten then will regrow invis) // if ( !pChar ) return false; if ( ! pChar->CanSeeItem(this)) // might be invis underground. return( false ); const CItemBase * pItemDef = Item_GetDef(); ITEMID_TYPE iFruitID = static_cast<ITEMID_TYPE>(RES_GET_INDEX(pItemDef->m_ttCrops.m_idFruit)); // if it's reapable at this stage. if ( iFruitID <= 0 ) { // not ripe. (but we could just eat it if we are herbivorous ?) pChar->SysMessage( g_Cfg.GetDefaultMsg( DEFMSG_CROPS_NOT_RIPE ) ); return( true ); } if ( m_itCrop.m_ReapFruitID ) { iFruitID = static_cast<ITEMID_TYPE>(RES_GET_INDEX(m_itCrop.m_ReapFruitID)); } if ( iFruitID > 0 ) { CItem * pItemFruit = CItem::CreateScript( iFruitID , pChar ); if ( pItemFruit) { pChar->ItemBounce( pItemFruit ); } } else { pChar->SysMessage( g_Cfg.GetDefaultMsg( DEFMSG_CROPS_NO_FRUIT ) ); } Plant_CropReset(); pChar->UpdateAnimate( ANIM_BOW ); pChar->Sound( 0x13e ); return true; }
bool CItem::Plant_Use( CChar * pChar ) { // Pick cotton/hay/etc... // use the // IT_CROPS = transforms into a "ripe" variety then is used up on reaping. // IT_FOLIAGE = is not consumed on reap (unless eaten then will regrow invis) // DEBUG_CHECK( IsType(IT_CROPS) || IsType(IT_FOLIAGE)); ASSERT(pChar); if ( ! pChar->CanSeeItem(this)) // might be invis underground. return( false ); CItemBase * pItemDef = Item_GetDef(); ITEMID_TYPE iFruitID = (ITEMID_TYPE) RES_GET_INDEX( pItemDef->m_ttCrops.m_idFruit ); // if it's reapable at this stage. if ( iFruitID <= 0 ) { // not ripe. (but we could just eat it if we are herbivorous ?) pChar->SysMessage( "None of the crops are ripe enough." ); return( true ); } if ( m_itCrop.m_ReapFruitID ) { iFruitID = (ITEMID_TYPE) RES_GET_INDEX( m_itCrop.m_ReapFruitID ); } if ( iFruitID > 0 ) { CItem * pItemFruit = CItem::CreateScript( iFruitID , pChar ); if ( pItemFruit) { pChar->ItemBounce( pItemFruit ); } } else { pChar->SysMessage( "The plant yields nothing useful" ); } Plant_CropReset(); pChar->UpdateAnimate( ANIM_BOW ); pChar->Sound( 0x13e ); return true; }