1
0
forked from 0ad/0ad

Updates example component documentation

This was SVN commit r13203.
This commit is contained in:
historic_bruno 2013-02-26 19:58:51 +00:00
parent 6c7543c044
commit e283e75d84
4 changed files with 15 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* ...the usual copyright header...
*/
@ -26,12 +26,12 @@ public:
return "<ref name='anything'/>";
}
virtual void Init(const CSimContext& context, const CParamNode& paramNode)
virtual void Init(const CParamNode& paramNode)
{
// ...
}
virtual void Deinit(const CSimContext& context)
virtual void Deinit()
{
// ...
}
@ -41,12 +41,12 @@ public:
// ...
}
virtual void Deserialize(const CSimContext& context, const CParamNode& paramNode, IDeserializer& deserialize)
virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
{
// ...
}
virtual void HandleMessage(const CSimContext& context, const CMessage& msg, bool UNUSED(global))
virtual void HandleMessage(const CMessage& msg, bool UNUSED(global))
{
// ...
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* ...the usual copyright header...
*/

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -199,7 +199,7 @@ to hear about all MT_Destroy messages.)
Then you need to respond to the messages in @c HandleMessage:
@code
virtual void HandleMessage(const CSimContext& context, const CMessage& msg, bool UNUSED(global))
virtual void HandleMessage(const CMessage& msg, bool UNUSED(global))
{
switch (msg.GetType())
{
@ -222,17 +222,17 @@ Component type instances go through one of two lifecycles:
@code
CCmpExample();
Init(context, paramNode);
Init(paramNode);
// any sequence of HandleMessage and Serialize and interface methods
Deinit(context);
Deinit();
~CCmpExample();
@endcode
@code
CCmpExample();
Deserialize(context, paramNode, deserialize);
Deserialize(paramNode, deserialize);
// any sequence of HandleMessage and Serialize and interface methods
Deinit(context);
Deinit();
~CCmpExample();
@endcode
@ -241,9 +241,6 @@ so they must not rely on other entities or components already existing; @em exce
created before anything else and therefore may be used, and that the components for a single entity will be
processed in the order determined by TypeList.h.
The same @c context object will be used in all these calls.
The context can also be accessed with IComponent::GetSimContext.
In a typical component:
- The constructor should do very little, other than perhaps initialising some member variables -
@ -526,8 +523,8 @@ CComponentManager::BroadcastMessage to send to all entities.
@code
CMessageExample msg(10, 20);
context.GetComponentManager().PostMessage(ent, msg);
context.GetComponentManager().BroadcastMessage(msg);
GetSimContext().GetComponentManager().PostMessage(ent, msg);
GetSimContext().GetComponentManager().BroadcastMessage(msg);
@endcode
From JS, use @ref CComponentManager::Script_PostMessage "Engine.PostMessage" and