Skip to content

Commit e188573

Browse files
committed
Fixed a failed assert check in citem cantick and another (good) failed assertion in Animal Lore skill
1 parent 6b5e7c8 commit e188573

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/game/clients/CClientTarg.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ int CClient::OnSkill_AnimalLore( CUID uid, int iSkillLevel, bool fTest )
749749
{
750750
ADDTOCALLSTACK("CClient::OnSkill_AnimalLore");
751751
UnreferencedParameter(iSkillLevel);
752+
// Returns: difficulty.
752753
// SKILL_ANIMALLORE
753754
// The creature is a "human" etc..
754755
// How happy.
@@ -794,14 +795,22 @@ int CClient::OnSkill_AnimalLore( CUID uid, int iSkillLevel, bool fTest )
794795
}
795796

796797
// Who is master ?
797-
CChar * pCharOwner = pChar->NPC_PetGetOwner();
798+
CChar * pCharOwner = nullptr;
799+
if (pChar->IsNPC())
800+
{
801+
pCharOwner = pChar->NPC_PetGetOwner();
802+
}
803+
798804
if ( pCharOwner == nullptr )
799805
{
800-
snprintf(pszTemp, Str_TempLength(), g_Cfg.GetDefaultMsg( DEFMSG_ANIMALLORE_FREE ), pszHe, pszHis);
806+
snprintf(pszTemp, Str_TempLength(), g_Cfg.GetDefaultMsg( DEFMSG_ANIMALLORE_FREE ),
807+
pszHe, pszHis);
801808
}
802809
else
803810
{
804-
snprintf(pszTemp, Str_TempLength(), g_Cfg.GetDefaultMsg( DEFMSG_ANIMALLORE_MASTER ), pszHe, ( pCharOwner == m_pChar ) ? g_Cfg.GetDefaultMsg( DEFMSG_ANIMALLORE_MASTER_YOU ) : pCharOwner->GetName());
811+
lpctstr ptcMasterName = ( pCharOwner == m_pChar ) ? g_Cfg.GetDefaultMsg( DEFMSG_ANIMALLORE_MASTER_YOU ) : pCharOwner->GetName();
812+
snprintf(pszTemp, Str_TempLength(), g_Cfg.GetDefaultMsg( DEFMSG_ANIMALLORE_MASTER ),
813+
pszHe, ptcMasterName);
805814
// How loyal to master ?
806815
}
807816
addObjMessage(pszTemp, pChar );

src/game/items/CItem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6166,7 +6166,7 @@ bool CItem::_CanTick(bool fParentGoingToSleep) const
61666166
EXC_TRY("Able to tick?");
61676167

61686168
const CSObjCont* pParent = GetParent();
6169-
6169+
61706170
// Sanity check: isn't it placed in the world?
61716171
ASSERT(pParent);
61726172

@@ -6183,7 +6183,7 @@ bool CItem::_CanTick(bool fParentGoingToSleep) const
61836183
if (!pCont && IsAttr(ATTR_DECAY))
61846184
{
61856185
// If pCont is not a CObjBase, it will most probably be a CSector. Decaying items won't go to sleep.
6186-
ASSERT(dynamic_cast<const CSector*>(pParent));
6186+
ASSERT(dynamic_cast<const CSectorObjCont*>(pParent));
61876187
return false;
61886188
}
61896189

0 commit comments

Comments
 (0)