本文整理汇总了C++中BString::getCrc方法的典型用法代码示例。如果您正苦于以下问题:C++ BString::getCrc方法的具体用法?C++ BString::getCrc怎么用?C++ BString::getCrc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BString
的用法示例。
在下文中一共展示了BString::getCrc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addInternalAttributeIncDB
void Object::addInternalAttributeIncDB(BString key,std::string value)
{
if(hasInternalAttribute(key))
{
setInternalAttributeIncDB(key,value);
return;
}
mInternalAttributeMap.insert(std::make_pair(key.getCrc(),value));
uint32 attributeID = gWorldManager->getAttributeId(key.getCrc());
if(!attributeID)
{
DLOG(info) << "Object::addAttribute DB: no such attribute in the attribute table : " << key.getAnsi();
return;
}
int8 sql[512],*sqlPointer,restStr[128];
// int8 sql[1024]
sprintf(sql,"INSERT INTO %s.item_attributes VALUES(%" PRIu64 ",%u,'",gWorldManager->getDatabase()->galaxy() ,this->getId(), attributeID);
sqlPointer = sql + strlen(sql);
sqlPointer += gWorldManager->getDatabase()->escapeString(sqlPointer, value.c_str(), value.length());
sprintf(restStr,"',%u,0)",static_cast<uint32>(this->mInternalAttributeMap.size()));
strcat(sql,restStr);
gWorldManager->getDatabase()->executeSqlAsync(0, 0, sql);
}
示例2: upDateFactoryVolume
//========================================================================================
//used by the factoryfactory to update hoppercontent when looking at a hopper
//
void FactoryCrate::upDateFactoryVolume(BString amount)
{
if(!this->hasAttribute("factory_count"))
{
return;
}
std::string v = this->getAttribute<std::string>("factory_count");
BString value = v.c_str();
if(value.getCrc() == amount.getCrc())
{
return;
}
this->setAttribute("factory_count",amount.getAnsi());
PlayerObjectSet* knownPlayers = this->getKnownPlayers();
PlayerObjectSet::iterator playerIt = knownPlayers->begin();
while(playerIt != knownPlayers->end())
{
PlayerObject* player = (*playerIt);
if(player)
gMessageLib->sendUpdateCrateContent(this,player);
playerIt++;
}
}
示例3: hasInternalAttribute
bool Object::hasInternalAttribute(BString key)
{
if(mInternalAttributeMap.find(key.getCrc()) != mInternalAttributeMap.end())
return(true);
return(false);
}
示例4: hasAttribute
bool Object::hasAttribute(BString key) const
{
if(mAttributeMap.find(key.getCrc()) != mAttributeMap.end())
return(true);
return(false);
}
示例5: hasConfiguration
bool WorldConfig::hasConfiguration(BString key) const
{
if(mConfigurationMap.find(key.getCrc()) != mConfigurationMap.end())
return(true);
return(false);
}
示例6: removeInternalAttribute
void Object::removeInternalAttribute(BString key)
{
AttributeMap::iterator it = mInternalAttributeMap.find(key.getCrc());
if(it != mInternalAttributeMap.end())
mInternalAttributeMap.erase(it);
else
DLOG(info) << "Object::removeInternalAttribute: could not find " << key.getAnsi();
}
示例7: removeConfiguration
void WorldConfig::removeConfiguration(BString key)
{
ConfigurationMap::iterator it = mConfigurationMap.find(key.getCrc());
if(it != mConfigurationMap.end())
mConfigurationMap.erase(it);
else
gLogger->log(LogManager::INFORMATION,"WorldConfig::removeConfiguration: could not find %s",key.getAnsi());
}
示例8: removeConfiguration
void WorldConfig::removeConfiguration(BString key)
{
ConfigurationMap::iterator it = mConfigurationMap.find(key.getCrc());
if(it != mConfigurationMap.end())
mConfigurationMap.erase(it);
else
LOG(WARNING) << "Could not find configuration setting with key [" << key.getAnsi() << "]";
}
示例9: _handleBoardTransport
void ObjectController::_handleBoardTransport(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(mObject);
ObjectSet inRangeObjects;
float boardingRange = 25.0;
if(playerObject->states.getPosture() == CreaturePosture_SkillAnimating)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "wrong_state"), playerObject);
return;
}
BString str;
message->getStringUnicode16(str);
str.convert(BSTRType_ANSI);
str.toLower();
if((str.getCrc() != BString("transport").getCrc()))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "boarding_what_shuttle"), playerObject);
return;
}
gSpatialIndexManager->getObjectsInRange(playerObject,&inRangeObjects,ObjType_Creature | ObjType_NPC, boardingRange, true);
// iterate through the results
ObjectSet::iterator it = inRangeObjects.begin();
while(it != inRangeObjects.end())
{
if(Shuttle* shuttle = dynamic_cast<Shuttle*>(*it))
{
// in range check
if(playerObject->getParentId() != shuttle->getParentId())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "boarding_too_far"), playerObject);
return;
}
if (!shuttle->availableInPort())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "shuttle_not_available"), playerObject);
return;
}
shuttle->useShuttle(playerObject);
return;
}
++it;
}
gMessageLib->SendSystemMessage(::common::OutOfBand("structure/structure_messages", "boarding_what_shuttle"), playerObject);
}
示例10: getIdXP
uint32 EntertainerManager::getIdXP(BString attribute, uint16 value)
{
IDStruct* iDContainer = getIDAttribute(attribute.getCrc());
if(!iDContainer)
{
gLogger->log(LogManager::DEBUG,"couldnt find attribute container");
return 0;
}
return iDContainer->XP;
}
示例11: DLOG
void Object::setInternalAttribute(BString key,std::string value)
{
AttributeMap::iterator it = mInternalAttributeMap.find(key.getCrc());
if(it == mInternalAttributeMap.end())
{
DLOG(info) << "Object::setInternalAttribute: could not find " << key.getAnsi();
return;
}
(*it).second = value;
}
示例12: setConfiguration
void WorldConfig::setConfiguration(BString key,std::string value)
{
ConfigurationMap::iterator it = mConfigurationMap.find(key.getCrc());
if(it == mConfigurationMap.end())
{
LOG(WARNING) << "Could not find configuration setting with key [" << key.getAnsi() << "]";
return;
}
(*it).second = value;
}
示例13: setConfiguration
void WorldConfig::setConfiguration(BString key,std::string value)
{
ConfigurationMap::iterator it = mConfigurationMap.find(key.getCrc());
if(it == mConfigurationMap.end())
{
gLogger->log(LogManager::INFORMATION,"WorldConfig::setConfiguration: could not find %s",key.getAnsi());
return;
}
(*it).second = value;
}
示例14: sendChatRoomMessage
void ChatMessageLib::sendChatRoomMessage(Channel* channel, BString galaxy, BString sender, BString message) const
{
ChatAvatarIdList::iterator iter = channel->getUserList()->begin();
#ifdef DISP_REAL_FIRST_NAME
#else
sender.toLower();
#endif
// Check ignore list.
BString loweredName = sender;
loweredName.toLower();
uint32 loweredNameCrc = loweredName.getCrc();
while (iter != channel->getUserList()->end())
{
// If sender present at recievers ignore list, don't send.
if ((*iter)->getPlayer()->checkIgnore(loweredNameCrc))
{
// Ignore player
}
else
{
DispatchClient* client = (*iter)->getPlayer()->getClient();
if (client == NULL)
{
LOG(warning) << "sendChatRoomMessage: Client not found for channel " << channel->getId();
}
else
{
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opChatRoomMessage);
gMessageFactory->addString(SWG);
gMessageFactory->addString(galaxy);
gMessageFactory->addString(sender);
gMessageFactory->addUint32(channel->getId());
gMessageFactory->addString(message);
gMessageFactory->addUint32(0);
Message* response = gMessageFactory->EndMessage();
client->SendChannelA(response, client->getAccountId(), CR_Client, 5);
}
}
++iter;
}
}
示例15: setInternalAttributeIncDB
void Object::setInternalAttributeIncDB(BString key,std::string value)
{
if(!hasInternalAttribute(key))
{
addInternalAttributeIncDB(key,value);
}
AttributeMap::iterator it = mInternalAttributeMap.find(key.getCrc());
if(it == mInternalAttributeMap.end())
{
DLOG(INFO) << "Object::setAttribute: could not find " << key.getAnsi();
return;
}
(*it).second = value;
uint32 attributeID = gWorldManager->getAttributeId(key.getCrc());
if(!attributeID)
{
DLOG(INFO) << "Object::addAttribute DB: no such attribute in the attribute table :" << key.getAnsi();
return;
}
int8 sql[512],*sqlPointer,restStr[128];
// int8 sql[1024]
sprintf(sql,"UPDATE item_attributes SET value='");
sqlPointer = sql + strlen(sql);
sqlPointer += gWorldManager->getDatabase()->escapeString(sqlPointer,value.c_str(),value.length());
sprintf(restStr,"'WHERE item_id=%"PRIu64" AND attribute_id=%u",this->getId(),attributeID);
strcat(sql,restStr);
//sprintf(sql,"UPDATE item_attributes SET value='%s' WHERE item_id=%"PRIu64" AND attribute_id=%u",value,this->getId(),attributeID);
gWorldManager->getDatabase()->executeSqlAsync(0,0,sql);
}