int CItemMemory::FixWeirdness() { ADDTOCALLSTACK("CItemMemory::FixWeirdness"); int iResultCode = CItem::FixWeirdness(); if ( iResultCode ) return iResultCode; if ( !IsItemEquipped() || (GetEquipLayer() != LAYER_SPECIAL) || !GetMemoryTypes() ) // has to be a memory of some sort. return 0x4222; // get rid of it. CChar *pChar = dynamic_cast<CChar *>(GetParent()); if ( !pChar ) return 0x4223; // get rid of it. // Make sure guild/town memories are linked correctly if ( IsMemoryTypes(MEMORY_GUILD|MEMORY_TOWN) ) { const CItemStone *pStone = pChar->Guild_Find(static_cast<MEMORY_TYPE>(GetMemoryTypes())); if ( !pStone || pStone->GetUID() != m_uidLink ) return 0x4224; // get rid of it. if ( !pStone->GetMember(pChar) ) return 0x4225; // get rid of it. } // Make sure guard memories are linked correctly (this is not an ERROR, just make the item decay on next tick) if ( IsMemoryTypes(MEMORY_GUARD) && !m_uidLink.ObjFind() ) { SetAttr(ATTR_DECAY); SetTimeout(0); } return 0; }
int CItemMemory::FixWeirdness() { int iResultCode = CItem::FixWeirdness(); if ( iResultCode ) { bailout: return( iResultCode ); } if ( ! IsItemEquipped() || GetEquipLayer() != LAYER_SPECIAL || ! GetMemoryTypes()) // has to be a memory of some sort. { iResultCode = 0x4222; goto bailout; // get rid of it. } CChar * pChar = dynamic_cast <CChar*>( GetParent()); if ( pChar == NULL ) { iResultCode = 0x4223; goto bailout; // get rid of it. } // If it is my guild make sure i am linked to it correctly ! if ( IsMemoryTypes(MEMORY_GUILD|MEMORY_TOWN)) { CItemStone * pStone = pChar->Guild_Find((MEMORY_TYPE) GetMemoryTypes()); if ( pStone == NULL || pStone->GetUID() != m_uidLink ) { iResultCode = 0x4224; goto bailout; // get rid of it. } if ( ! pStone->GetMember( pChar )) { iResultCode = 0x4225; goto bailout; // get rid of it. } } return( 0 ); }
int CItemMemory::FixWeirdness() { ADDTOCALLSTACK("CItemMemory::FixWeirdness"); int iResultCode = CItem::FixWeirdness(); if ( iResultCode ) return iResultCode; if ( !IsItemEquipped() || GetEquipLayer() != LAYER_SPECIAL || !GetMemoryTypes() ) // has to be a memory of some sort. { iResultCode = 0x4222; return iResultCode; // get rid of it. } CChar *pChar = dynamic_cast<CChar*>(GetParent()); if ( !pChar ) { iResultCode = 0x4223; return iResultCode; // get rid of it. } // If it is my guild make sure I am linked to it correctly ! if ( IsMemoryTypes(MEMORY_GUILD|MEMORY_TOWN) ) { const CItemStone *pStone = pChar->Guild_Find(static_cast<MEMORY_TYPE>(GetMemoryTypes())); if ( !pStone || pStone->GetUID() != m_uidLink ) { iResultCode = 0x4224; return iResultCode; // get rid of it. } if ( !pStone->GetMember(pChar) ) { iResultCode = 0x4225; return iResultCode; // get rid of it. } } return 0; }