mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-15 14:47:13 +02:00
Minor changes in the entity types code style.
This commit is contained in:
@ -108,10 +108,14 @@ void CCheckpoint::BindEvent(Int32 evid, Object & env, Function & func) const
|
||||
Function & event = _Core->GetCheckpointEvent(m_ID, evid);
|
||||
// Is the specified callback function null?
|
||||
if (func.IsNull())
|
||||
{
|
||||
event.Release(); // Then release the current callback
|
||||
}
|
||||
// Assign the specified environment and function
|
||||
else
|
||||
{
|
||||
event = Function(env.GetVM(), env, func.GetFunc());
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -119,7 +123,9 @@ bool CCheckpoint::IsStreamedFor(CPlayer & player) const
|
||||
{
|
||||
// Is the specified player even valid?
|
||||
if (!player.IsActive())
|
||||
{
|
||||
SqThrowF("Invalid player argument: null");
|
||||
}
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
@ -448,7 +454,9 @@ static const Object & Checkpoint_FindByID(Int32 id)
|
||||
{
|
||||
// Perform a range check on the specified identifier
|
||||
if (INVALID_ENTITYEX(id, SQMOD_CHECKPOINT_POOL))
|
||||
{
|
||||
SqThrowF("The specified checkpoint identifier is invalid: %d", id);
|
||||
}
|
||||
// Obtain the ends of the entity pool
|
||||
Core::Checkpoints::const_iterator itr = _Core->GetCheckpoints().cbegin();
|
||||
Core::Checkpoints::const_iterator end = _Core->GetCheckpoints().cend();
|
||||
@ -457,7 +465,9 @@ static const Object & Checkpoint_FindByID(Int32 id)
|
||||
{
|
||||
// Does the identifier match the specified one?
|
||||
if (itr->mID == id)
|
||||
{
|
||||
return itr->mObj; // Stop searching and return this entity
|
||||
}
|
||||
}
|
||||
// Unable to locate a checkpoint matching the specified identifier
|
||||
return NullObject();
|
||||
@ -466,8 +476,10 @@ static const Object & Checkpoint_FindByID(Int32 id)
|
||||
static const Object & Checkpoint_FindByTag(CSStr tag)
|
||||
{
|
||||
// Perform a validity check on the specified tag
|
||||
if (!tag || *tag == 0)
|
||||
if (!tag || *tag == '\0')
|
||||
{
|
||||
SqThrowF("The specified checkpoint tag is invalid: null/empty");
|
||||
}
|
||||
// Obtain the ends of the entity pool
|
||||
Core::Checkpoints::const_iterator itr = _Core->GetCheckpoints().cbegin();
|
||||
Core::Checkpoints::const_iterator end = _Core->GetCheckpoints().cend();
|
||||
@ -476,7 +488,9 @@ static const Object & Checkpoint_FindByTag(CSStr tag)
|
||||
{
|
||||
// Does this entity even exist and does the tag match the specified one?
|
||||
if (itr->mInst != nullptr && itr->mInst->GetTag().compare(tag) == 0)
|
||||
{
|
||||
return itr->mObj; // Stop searching and return this entity
|
||||
}
|
||||
}
|
||||
// Unable to locate a checkpoint matching the specified tag
|
||||
return NullObject();
|
||||
|
Reference in New Issue
Block a user