mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Use a const string for target name
This commit is contained in:
parent
7958ba38d8
commit
3317345d92
1 changed files with 8 additions and 22 deletions
|
@ -1681,38 +1681,24 @@ void ScriptVM::Execute(ScriptVariable *data, int dataSize, str label)
|
|||
break;
|
||||
|
||||
case OP_UN_TARGETNAME:
|
||||
targetList = world->GetExistingTargetList(m_VMStack.GetTop().stringValue());
|
||||
|
||||
if (!targetList) {
|
||||
value = m_VMStack.GetTop().stringValue();
|
||||
// retrieve the target name
|
||||
targetList = world->GetExistingTargetList(m_VMStack.GetTop().constStringValue());
|
||||
|
||||
if (!targetList || !targetList->NumObjects()) {
|
||||
// the target name was not found
|
||||
m_VMStack.GetTop().setListenerValue(NULL);
|
||||
|
||||
if ((*m_CodePos >= OP_BIN_EQUALITY && *m_CodePos <= OP_BIN_GREATER_THAN_OR_EQUAL)
|
||||
|| (*m_CodePos >= OP_BOOL_UN_NOT && *m_CodePos <= OP_UN_CAST_BOOLEAN)) {
|
||||
ScriptError("Targetname '%s' does not exist.", value.c_str());
|
||||
ScriptError("Targetname '%s' does not exist.", m_VMStack.GetTop().stringValue().c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetList->NumObjects() == 1) {
|
||||
} else if (targetList->NumObjects() == 1) {
|
||||
// single listener
|
||||
m_VMStack.GetTop().setListenerValue(targetList->ObjectAt(1));
|
||||
} else if (targetList->NumObjects() > 1) {
|
||||
// multiple listeners
|
||||
m_VMStack.GetTop().setContainerValue((Container<SafePtr<Listener>> *)targetList);
|
||||
} else {
|
||||
value = m_VMStack.GetTop().stringValue();
|
||||
|
||||
m_VMStack.GetTop().setListenerValue(NULL);
|
||||
|
||||
if ((*m_CodePos >= OP_BIN_EQUALITY && *m_CodePos <= OP_BIN_GREATER_THAN_OR_EQUAL)
|
||||
|| (*m_CodePos >= OP_BOOL_UN_NOT && *m_CodePos <= OP_UN_CAST_BOOLEAN)) {
|
||||
ScriptError("Targetname '%s' does not exist.", value.c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OP_VAR_UN_NOT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue