Skip to content

Commit

Permalink
Removed unused function CItemMulti::Multi_ListObjs()
Browse files Browse the repository at this point in the history
  • Loading branch information
coruja747 committed Apr 9, 2016
1 parent dd71ad7 commit 0dc0ebf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 76 deletions.
32 changes: 9 additions & 23 deletions src/graysvr/CCharNPCStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,35 +628,21 @@ int CChar::NPC_GetAttackMotivation( CChar * pChar, int iMotivation ) const
// Am I stronger than he is ? Should I continue fighting ?
// Take into consideration AC, health, skills, etc..
// RETURN:
// <-1 = dead meat. (run away)
// 0 = I'm have no interest.
// 50 = even match.
// 100 = he's a push over.
// < 0 = dead meat. (run away)
// 0 = I'm have no interest.
// 50 = even match.
// 100 = he's a push over.

if ( !m_pNPC || !pChar || !pChar->m_pArea )
return 0;
if ( Stat_GetVal(STAT_STR) <= 0 )
return -1; // I'm dead
// Is the target interesting ?
if ( pChar->m_pArea->IsFlag( REGION_FLAG_SAFE )) // universal
if ( IsStatFlag(STATF_DEAD) || pChar->IsStatFlag(STATF_DEAD) )
return 0;
if ( pChar->IsStatFlag(STATF_DEAD) && pChar->m_pNPC && pChar->m_pNPC->m_bonded )
if ( pChar->m_pArea->IsFlag(REGION_FLAG_SAFE) )
return 0;
// If the area is guarded then think better of this.
if ( pChar->m_pArea->IsGuarded() && m_pNPC->m_Brain != NPCBRAIN_GUARD ) // too smart for this.
{
iMotivation -= Stat_GetAdjusted(STAT_INT) / 20;
}

// Owned by or is one of my kind ?

iMotivation += NPC_GetHostilityLevelToward( pChar );

iMotivation += NPC_GetHostilityLevelToward(pChar);
if ( iMotivation > 0 )
{
// Am i injured etc ?
iMotivation = NPC_GetAttackContinueMotivation( pChar, iMotivation );
}
iMotivation = NPC_GetAttackContinueMotivation(pChar, iMotivation); // Am i injured etc ?

return iMotivation;
}

54 changes: 2 additions & 52 deletions src/graysvr/CItemMulti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ void CItemMulti::r_Write( CScript & s )
m_pRegion->r_WriteBody( s, "REGION." );
}
}

bool CItemMulti::r_WriteVal( LPCTSTR pszKey, CGString & sVal, CTextConsole * pSrc )
{
ADDTOCALLSTACK("CItemMulti::r_WriteVal");
Expand Down Expand Up @@ -507,60 +508,9 @@ bool CItemMulti::r_LoadVal( CScript & s )
EXC_DEBUG_END;
return false;
}

void CItemMulti::DupeCopy( const CItem * pItem )
{
ADDTOCALLSTACK("CItemMulti::DupeCopy");
CItem::DupeCopy(pItem);
}


size_t CItemMulti::Multi_ListObjs(CObjBase ** ppObjList)
{
ADDTOCALLSTACK("CItemMulti::Multi_ListObjs");
// List all the objects in the structure.

if (!IsTopLevel())
return 0;

int iMaxDist = Multi_GetMaxDist();

// always list myself first. All other items must see my new region !
size_t iCount = 0;
ppObjList[iCount++] = this;

CWorldSearch AreaChar(GetTopPoint(), iMaxDist);
AreaChar.SetAllShow(true);
AreaChar.SetSearchSquare(true);
while (iCount < MAX_MULTI_CONTENT)
{
CChar * pChar = AreaChar.GetChar();
if (pChar == NULL)
break;
if (!m_pRegion->IsInside2d(pChar->GetTopPoint()))
continue;
if (pChar->IsDisconnected() && pChar->m_pNPC)
continue;

ppObjList[iCount++] = pChar;
}

CWorldSearch AreaItem(GetTopPoint(), iMaxDist);
AreaItem.SetSearchSquare(true);
while (iCount < MAX_MULTI_CONTENT)
{
CItem * pItem = AreaItem.GetItem();
if (pItem == NULL)
break;
if (pItem == this) // already listed.
continue;
if (!Multi_IsPartOf(pItem))
{
if (!m_pRegion->IsInside2d(pItem->GetTopPoint()))
continue;
if (!pItem->IsMovable())
continue;
}
ppObjList[iCount++] = pItem;
}
return(iCount);
}
1 change: 0 additions & 1 deletion src/graysvr/CObjBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,6 @@ class CItemMulti : public CItem

public:
int Multi_GetMaxDist() const;
size_t Multi_ListObjs(CObjBase ** ppObjList);
struct ShipSpeed // speed of a ship
{
unsigned char period; // time between movement
Expand Down

0 comments on commit 0dc0ebf

Please sign in to comment.