mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 11:12:37 +00:00
# Added initial support for players and population counters in new simulation system, plus various infrastructure improvements.
Merge from 22b478ffed8d. Pure scripted interface definitions. Entity creation from scripts. Improved messaging system. Messages on entity deletion. Basic player entities. Player ownership. Bug fixes. This was SVN commit r7281.
This commit is contained in:
@@ -46,15 +46,16 @@ void CComponentTypeScript::Deinit(const CSimContext& UNUSED(context))
|
||||
m_ScriptInterface.CallFunctionVoid(m_Instance, "Deinit");
|
||||
}
|
||||
|
||||
void CComponentTypeScript::HandleMessage(const CSimContext& UNUSED(context), const CMessage& msg)
|
||||
void CComponentTypeScript::HandleMessage(const CSimContext& UNUSED(context), const CMessage& msg, bool global)
|
||||
{
|
||||
const char* name = msg.GetScriptHandlerName();
|
||||
const char* name = global ? msg.GetScriptGlobalHandlerName() : msg.GetScriptHandlerName();
|
||||
|
||||
CScriptVal msgVal = msg.ToJSVal(m_ScriptInterface);
|
||||
// TODO: repeated conversions are exceedingly inefficient. Should
|
||||
// cache this once per message (if it's used by >= 1 scripted component)
|
||||
|
||||
m_ScriptInterface.CallFunctionVoid(m_Instance, name, msgVal);
|
||||
if (!m_ScriptInterface.CallFunctionVoid(m_Instance, name, msgVal))
|
||||
LOGERROR(L"Script message handler %hs failed", name);
|
||||
}
|
||||
|
||||
void CComponentTypeScript::Serialize(ISerializer& serialize)
|
||||
|
||||
Reference in New Issue
Block a user