本文整理汇总了C++中EntityType类的典型用法代码示例。如果您正苦于以下问题:C++ EntityType类的具体用法?C++ EntityType怎么用?C++ EntityType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EntityType类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMarshalledSize
int MinefieldStatePdu::getMarshalledSize() const
{
int marshalSize = 0;
marshalSize = MinefieldFamilyPdu::getMarshalledSize();
marshalSize = marshalSize + _minefieldID.getMarshalledSize(); // _minefieldID
marshalSize = marshalSize + 2; // _minefieldSequence
marshalSize = marshalSize + 1; // _forceID
marshalSize = marshalSize + 1; // _numberOfPerimeterPoints
marshalSize = marshalSize + _minefieldType.getMarshalledSize(); // _minefieldType
marshalSize = marshalSize + 2; // _numberOfMineTypes
marshalSize = marshalSize + _minefieldLocation.getMarshalledSize(); // _minefieldLocation
marshalSize = marshalSize + _minefieldOrientation.getMarshalledSize(); // _minefieldOrientation
marshalSize = marshalSize + 2; // _appearance
marshalSize = marshalSize + 2; // _protocolMode
for(int idx=0; idx < _perimeterPoints.size(); idx++)
{
Point listElement = _perimeterPoints[idx];
marshalSize = marshalSize + listElement.getMarshalledSize();
}
for(int idx=0; idx < _mineType.size(); idx++)
{
EntityType listElement = _mineType[idx];
marshalSize = marshalSize + listElement.getMarshalledSize();
}
return marshalSize;
}
示例2: marshal
void MinefieldStatePdu::marshal(DataStream& dataStream) const
{
MinefieldFamilyPdu::marshal(dataStream); // Marshal information in superclass first
_minefieldID.marshal(dataStream);
dataStream << _minefieldSequence;
dataStream << _forceID;
dataStream << ( unsigned char )_perimeterPoints.size();
_minefieldType.marshal(dataStream);
dataStream << ( unsigned short )_mineType.size();
_minefieldLocation.marshal(dataStream);
_minefieldOrientation.marshal(dataStream);
dataStream << _appearance;
dataStream << _protocolMode;
for(size_t idx = 0; idx < _perimeterPoints.size(); idx++)
{
Point x = _perimeterPoints[idx];
x.marshal(dataStream);
}
for(size_t idx = 0; idx < _mineType.size(); idx++)
{
EntityType x = _mineType[idx];
x.marshal(dataStream);
}
}
示例3: unmarshal
void MinefieldStatePdu::unmarshal(DataStream& dataStream)
{
MinefieldFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first
_minefieldID.unmarshal(dataStream);
dataStream >> _minefieldSequence;
dataStream >> _forceID;
dataStream >> _numberOfPerimeterPoints;
_minefieldType.unmarshal(dataStream);
dataStream >> _numberOfMineTypes;
_minefieldLocation.unmarshal(dataStream);
_minefieldOrientation.unmarshal(dataStream);
dataStream >> _appearance;
dataStream >> _protocolMode;
_perimeterPoints.clear();
for(size_t idx = 0; idx < _numberOfPerimeterPoints; idx++)
{
Point x;
x.unmarshal(dataStream);
_perimeterPoints.push_back(x);
}
_mineType.clear();
for(size_t idx = 0; idx < _numberOfMineTypes; idx++)
{
EntityType x;
x.unmarshal(dataStream);
_mineType.push_back(x);
}
}
示例4: metadataProviderClosed
void EbuCoreMainForm::metadataProviderClosed(Operation op, QVariant value)
{
EntityType *entityType = QVarPtr<EntityType>::asPointer(value);
if (!entityType)
return;
if (op == Add)
m_ebuCoreMain->setMetadataProvider(entityType);
m_editMetadataProvider->setText(entityType->toString());
}
示例5: relatedContactsFormClosed
void ContactDetailsTypeForm::relatedContactsFormClosed(Operation op, QVariant value)
{
EntityType *related = QVarPtr<EntityType>::asPointer(value);
if (!related)
return;
if (op == Add) {
m_listView->addItem(related->toString());
m_contactDetails->relatedContacts().append(related);
} else if (op == Edit) {
int row = m_contactDetails->relatedContacts().indexOf(related);
m_listView->setItem(row, related->toString());
}
}
示例6: updateListAndButtons
void ContactDetailsTypeForm::relatedContactsChecked(bool checked)
{
if (!checked)
return;
m_currentEditMode = Related;
updateListAndButtons();
int s = m_contactDetails->relatedContacts().size();
for (int i=0; i < s; ++i) {
EntityType *rc = m_contactDetails->relatedContacts().at(i);
if (!rc)
continue;
m_listView->addItem(rc->toString());
}
}
示例7: id
IdType id(const EntityType& e) const
{
if(idSet_)
return idSet_->id(e);
else
return this->template getMapping<EntityType::codimension>()[e.index()];
}
示例8: computeId
IdType computeId(const EntityType& e) const
{
IdType myId = 0;
for( int c=0; c<EntityType::codimension; ++c )
myId += grid_.indexSet().size( c );
return myId + e.index();
}
示例9: Entity
void EventParagraph::read(std::istream& file)
{
m_position= Common::Misc::readCodedInt(file);
m_length= Common::Misc::readCodedInt(file);
EntityType t;
t.setTypeId(static_cast<EntityTypeId>(Common::Misc::readCodedInt(file)));
t.setGroupId(static_cast<EntityGroupId>(Common::Misc::readCodedInt(file)));
m_evententities.first=t;
int size=Common::Misc::readCodedInt(file);
for (int i=0; i< size; i++)
{
Entity *e=new Entity();
e->read(file);
m_evententities.second.push_back(e);
}
int other_size=Common::Misc::readCodedInt(file);
for (int i=0; i< other_size; i++)
{
EntityType to;
to.setTypeId(static_cast<EntityTypeId>(Common::Misc::readCodedInt(file)));
to.setGroupId(static_cast<EntityGroupId>(Common::Misc::readCodedInt(file)));
int to_size=Common::Misc::readCodedInt(file);
std::vector<Entity*> v;
for (int j=0; j< to_size; j++)
{
Entity *e=new Entity();
e->read(file);
v.push_back(e);
}
m_otherentities[to]=v;
}
}
示例10: debug
void Map::visitEntities (IEntityVisitor *visitor, const EntityType& type)
{
if (type == EntityType::NONE || type == EntityTypes::PLAYER) {
bool needUpdate = false;
for (PlayerListIter i = _players.begin(); i != _players.end();) {
Player* e = *i;
if (visitor->visitEntity(e)) {
debug(LOG_SERVER, String::format("remove player by visit %i: %s", e->getID(), e->getType().name.c_str()));
GameEvent.removeEntity(e->getVisMask(), *e);
delete *i;
i = _players.erase(i);
needUpdate = true;
} else {
++i;
}
}
if (needUpdate) {
updateVisMask();
if (_players.empty()) {
resetCurrentMap();
return;
}
}
}
// changing the entities list is not allowed here. Adding or removing
// would invalidate the iterators
for (Map::EntityListIter i = _entities.begin(); i != _entities.end();) {
IEntity* e = *i;
if (type.isNone() || e->getType() == type) {
if (visitor->visitEntity(e)) {
debug(LOG_SERVER, String::format("remove entity by visit %i: %s", e->getID(), e->getType().name.c_str()));
GameEvent.removeEntity(e->getVisMask(), *e, EntityTypes::isNpcCave(e->getType()));
(*i)->prepareRemoval();
delete *i;
i = _entities.erase(i);
} else {
++i;
}
} else {
++i;
}
}
// now we will add the newly added entities to the list to not invalidate the iterators
for (Map::EntityListIter i = _entitiesToAdd.begin(); i != _entitiesToAdd.end(); ++i) {
_entities.push_back(*i);
}
_entitiesToAdd.clear();
}
示例11: visitEntities
void Map::visitEntities (IEntityVisitor *visitor, const EntityType& type)
{
if (type == EntityType::NONE || type == EntityTypes::PLAYER) {
bool needUpdate = false;
for (PlayerListIter i = _players.begin(); i != _players.end();) {
Player* e = *i;
if (visitor->visitEntity(e)) {
debug(LOG_SERVER, String::format("remove player by visit %i: %s", e->getID(), e->getType().name.c_str()));
removeEntity(ClientIdToClientMask(e->getClientId()), *e);
delete *i;
i = _players.erase(i);
needUpdate = true;
} else {
++i;
}
}
if (needUpdate) {
if (_players.empty()) {
resetCurrentMap();
return;
}
}
}
// changing the entities list is not allowed here. Adding or removing
// would invalidate the iterators
for (Map::EntityListIter i = _entities.begin(); i != _entities.end();) {
IEntity* e = *i;
if (type.isNone() || e->getType() == type) {
if (visitor->visitEntity(e)) {
debug(LOG_SERVER, String::format("remove entity by visit %i: %s", e->getID(), e->getType().name.c_str()));
removeEntity(0, *e);
(*i)->remove();
delete *i;
i = _entities.erase(i);
} else {
++i;
}
} else {
++i;
}
}
}
示例12: index
IndexType index(const EntityType& e) const
{
return e.index();
}
示例13: map
int map (const EntityType& e) const
{
return e.index();
}