本文整理汇总了C++中PropWriteStream::ADD_STRING方法的典型用法代码示例。如果您正苦于以下问题:C++ PropWriteStream::ADD_STRING方法的具体用法?C++ PropWriteStream::ADD_STRING怎么用?C++ PropWriteStream::ADD_STRING使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropWriteStream
的用法示例。
在下文中一共展示了PropWriteStream::ADD_STRING方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serializeAttr
bool Item::serializeAttr(PropWriteStream& propWriteStream) const
{
if (isStackable() || isFluidContainer() || isSplash()) {
uint8_t _count = getSubType();
propWriteStream.ADD_UCHAR(ATTR_COUNT);
propWriteStream.ADD_UCHAR(_count);
}
if (hasCharges()) {
uint16_t _count = getCharges();
propWriteStream.ADD_UCHAR(ATTR_CHARGES);
propWriteStream.ADD_USHORT(_count);
}
if (!isNotMoveable()) {
uint16_t _actionId = getActionId();
if (_actionId) {
propWriteStream.ADD_UCHAR(ATTR_ACTION_ID);
propWriteStream.ADD_USHORT(_actionId);
}
}
const std::string& _text = getText();
if (!_text.empty()) {
propWriteStream.ADD_UCHAR(ATTR_TEXT);
propWriteStream.ADD_STRING(_text);
}
const time_t _writtenDate = getDate();
if (_writtenDate > 0) {
propWriteStream.ADD_UCHAR(ATTR_WRITTENDATE);
propWriteStream.ADD_ULONG(_writtenDate);
}
const std::string& _writer = getWriter();
if (!_writer.empty()) {
propWriteStream.ADD_UCHAR(ATTR_WRITTENBY);
propWriteStream.ADD_STRING(_writer);
}
const std::string& _specialDesc = getSpecialDescription();
if (!_specialDesc.empty()) {
propWriteStream.ADD_UCHAR(ATTR_DESC);
propWriteStream.ADD_STRING(_specialDesc);
}
if (hasAttribute(ATTR_ITEM_DURATION)) {
uint32_t duration = getDuration();
propWriteStream.ADD_UCHAR(ATTR_DURATION);
propWriteStream.ADD_ULONG(duration);
}
ItemDecayState_t decayState = getDecaying();
if (decayState == DECAYING_TRUE || decayState == DECAYING_PENDING) {
propWriteStream.ADD_UCHAR(ATTR_DECAYING_STATE);
propWriteStream.ADD_UCHAR(decayState);
}
return true;
}
示例2: serialize
bool Condition::serialize(PropWriteStream& propWriteStream)
{
propWriteStream.ADD_UCHAR(*CONDITIONATTRIBUTE_MECHANIC);
propWriteStream.ADD_VALUE(mechanicType.value());
propWriteStream.ADD_UCHAR(*CONDITIONATTRIBUTE_COMBAT);
propWriteStream.ADD_VALUE(combatType.value());
propWriteStream.ADD_UCHAR(*CONDITIONATTRIBUTE_SOURCE);
propWriteStream.ADD_VALUE(sourceId);
propWriteStream.ADD_UCHAR(*CONDITIONATTRIBUTE_TICKS);
propWriteStream.ADD_VALUE(ticks);
propWriteStream.ADD_UCHAR(*CONDITIONATTRIBUTE_NAME);
propWriteStream.ADD_STRING(name);
propWriteStream.ADD_UCHAR(*CONDITIONATTRIBUTE_FLAGS);
propWriteStream.ADD_VALUE(flags);
for(std::list<ConditionEffect>::iterator it = effectList.begin(); it != effectList.end(); ++it){
ConditionEffect& effect = (*it);
effect.serialize(propWriteStream);
}
return true;
}
示例3: serializeAttributeMap
void ItemAttributes::serializeAttributeMap(PropWriteStream& stream) const
{
// maximum of 65535 attributes per item
stream.ADD_USHORT(std::min((size_t)0xFFFF, attributes->size()));
AttributeMap::const_iterator attribute = attributes->begin();
int i = 0;
while(attribute != attributes->end() && i <= 0xFFFF){
const std::string& key = attribute->first;
if(key.size() > 0xFFFF)
stream.ADD_STRING(key.substr(0, 65535));
else
stream.ADD_STRING(key);
attribute->second.serialize(stream);
++attribute, ++i;
}
}
示例4: serializeAttr
bool Item::serializeAttr(PropWriteStream& propWriteStream)
{
if(isStackable() || isSplash() || isFluidContainer()){
unsigned char _count = getItemCountOrSubtype();
propWriteStream.ADD_UCHAR(ATTR_COUNT);
propWriteStream.ADD_UCHAR(_count);
}
if(isRune()){
unsigned char _count = getItemCharge();
propWriteStream.ADD_UCHAR(ATTR_RUNE_CHARGES);
propWriteStream.ADD_UCHAR(_count);
}
if(!isNotMoveable() /*moveable*/){
if(actionId){
unsigned short _actionId = getActionId();
propWriteStream.ADD_UCHAR(ATTR_ACTION_ID);
propWriteStream.ADD_USHORT(_actionId);
}
}
/*we are not saving unique ids
if(uniqueId){
unsigned short _uniqueId = getUniqueId();
propWriteStream.ADD_UCHAR(ATTR_UNIQUE_ID);
propWriteStream.ADD_USHORT(_uniqueId);
}
*/
const std::string& _text = getText();
if(_text.length() > 0){
propWriteStream.ADD_UCHAR(ATTR_TEXT);
propWriteStream.ADD_STRING(_text);
}
const std::string& _specialDesc = getSpecialDescription();
if(_specialDesc.length() > 0){
propWriteStream.ADD_UCHAR(ATTR_DESC);
propWriteStream.ADD_STRING(_specialDesc);
}
return true;
}