本文整理汇总了C++中PropWriteStream::ADD_UCHAR方法的典型用法代码示例。如果您正苦于以下问题:C++ PropWriteStream::ADD_UCHAR方法的具体用法?C++ PropWriteStream::ADD_UCHAR怎么用?C++ PropWriteStream::ADD_UCHAR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropWriteStream
的用法示例。
在下文中一共展示了PropWriteStream::ADD_UCHAR方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void ItemAttribute::serialize(PropWriteStream& stream) const
{
// write type
stream.ADD_UCHAR(static_cast<uint8_t>(m_type));
// write contents
switch(m_type){
case STRING: {
stream.ADD_LSTRING(*m_var.string);
break;
}
case INTEGER:
case FLOAT: {
stream.ADD_ULONG(m_var.unsignedInteger);
break;
}
case BOOLEAN: {
stream.ADD_UCHAR(m_var.unsignedChar);
break;
}
default: break;
}
}
示例2: serializeAttr
bool Teleport::serializeAttr(PropWriteStream& propWriteStream) const
{
bool ret = Item::serializeAttr(propWriteStream);
propWriteStream.ADD_UCHAR(ATTR_TELE_DEST);
propWriteStream.ADD_USHORT(destPos.x);
propWriteStream.ADD_USHORT(destPos.y);
propWriteStream.ADD_UCHAR(destPos.z);
return ret;
}
示例3: serialize
bool Condition::serialize(PropWriteStream& propWriteStream)
{
propWriteStream.ADD_UCHAR(CONDITIONATTR_TYPE);
propWriteStream.ADD_VALUE((int32_t)conditionType);
propWriteStream.ADD_UCHAR(CONDITIONATTR_ID);
propWriteStream.ADD_VALUE((int32_t)id);
propWriteStream.ADD_UCHAR(CONDITIONATTR_TICKS);
propWriteStream.ADD_VALUE((int32_t)ticks);
return true;
}
示例4: serialize
bool ConditionSoul::serialize(PropWriteStream& propWriteStream)
{
if(!Condition::serialize(propWriteStream))
return false;
propWriteStream.ADD_UCHAR(CONDITIONATTR_SOULGAIN);
propWriteStream.ADD_VALUE(soulGain);
propWriteStream.ADD_UCHAR(CONDITIONATTR_SOULTICKS);
propWriteStream.ADD_VALUE(soulTicks);
return true;
}
示例5: serializeAttr
bool BedItem::serializeAttr(PropWriteStream& propWriteStream) const
{
if (sleeperGUID != 0) {
propWriteStream.ADD_UCHAR(ATTR_SLEEPERGUID);
propWriteStream.ADD_ULONG(sleeperGUID);
}
if (sleepStart != 0) {
propWriteStream.ADD_UCHAR(ATTR_SLEEPSTART);
propWriteStream.ADD_ULONG((int32_t)sleepStart);
}
return true;
}
示例6: saveItem
bool IOMapSerialize::saveItem(PropWriteStream& stream, const Item* item)
{
stream.ADD_USHORT(item->getID());
item->serializeAttr(stream);
if(const Container* container = item->getContainer())
{
stream.ADD_UCHAR(ATTR_CONTAINER_ITEMS);
stream.ADD_ULONG(container->size());
for(ItemList::const_reverse_iterator rit = container->getReversedItems(); rit != container->getReversedEnd(); ++rit)
saveItem(stream, (*rit));
}
stream.ADD_UCHAR(ATTR_END);
return true;
}
示例7: saveTile
void IOMapSerialize::saveTile(PropWriteStream& stream, const Tile* tile)
{
const TileItemVector* tileItems = tile->getItemList();
if (!tileItems) {
return;
}
std::forward_list<Item*> items;
uint16_t count = 0;
for (Item* item : *tileItems) {
// Note that these are NEGATED, ie. these are the items that will be saved.
if (!(item->isMoveable() || item->getDoor() || (item->getContainer() && !item->getContainer()->empty()) || item->canWriteText() || item->getBed())) {
continue;
}
items.push_front(item);
++count;
}
if (!items.empty()) {
const Position& tilePosition = tile->getPosition();
stream.ADD_USHORT(tilePosition.x);
stream.ADD_USHORT(tilePosition.y);
stream.ADD_UCHAR(tilePosition.z);
stream.ADD_ULONG(count);
for (const Item* item : items) {
saveItem(stream, item);
}
}
}
示例8: saveTile
void IOMapSerialize::saveTile(PropWriteStream& stream, const Tile* tile)
{
const Position& tilePosition = tile->getPosition();
if (tilePosition.x == 0 || tilePosition.y == 0) {
return;
}
std::vector<Item*> items;
if (const TileItemVector* tileItems = tile->getItemList()) {
for (ItemVector::const_reverse_iterator it = tileItems->rbegin(), rend = tileItems->rend(); it != rend; ++it) {
Item* item = (*it);
// Note that these are NEGATED, ie. these are the items that will be saved.
if (!(!item->isNotMoveable() || item->getDoor() || (item->getContainer() && !item->getContainer()->empty()) || item->canWriteText() || item->getBed())) {
continue;
}
items.push_back(item);
}
}
if (!items.empty()) {
stream.ADD_USHORT(tilePosition.x);
stream.ADD_USHORT(tilePosition.y);
stream.ADD_UCHAR(tilePosition.z);
stream.ADD_ULONG(items.size());
for (const Item* item : items) {
saveItem(stream, item);
}
}
}
示例9: saveTile
bool IOMapSerialize::saveTile(PropWriteStream& stream, const Tile* tile)
{
int32_t tileCount = tile->getThingCount();
if(!tileCount)
return true;
std::vector<Item*> items;
Item* item = NULL;
for(; tileCount > 0; --tileCount)
{
if((item = tile->__getThing(tileCount - 1)->getItem()) &&
(item->isMoveable() || item->forceSerialize()))
items.push_back(item);
}
tileCount = items.size(); //lame, but at least we don't need a new variable
if(tileCount > 0)
{
stream.ADD_USHORT(tile->getPosition().x);
stream.ADD_USHORT(tile->getPosition().y);
stream.ADD_UCHAR(tile->getPosition().z);
stream.ADD_ULONG(tileCount);
for(std::vector<Item*>::iterator it = items.begin(); it != items.end(); ++it)
saveItem(stream, (*it));
}
return true;
}
示例10: serialize
bool ConditionOutfit::serialize(PropWriteStream& propWriteStream)
{
if (!Condition::serialize(propWriteStream)) {
return false;
}
propWriteStream.ADD_UCHAR(CONDITIONATTR_OUTFIT);
propWriteStream.ADD_VALUE(outfit);
return true;
}
示例11: saveItem
void IOMapSerialize::saveItem(PropWriteStream& stream, const Item* item)
{
const Container* container = item->getContainer();
// Write ID & props
stream.ADD_USHORT(item->getID());
item->serializeAttr(stream);
if (container) {
// Hack our way into the attributes
stream.ADD_UCHAR(ATTR_CONTAINER_ITEMS);
stream.ADD_ULONG(container->size());
for (ItemDeque::const_reverse_iterator it = container->getReversedItems(), end = container->getReversedEnd(); it != end; ++it) {
saveItem(stream, *it);
}
}
stream.ADD_UCHAR(0x00); // attr end
}
示例12: serialize
bool ConditionDamage::serialize(PropWriteStream& propWriteStream)
{
if (!Condition::serialize(propWriteStream)) {
return false;
}
propWriteStream.ADD_UCHAR(CONDITIONATTR_DELAYED);
propWriteStream.ADD_VALUE(delayed);
propWriteStream.ADD_UCHAR(CONDITIONATTR_PERIODDAMAGE);
propWriteStream.ADD_VALUE(periodDamage);
// propWriteStream.ADD_UCHAR(CONDITIONATTR_OWNER);
// propWriteStream.ADD_VALUE(owner);
for (const IntervalInfo& intervalInfo : damageList) {
propWriteStream.ADD_UCHAR(CONDITIONATTR_INTERVALDATA);
propWriteStream.ADD_VALUE(intervalInfo);
}
return true;
}
示例13: 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;
}
示例14: serializeAttr
bool Teleport::serializeAttr(PropWriteStream& propWriteStream) const
{
bool ret = Item::serializeAttr(propWriteStream);
propWriteStream.ADD_UCHAR(ATTR_TELE_DEST);
TeleportDest dest;
dest._x = destination.x;
dest._y = destination.y;
dest._z = destination.z;
propWriteStream.ADD_VALUE(dest);
return ret;
}
示例15: serializeAttr
bool Teleport::serializeAttr(PropWriteStream& propWriteStream) const
{
bool ret = Item::serializeAttr(propWriteStream);
propWriteStream.ADD_UCHAR(ATTR_TELE_DEST);
TeleportDest tele_dest;
tele_dest._x = destPos.x;
tele_dest._y = destPos.y;
tele_dest._z = (uint8_t)destPos.z;
propWriteStream.ADD_VALUE(tele_dest);
return ret;
}