mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Fix inspection parameters.
This commit is contained in:
parent
479272d59f
commit
076d778e50
@ -304,7 +304,7 @@ void PvClass::AssignParent(const Ref & parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool PvClass::Can(SQInteger id) const
|
bool PvClass::Can(SQInteger id, SQInteger req) const
|
||||||
{
|
{
|
||||||
// Get the current status of the specified entry
|
// Get the current status of the specified entry
|
||||||
SQInteger current = GetEntryValue(id);
|
SQInteger current = GetEntryValue(id);
|
||||||
@ -314,7 +314,7 @@ bool PvClass::Can(SQInteger id) const
|
|||||||
if (!query.IsNull())
|
if (!query.IsNull())
|
||||||
{
|
{
|
||||||
// Attempt arbitration
|
// Attempt arbitration
|
||||||
LightObj r = query.Eval(current);
|
LightObj r = query.Eval(current, req);
|
||||||
// If NULL or false the request was denied
|
// If NULL or false the request was denied
|
||||||
if (!r.IsNull() && r.Cast< bool >())
|
if (!r.IsNull() && r.Cast< bool >())
|
||||||
{
|
{
|
||||||
@ -415,12 +415,12 @@ void PvClass::EachUnitID(Object & ctx, Function & func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
bool SqPvClass::Can(LightObj & obj) const
|
bool SqPvClass::Can(LightObj & obj, SQInteger req) const
|
||||||
{
|
{
|
||||||
// Entry ID?
|
// Entry ID?
|
||||||
if (obj.GetType() == OT_INTEGER)
|
if (obj.GetType() == OT_INTEGER)
|
||||||
{
|
{
|
||||||
return Valid().Can(obj.Cast< SQInteger >());
|
return Valid().Can(obj.Cast< SQInteger >(), req);
|
||||||
}
|
}
|
||||||
// Entry tag?
|
// Entry tag?
|
||||||
else if (obj.GetType() == OT_STRING)
|
else if (obj.GetType() == OT_STRING)
|
||||||
@ -443,12 +443,12 @@ bool SqPvClass::Can(LightObj & obj) const
|
|||||||
// Generate and cache the hash
|
// Generate and cache the hash
|
||||||
tag.CacheHash();
|
tag.CacheHash();
|
||||||
// Forward request
|
// Forward request
|
||||||
return c.Can(c.ValidManager().GetValidEntryWithTag(tag)->mID);
|
return c.Can(c.ValidManager().GetValidEntryWithTag(tag)->mID, req);
|
||||||
}
|
}
|
||||||
// Entry instance?
|
// Entry instance?
|
||||||
else if (obj.GetType() == OT_INSTANCE && obj.GetTypeTag() == StaticClassTypeTag< SqPvEntry >::Get())
|
else if (obj.GetType() == OT_INSTANCE && obj.GetTypeTag() == StaticClassTypeTag< SqPvEntry >::Get())
|
||||||
{
|
{
|
||||||
return Valid().Can(obj.CastI< SqPvEntry >()->Valid().mID);
|
return Valid().Can(obj.CastI< SqPvEntry >()->Valid().mID, req);
|
||||||
}
|
}
|
||||||
STHROWF("Unknown or unsupported entry identification type (%s)", SqTypeName(obj.GetType()));
|
STHROWF("Unknown or unsupported entry identification type (%s)", SqTypeName(obj.GetType()));
|
||||||
SQ_UNREACHABLE
|
SQ_UNREACHABLE
|
||||||
|
@ -275,7 +275,7 @@ struct PvClass
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Check if this class has a certain privilege.
|
* Check if this class has a certain privilege.
|
||||||
*/
|
*/
|
||||||
SQMOD_NODISCARD bool Can(SQInteger id) const;
|
SQMOD_NODISCARD bool Can(SQInteger id, SQInteger req) const;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* See if a unit with a certain identifier inherits this class.
|
* See if a unit with a certain identifier inherits this class.
|
||||||
@ -354,7 +354,7 @@ struct SqPvClass
|
|||||||
mI.lock()->AssignParent(cls.mI.lock());
|
mI.lock()->AssignParent(cls.mI.lock());
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
bool Can(LightObj & obj) const;
|
bool Can(LightObj & obj, SQInteger req) const;
|
||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
void AssignPrivilegeWithID(SQInteger id, SQInteger value) { Valid().AssignPrivilege(id, value); }
|
void AssignPrivilegeWithID(SQInteger id, SQInteger value) { Valid().AssignPrivilege(id, value); }
|
||||||
void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().AssignPrivilege(tag, value); }
|
void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().AssignPrivilege(tag, value); }
|
||||||
|
@ -316,7 +316,7 @@ void PvUnit::AssignClass(const std::shared_ptr< PvClass > & cls)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool PvUnit::Can(SQInteger id) const
|
bool PvUnit::Can(SQInteger id, SQInteger req) const
|
||||||
{
|
{
|
||||||
// Get the current status of the specified entry
|
// Get the current status of the specified entry
|
||||||
SQInteger current = GetEntryValue(id);
|
SQInteger current = GetEntryValue(id);
|
||||||
@ -326,7 +326,7 @@ bool PvUnit::Can(SQInteger id) const
|
|||||||
if (!query.IsNull())
|
if (!query.IsNull())
|
||||||
{
|
{
|
||||||
// Attempt arbitration
|
// Attempt arbitration
|
||||||
LightObj r = query.Eval(current);
|
LightObj r = query.Eval(current, req);
|
||||||
// If NULL or false the request was denied
|
// If NULL or false the request was denied
|
||||||
if (!r.IsNull() && r.Cast< bool >())
|
if (!r.IsNull() && r.Cast< bool >())
|
||||||
{
|
{
|
||||||
@ -372,12 +372,12 @@ inline void SqPvUnit::SetClass(const SqPvClass & cls) const
|
|||||||
LightObj SqPvUnit::GetManager() const { return LightObj(ValidCls().mManager); }
|
LightObj SqPvUnit::GetManager() const { return LightObj(ValidCls().mManager); }
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool SqPvUnit::Can(LightObj & obj) const
|
bool SqPvUnit::Can(LightObj & obj, SQInteger req) const
|
||||||
{
|
{
|
||||||
// Entry ID?
|
// Entry ID?
|
||||||
if (obj.GetType() == OT_INTEGER)
|
if (obj.GetType() == OT_INTEGER)
|
||||||
{
|
{
|
||||||
return Valid().Can(obj.Cast< SQInteger >());
|
return Valid().Can(obj.Cast< SQInteger >(), req);
|
||||||
}
|
}
|
||||||
// Entry tag?
|
// Entry tag?
|
||||||
else if (obj.GetType() == OT_STRING)
|
else if (obj.GetType() == OT_STRING)
|
||||||
@ -400,12 +400,12 @@ bool SqPvUnit::Can(LightObj & obj) const
|
|||||||
// Generate and cache the hash
|
// Generate and cache the hash
|
||||||
tag.CacheHash();
|
tag.CacheHash();
|
||||||
// Forward request
|
// Forward request
|
||||||
return u.Can(u.ValidManager().GetValidEntryWithTag(tag)->mID);
|
return u.Can(u.ValidManager().GetValidEntryWithTag(tag)->mID, req);
|
||||||
}
|
}
|
||||||
// Entry instance?
|
// Entry instance?
|
||||||
else if (obj.GetType() == OT_INSTANCE && obj.GetTypeTag() == StaticClassTypeTag< SqPvEntry >::Get())
|
else if (obj.GetType() == OT_INSTANCE && obj.GetTypeTag() == StaticClassTypeTag< SqPvEntry >::Get())
|
||||||
{
|
{
|
||||||
return Valid().Can(obj.CastI< SqPvEntry >()->Valid().mID);
|
return Valid().Can(obj.CastI< SqPvEntry >()->Valid().mID, req);
|
||||||
}
|
}
|
||||||
STHROWF("Unknown or unsupported entry identification type (%s)", SqTypeName(obj.GetType()));
|
STHROWF("Unknown or unsupported entry identification type (%s)", SqTypeName(obj.GetType()));
|
||||||
SQ_UNREACHABLE
|
SQ_UNREACHABLE
|
||||||
|
@ -248,7 +248,7 @@ struct PvUnit
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Check if this unit has a certain privilege.
|
* Check if this unit has a certain privilege.
|
||||||
*/
|
*/
|
||||||
SQMOD_NODISCARD bool Can(SQInteger id) const;
|
SQMOD_NODISCARD bool Can(SQInteger id, SQInteger req) const;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Invoke a given callback with every owned entry identifier.
|
* Invoke a given callback with every owned entry identifier.
|
||||||
@ -300,7 +300,7 @@ struct SqPvUnit
|
|||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
SQMOD_NODISCARD LightObj GetManager() const;
|
SQMOD_NODISCARD LightObj GetManager() const;
|
||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
bool Can(LightObj & obj) const;
|
bool Can(LightObj & obj, SQInteger req) const;
|
||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
void AssignPrivilegeWithID(SQInteger id, SQInteger value) { Valid().AssignPrivilege(id, value); }
|
void AssignPrivilegeWithID(SQInteger id, SQInteger value) { Valid().AssignPrivilege(id, value); }
|
||||||
void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().AssignPrivilege(tag, value); }
|
void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().AssignPrivilege(tag, value); }
|
||||||
|
Loading…
Reference in New Issue
Block a user