mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Optimized ScriptVM::EventGoto
This commit is contained in:
parent
7258a2e972
commit
421126db38
1 changed files with 21 additions and 7 deletions
|
@ -1992,16 +1992,30 @@ EventGoto
|
|||
*/
|
||||
void ScriptVM::EventGoto(Event *ev)
|
||||
{
|
||||
str label = ev->GetString(1);
|
||||
unsigned char* codePos;
|
||||
const ScriptVariable& value = ev->GetValue(1);
|
||||
if (value.type == VARIABLE_CONSTSTRING)
|
||||
{
|
||||
const_str label = value.constStringValue();
|
||||
codePos = m_ScriptClass->FindLabel(label);
|
||||
|
||||
if (!codePos) {
|
||||
ScriptError("ScriptVM::EventGoto: label '%s' does not exist in '%s'.", value.stringValue().c_str(), Filename().c_str());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
str label = value.stringValue();
|
||||
codePos = m_ScriptClass->FindLabel(label);
|
||||
|
||||
if (!codePos) {
|
||||
ScriptError("ScriptVM::EventGoto: label '%s' does not exist in '%s'.", label.c_str(), Filename().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
SetFastData(ev->data + 1, ev->dataSize - 1);
|
||||
|
||||
unsigned char *codePos = m_ScriptClass->FindLabel(label);
|
||||
|
||||
if (!codePos) {
|
||||
ScriptError("ScriptVM::EventGoto: label '%s' does not exist in '%s'.", label.c_str(), Filename().c_str());
|
||||
}
|
||||
|
||||
m_CodePos = codePos;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue