本文整理汇总了C++中SystemEntity::EncodeDestiny方法的典型用法代码示例。如果您正苦于以下问题:C++ SystemEntity::EncodeDestiny方法的具体用法?C++ SystemEntity::EncodeDestiny怎么用?C++ SystemEntity::EncodeDestiny使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SystemEntity
的用法示例。
在下文中一共展示了SystemEntity::EncodeDestiny方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeSetState
void SystemManager::MakeSetState(const SystemBubble *bubble, DoDestiny_SetState &ss) const
{
Buffer* stateBuffer = new Buffer;
AddBall_header head;
head.more = 0;
head.sequence = ss.stamp;
stateBuffer->Append( head );
//I am not thrilled with this mechanism, but I cant think of a better
//way to deal with it right now. The issue is that we need to send out
// info for all system-wide entities (celestials, etc), as well as all
// entities in our current bubble. Well, it is likely that some things
// in our bubble are system-wide, and we would be sending out duplciates.
// so, we use a set to enforce uniqueness.
std::set<SystemEntity*> visibleEntities;
{
std::map<uint32, SystemEntity*>::const_iterator cur, end;
cur = m_entities.begin();
end = m_entities.end();
for(; cur != end; ++cur)
{
if( !cur->second->IsVisibleSystemWide() )
{
//_log(COMMON__WARNING, "%u is not visible!", cur->first);
continue;
}
//_log(COMMON__WARNING, "%u is system wide visible!", cur->first);
visibleEntities.insert( cur->second );
}
}
//bubble is null??? why???
bubble->GetEntities( visibleEntities );
PySafeDecRef( ss.slims );
ss.slims = new PyList;
//go through all entities and gather the info we need...
std::set<SystemEntity*>::const_iterator cur, end;
cur = visibleEntities.begin();
end = visibleEntities.end();
for(; cur != end; ++cur)
{
SystemEntity* ent = *cur;
//_log(COMMON__WARNING, "Encoding entity %u", ent->GetID());
//ss.damageState
ss.damageState[ ent->GetID() ] = ent->MakeDamageState();
//ss.slims
ss.slims->AddItem( new PyObject( new PyString( "foo.SlimItem" ), ent->MakeSlimItem() ) );
//append the destiny binary data...
ent->EncodeDestiny( *stateBuffer );
}
//ss.destiny_state
ss.destiny_state = new PyBuffer( &stateBuffer );
SafeDelete( stateBuffer );
//ss.gangCorps
//ss.aggressors
//ss.droneState
ss.droneState = m_db.GetSolDroneState( m_systemID );
if( NULL == ss.droneState )
{
_log( SERVICE__ERROR, "Unable to query dronestate entity for destiny update in system %u!", m_systemID );
ss.droneState = new PyNone;
}
//ss.solItem
ss.solItem = m_db.GetSolRow( m_systemID );
if( NULL == ss.solItem )
{
_log( CLIENT__ERROR, "Unable to query solarsystem entity for destiny update in system %u!", m_systemID );
ss.solItem = new PyNone;
}
//ss.effectStates
ss.effectStates = new PyList;
//ss.allianceBridges
ss.allianceBridges = new PyList;
_log( DESTINY__TRACE, "Set State:" );
ss.Dump( DESTINY__TRACE, " " );
_log( DESTINY__TRACE, " Buffer:" );
_hex( DESTINY__TRACE, &( ss.destiny_state->content() )[0],
ss.destiny_state->content().size() );
_log( DESTINY__TRACE, " Decoded:" );
Destiny::DumpUpdate( DESTINY__TRACE, &( ss.destiny_state->content() )[0],
ss.destiny_state->content().size() );
}