mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Added IsConstArray()
This commit is contained in:
parent
ce9c9121ce
commit
1b1de99e53
2 changed files with 41 additions and 2 deletions
|
@ -671,6 +671,13 @@ qboolean ScriptVariable::IsNumeric( void )
|
|||
return type == VARIABLE_INTEGER || type == VARIABLE_FLOAT;
|
||||
}
|
||||
|
||||
qboolean ScriptVariable::IsConstArray() const
|
||||
{
|
||||
return type == VARIABLE_CONSTARRAY
|
||||
|| type == VARIABLE_CONTAINER
|
||||
|| type == VARIABLE_SAFECONTAINER;
|
||||
}
|
||||
|
||||
#ifndef NO_SCRIPTENGINE
|
||||
|
||||
qboolean ScriptVariable::IsSimpleEntity( void )
|
||||
|
@ -1139,6 +1146,25 @@ Listener *ScriptVariable::listenerValue( void ) const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Listener* ScriptVariable::listenerAt(uintptr_t index) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VARIABLE_CONSTARRAY:
|
||||
return m_data.constArrayValue->constArrayValue[index].listenerValue();
|
||||
|
||||
case VARIABLE_CONTAINER:
|
||||
return m_data.containerValue->ObjectAt(index);
|
||||
|
||||
case VARIABLE_SAFECONTAINER:
|
||||
assert(*m_data.safeContainerValue);
|
||||
return (*m_data.safeContainerValue)->ObjectAt(index);
|
||||
|
||||
default:
|
||||
throw ScriptException("Cannot cast '%s' to listener", typenames[type]);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptVariable::newPointer( void )
|
||||
{
|
||||
type = VARIABLE_POINTER;
|
||||
|
@ -2501,6 +2527,16 @@ ScriptVariable *ScriptVariableList::SetVariable( unsigned int name, ScriptVariab
|
|||
return variable;
|
||||
}
|
||||
|
||||
ScriptVariable* ScriptVariableList::SetVariable(unsigned int name, ScriptVariable&& value)
|
||||
{
|
||||
ScriptVariable* variable = GetOrCreateVariable(name);
|
||||
|
||||
*variable = std::move(value);
|
||||
variable->SetKey(name);
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
void ScriptVariableList::Archive
|
||||
(
|
||||
Archiver &arc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue