当前位置: 首页>>代码示例>>C++>>正文


C++ PropWriteStream::ADD_UCHAR方法代码示例

本文整理汇总了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;
  }
}
开发者ID:RGZorzo,项目名称:server,代码行数:26,代码来源:item_attributes.cpp

示例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;
}
开发者ID:Ablankzin,项目名称:forgottenserver,代码行数:9,代码来源:teleport.cpp

示例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;
}
开发者ID:gianflogao,项目名称:divinity-ots,代码行数:12,代码来源:condition.cpp

示例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;
}
开发者ID:armadaazteca,项目名称:tfs0.2.15,代码行数:13,代码来源:condition.cpp

示例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;
}
开发者ID:24312108k,项目名称:forgottenserver,代码行数:14,代码来源:beds.cpp

示例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;
}
开发者ID:PrzemolKing,项目名称:wedoserver,代码行数:15,代码来源:iomapserialize.cpp

示例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);
		}
	}
}
开发者ID:Emperian,项目名称:forgottenserver,代码行数:31,代码来源:iomapserialize.cpp

示例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);
		}
	}
}
开发者ID:AhmedWaly,项目名称:forgottenserver,代码行数:33,代码来源:iomapserialize.cpp

示例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;
}
开发者ID:PrzemolKing,项目名称:wedoserver,代码行数:29,代码来源:iomapserialize.cpp

示例10: serialize

bool ConditionOutfit::serialize(PropWriteStream& propWriteStream)
{
	if (!Condition::serialize(propWriteStream)) {
		return false;
	}

	propWriteStream.ADD_UCHAR(CONDITIONATTR_OUTFIT);
	propWriteStream.ADD_VALUE(outfit);
	return true;
}
开发者ID:sheen123,项目名称:forgottenserver,代码行数:10,代码来源:condition.cpp

示例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
}
开发者ID:Emperian,项目名称:forgottenserver,代码行数:20,代码来源:iomapserialize.cpp

示例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;
}
开发者ID:A-Dirty-Rag,项目名称:forgottenserver,代码行数:21,代码来源:condition.cpp

示例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;
}
开发者ID:Ablankzin,项目名称:server,代码行数:27,代码来源:condition.cpp

示例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;
}
开发者ID:A-Syntax,项目名称:cryingdamson-0.3.6-8.60-V8.2,代码行数:13,代码来源:teleport.cpp

示例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;
}
开发者ID:oneshot-git,项目名称:forgottenserver,代码行数:14,代码来源:teleport.cpp


注:本文中的PropWriteStream::ADD_UCHAR方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。