本文整理汇总了C++中Anonymous::setId方法的典型用法代码示例。如果您正苦于以下问题:C++ Anonymous::setId方法的具体用法?C++ Anonymous::setId怎么用?C++ Anonymous::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anonymous
的用法示例。
在下文中一共展示了Anonymous::setId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processVisibilityForMovedEntity
void InventoryDomain::processVisibilityForMovedEntity(const LocatedEntity& moved_entity, const Location& old_loc, OpVector & res)
{
if (m_entity.m_contains) {
std::vector<LocatedEntity*> visibleEntities;
std::unordered_set<int> outfitted;
LocatedEntity* rightHandWieldedEntity = nullptr;
const OutfitProperty* outfitProperty = m_entity.getPropertyClass<OutfitProperty>("outfit");
if (outfitProperty) {
for (auto& entry : outfitProperty->data()) {
outfitted.insert(entry.second->getIntId());
}
}
const EntityProperty* rightHandWieldProperty = m_entity.getPropertyClass<EntityProperty>("right_hand_wield");
if (rightHandWieldProperty) {
rightHandWieldedEntity = rightHandWieldProperty->data().get();
}
for (auto childEntity : *m_entity.m_contains) {
if (childEntity == rightHandWieldedEntity) {
visibleEntities.push_back(childEntity);
} else if (outfitted.find(childEntity->getIntId()) != outfitted.end()) {
visibleEntities.push_back(childEntity);
}
}
std::set<std::string> newVisibleEntities;
for (auto visibleEntity : visibleEntities) {
if (m_lastVisibleEntities.find(visibleEntity->getId()) == m_lastVisibleEntities.end()) {
Anonymous ent;
ent->setId(visibleEntity->getId());
ent->setStamp(visibleEntity->getSeq());
Appearance d;
d->setArgs1(ent);
res.push_back(d);
} else {
m_lastVisibleEntities.erase(visibleEntity->getId());
}
newVisibleEntities.insert(visibleEntity->getId());
}
for (auto entityId : m_lastVisibleEntities) {
Anonymous ent;
ent->setId(entityId);
Disappearance d;
d->setArgs1(ent);
res.push_back(d);
}
m_lastVisibleEntities = std::move(newVisibleEntities);
}
}
示例2: test_LogoutOperation_other_but_unconnected
void Admintest::test_LogoutOperation_other_but_unconnected()
{
Account_LogoutOperation_called = 0;
m_account->m_connection = 0;
long cid = m_id_counter++;
std::string cid_str = String::compose("%1", cid);
Account * ac2 = new Admin(0,
"f3332c00-5d2b-45c1-8cf4-3429bdf2845f",
"c0e095f0-575c-477c-bafd-2055d6958d4d",
cid_str, cid);
m_server->addObject(ac2);
ASSERT_EQUAL(m_server->getObject(cid_str), ac2);
Atlas::Objects::Operation::Logout op;
OpVector res;
Anonymous arg;
arg->setId(cid_str);
op->setArgs1(arg);
m_account->LogoutOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
ASSERT_NULL(Account_LogoutOperation_called);
delete ac2;
}
示例3: test_GetOperation_obj_IG
void Admintest::test_GetOperation_obj_IG()
{
long cid = m_id_counter++;
std::string cid_str = String::compose("%1", cid);
Entity * to = new Entity(cid_str, cid);
m_server->m_world.addEntity(to);
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId(cid_str);
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
const Operation & reply = res.front();
ASSERT_EQUAL(reply->getClassNo(),
Atlas::Objects::Operation::INFO_NO);
ASSERT_EQUAL(reply->getArgs().size(), 1u);
const Root & reply_arg = reply->getArgs().front();
ASSERT_TRUE(!reply_arg->isDefaultId());
ASSERT_EQUAL(reply_arg->getId(), to->getId());
delete to;
}
示例4: getRule
bool EntityImporterBase::getRule(const std::string & id, OpVector & res)
{
auto I = mPersistedRules.find(id);
if (I == mPersistedRules.end()) {
S_LOG_WARNING("Could not find rule with id " << id << ".");
return false;
}
auto definition = I->second;
m_state = RULE_WALKING;
std::list<std::string> children;
extractChildren(definition, children);
RuleStackEntry entry = { id, definition, children };
mRuleStack.push_back(entry);
Get get;
Anonymous arg;
arg->setId(id);
get->setArgs1(arg);
// get->setObjtype("op");
get->setSerialno(newSerialNumber());
res.push_back(get);
Anonymous get_arg;
get_arg->setId(id);
get_arg->setObjtype("obj");
return true;
}
示例5: test_GetOperation_rule_found
void Admintest::test_GetOperation_rule_found()
{
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("class");
arg->setId("root");
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
const Operation & reply = res.front();
ASSERT_EQUAL(reply->getClassNo(),
Atlas::Objects::Operation::INFO_NO);
ASSERT_EQUAL(reply->getArgs().size(), 1u);
const Root & reply_arg = reply->getArgs().front();
ASSERT_TRUE(!reply_arg->isDefaultId());
ASSERT_EQUAL(reply_arg->getId(), "root");
}
示例6: test_SetOperation_obj_IG
void Admintest::test_SetOperation_obj_IG()
{
Account_SetOperation_called = 0;
long cid = m_id_counter++;
Entity * c = new Entity(compose("%1", cid), cid);
m_account->m_charactersDict.insert(std::make_pair(cid, c));
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId(c->getId());
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(Account_SetOperation_called, m_account);
// The operation returned would have come from Account::SetOperation
// but that is stubbed out
ASSERT_EQUAL(res.size(), 0u);
delete c;
}
示例7: del
void CreatorClient::del(const std::string & id)
{
Delete op;
Anonymous ent;
ent->setId(id);
op->setArgs1(ent);
op->setFrom(getId());
op->setTo(id);
return send(op);
}
示例8: getRule
void RuleTraversalTask::getRule(const std::string & id, OpVector & res)
{
Get get;
Anonymous arg;
arg->setId(id);
get->setArgs1(arg);
get->setObjtype("op");
get->setSerialno(newSerialNo());
mSerial = get->getSerialno();
res.push_back(get);
}
示例9: sendLook
LocatedEntity * CharacterClient::look(const std::string & id)
{
Look op;
if (!id.empty()) {
Anonymous ent;
ent->setId(id);
op->setArgs1(ent);
}
op->setFrom(getId());
return sendLook(op);
}
示例10: lookAtEntity
static void lookAtEntity(ClientConnection& con, const std::string & eid,
const std::string & loc)
{
Look l;
l->setFrom(con.getCharacterId());
Anonymous lookEnt;
lookEnt->setId(eid);
l->setArgs1(lookEnt);
int serial = con.send(l);
verbose( std::cout << "Waiting for In-game look response on connection "
<< con.getAccount() << std::endl << std::flush; );
示例11: clearWorld
void World::clearWorld(OpVector & res) {
log(INFO, "Clearing world; deleting all entities.");
OpVector ignoredRes;
auto& baseWorld = BaseWorld::instance();
if (m_contains) {
while (!m_contains->empty()) {
auto& entity = *m_contains->begin();
if (entity->isPerceptive()) {
//Send a sight of a delete op to the entity so that it knows it has been deleted.
Delete delOp;
delOp->setTo(entity->getId());
Anonymous delArg;
delArg->setId(entity->getId());
delOp->setArgs1(delArg);
Sight sToEntity;
sToEntity->setArgs1(delOp);
sToEntity->setTo(entity->getId());
entity->operation(sToEntity, ignoredRes);
}
baseWorld.delEntity(entity.get());
}
}
//Remove all properties except for "id"
auto propIter = m_properties.begin();
while(propIter != m_properties.end())
{
if (propIter->first != "id") {
auto prop = propIter->second;
prop->remove(this, propIter->first);
delete prop;
m_properties.erase(propIter++);
} else {
++propIter;
}
}
CalendarProperty* calProp = new CalendarProperty();
calProp->install(this, "calendar");
m_properties["calendar"] = calProp;
delete m_contains;
m_contains = nullptr;
log(INFO, "World cleared of all entities.");
}
示例12: test_SetOperation_unknown
void Admintest::test_SetOperation_unknown()
{
Atlas::Objects::Operation::Set op;
OpVector res;
Anonymous arg;
arg->setObjtype("unimportant_unknown_string");
arg->setId("root");
op->setArgs1(arg);
m_account->SetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
}
示例13: test_GetOperation_unknown
void Admintest::test_GetOperation_unknown()
{
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("unknownobjtype");
arg->setId("1741");
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
}
示例14: test_GetOperation_obj_unconnected
void Admintest::test_GetOperation_obj_unconnected()
{
m_account->m_connection = 0;
Atlas::Objects::Operation::Get op;
OpVector res;
Anonymous arg;
arg->setObjtype("obj");
arg->setId("9287");
op->setArgs1(arg);
m_account->GetOperation(op, res);
ASSERT_EQUAL(res.size(), 0u);
}
示例15: test_LogoutOperation_unknown
void Admintest::test_LogoutOperation_unknown()
{
long cid = m_id_counter++;
Operation op;
OpVector res;
Anonymous arg;
arg->setId(String::compose("%1", cid));
op->setArgs1(arg);
m_account->LogoutOperation(op, res);
ASSERT_EQUAL(res.size(), 1u);
ASSERT_EQUAL(res.front()->getClassNo(),
Atlas::Objects::Operation::ERROR_NO);
}