本文整理汇总了C++中GetScriptId函数的典型用法代码示例。如果您正苦于以下问题:C++ GetScriptId函数的具体用法?C++ GetScriptId怎么用?C++ GetScriptId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetScriptId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Assert
void StepController::Activate(StepType stepType, InterpreterHaltState* haltState)
{
this->stepType = stepType;
this->byteOffset = haltState->GetCurrentOffset();
this->pActivatedContext = haltState->framePointers->Peek()->GetScriptContext();
Assert(this->pActivatedContext);
Js::FunctionBody* functionBody = haltState->GetFunction();
this->body.Root(functionBody, this->pActivatedContext->GetRecycler());
this->statementMap = body->GetMatchingStatementMapFromByteCode(byteOffset, false);
this->frameCountWhenSet = haltState->framePointers->Count();
if (stepType != STEP_DOCUMENT)
{
this->frameAddrWhenSet = (size_t)haltState->framePointers->Peek(0)->GetStackAddress();
}
else
{
// for doc mode, do not bail out automatically on frame changes
this->frameAddrWhenSet = (size_t)-1;
}
this->scriptIdWhenSet = GetScriptId(functionBody);
if (this->returnedValueList == nullptr)
{
this->returnedValueList = JsUtil::List<ReturnedValue*>::New(this->pActivatedContext->GetRecycler());
this->pActivatedContext->GetThreadContext()->SetReturnedValueList(this->returnedValueList);
}
}
示例2: OnGoClick
CW_DLL_EXPORT
bool OnGoClick (Player *pPlayer, GameObject *pGameObject)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnGoClick) return true;
return tmpscript->pOnGoClick(pPlayer,pGameObject);
}
示例3: OnCreatureKill
CW_DLL_EXPORT
void OnCreatureKill (Player *pPlayer, Creature *pCreature)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnCreatureKill) return;
tmpscript->pOnCreatureKill(pPlayer,pCreature);
}
示例4: OnAreaChange
CW_DLL_EXPORT
void OnAreaChange(Player *pPlayer, AreaTableEntry const *pArea)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnAreaChange) return;
tmpscript->pOnAreaChange(pPlayer, pArea);
}
示例5: OnItemOpen
Cw_DLL_EXPORT
bool OnItemOpen (Player *pPlayer, Item *pItem)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnItemOpen) return true;
return tmpscript->pOnItemOpen(pPlayer,pItem);
}
示例6: OnServerShutdown
CW_DLL_EXPORT
void OnServerShutdown()
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnServerShutdown) return;
tmpscript->pOnServerShutdown();
}
示例7: OnPlayerChat
CW_DLL_EXPORT
bool OnPlayerChat(Player *pPlayer, const char *text)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnPlayerChat) return true;
return tmpscript->pOnPlayerChat(pPlayer,text);
}
示例8: OnGetMoney
CW_DLL_EXPORT
uint32 OnGetMoney(Player *pPlayer, int32 amount)
{
Script *tmpscript = m_scripts[GetScriptId("scripted_on_events")];
if (!tmpscript || !tmpscript->pOnGetMoney) return amount;
return tmpscript->pOnGetMoney(pPlayer,amount);
}
示例9: GetScriptId
void Script::RegisterSelf()
{
int id = GetScriptId(Name.c_str());
if(id)
{
m_scripts[id] = this;
++num_sc_scripts;
}
}
示例10: GetScriptId
void Script::RegisterSelf()
{
// try to find scripts which try to use another script's allocated memory
// that means didn't allocate memory for script
for (uint16 i = 0; i < MAX_SCRIPTS; ++i)
{
// somebody forgot to allocate memory for a script by a method like this: newscript = new Script
if (m_scripts[i] == this)
{
sLog->outError("ScriptName: '%s' - Forgot to allocate memory, so this script and/or the script before that can't work.", Name.c_str());
// don't register it
// and don't delete it because its memory is used for another script
return;
}
}
int id = GetScriptId(Name.c_str());
if (id)
{
// try to find the script in assigned scripts
bool IsExist = false;
for (uint16 i = 0; i < MAX_SCRIPTS; ++i)
{
if (m_scripts[i])
{
// if the assigned script's name and the new script's name is the same
if (m_scripts[i]->Name == Name)
{
IsExist = true;
break;
}
}
}
// if the script doesn't assigned -> assign it!
if (!IsExist)
{
m_scripts[id] = this;
++num_sc_scripts;
}
// if the script is already assigned -> delete it!
else
{
// TODO: write a better error message than this one :)
sLog->outError("ScriptName: '%s' already assigned with the same ScriptName, so the script can't work.", Name.c_str());
delete this;
}
}
else
{
if (Name.find("example") == std::string::npos)
sLog->outErrorDb("TSCR: RegisterSelf, but script named %s does not have ScriptName assigned in database.", (this)->Name.c_str());
delete this;
}
}
示例11: GetScriptId
void Script::RegisterSelf()
{
int id = GetScriptId(Name.c_str());
if (id != 0)
{
m_scripts[id] = this;
++num_sc_scripts;
}
else
{
debug_log("SD2: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str());
delete this;
}
}
示例12: RegisterSelf
void Script::RegisterSelf(bool bReportError)
{
if (uint32 id = GetScriptId(Name))
{
m_scripts->at(id) = this;
++num_sc_scripts;
}
else
{
if (bReportError)
script_error_log("Script registering but ScriptName %s is not assigned in database. Script will not be used.", Name);
m_scriptStorage->insert(std::make_pair(Name, this));
}
}
示例13: RegisterSelf
void Script::RegisterSelf(bool bReportError)
{
if (uint32 id = GetScriptId(Name.c_str()))
{
m_scripts[id] = this;
++num_sc_scripts;
}
else
{
if (bReportError)
script_error_log("Script registering but ScriptName %s is not assigned in database. Script will not be used.", Name.c_str());
delete this;
}
}
示例14: RegisterSelf
void Script::RegisterSelf(bool bReportError)
{
if (uint32 id = GetScriptId(Name.c_str()))
{
m_scripts[id] = this;
++num_sc_scripts;
}
else
{
if (bReportError)
error_log("SD2: Script registering but ScriptName %s is not assigned in database. Script will not be used.", Name.c_str());
m_scriptStorage.insert(std::make_pair(Name.c_str(), this));
}
}
示例15: GetScriptId
void Script::RegisterSelf(bool bReportError)
{
int id = GetScriptId(Name.c_str());
if (id != 0)
{
m_scripts[id] = this;
++num_sc_scripts;
}
else
{
if (bReportError)
error_log("SD2: Script registering but ScriptName %s is not assigned in database. Script will not be used.", (this)->Name.c_str());
delete this;
}
}