本文整理汇总了C++中PropStream::GET_VALUE方法的典型用法代码示例。如果您正苦于以下问题:C++ PropStream::GET_VALUE方法的具体用法?C++ PropStream::GET_VALUE怎么用?C++ PropStream::GET_VALUE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropStream
的用法示例。
在下文中一共展示了PropStream::GET_VALUE方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unserializeProp
bool ConditionSpeed::unserializeProp(ConditionAttr_t attr, PropStream& propStream)
{
switch(attr)
{
case CONDITIONATTR_SPEEDDELTA:
{
int32_t value = 0;
if(!propStream.GET_VALUE(value))
return false;
speedDelta = value;
return true;
}
case CONDITIONATTR_FORMULA_MINA:
{
float value = 0;
if(!propStream.GET_VALUE(value))
return false;
mina = value;
return true;
}
case CONDITIONATTR_FORMULA_MINB:
{
float value = 0;
if(!propStream.GET_VALUE(value))
return false;
minb = value;
return true;
}
case CONDITIONATTR_FORMULA_MAXA:
{
float value = 0;
if(!propStream.GET_VALUE(value))
return false;
maxa = value;
return true;
}
case CONDITIONATTR_FORMULA_MAXB:
{
float value = 0;
if(!propStream.GET_VALUE(value))
return false;
maxb = value;
return true;
}
default:
break;
}
return ConditionOutfit::unserializeProp(attr, propStream);
}
示例2: unserializeProp
bool Condition::unserializeProp(ConditionAttr_t attr, PropStream& propStream)
{
switch (attr) {
case CONDITIONATTR_TYPE: {
int32_t value;
if (!propStream.GET_VALUE(value)) {
return false;
}
conditionType = (ConditionType_t)value;
return true;
}
case CONDITIONATTR_ID: {
int32_t value;
if (!propStream.GET_VALUE(value)) {
return false;
}
id = (ConditionId_t)value;
return true;
}
case CONDITIONATTR_TICKS: {
int32_t value;
if (!propStream.GET_VALUE(value)) {
return false;
}
ticks = value;
return true;
}
case CONDITIONATTR_ISBUFF: {
int8_t value;
if (!propStream.GET_VALUE(value)) {
return false;
}
isBuff = value != 0;
return true;
}
case CONDITIONATTR_SUBID: {
int32_t value;
if (!propStream.GET_VALUE(value)) {
return false;
}
subId = value;
return true;
}
case CONDITIONATTR_END:
return true;
default:
return false;
}
}
示例3: unserializeProp
bool ConditionAttributes::unserializeProp(ConditionAttr_t attr, PropStream& propStream)
{
if (attr == CONDITIONATTR_SKILLS) {
int32_t value = 0;
if (!propStream.GET_VALUE(value)) {
return false;
}
skills[currentSkill] = value;
++currentSkill;
return true;
} else if (attr == CONDITIONATTR_STATS) {
int32_t value = 0;
if (!propStream.GET_VALUE(value)) {
return false;
}
stats[currentStat] = value;
++currentStat;
return true;
}
return Condition::unserializeProp(attr, propStream);
}
示例4: unserializeProp
bool ConditionOutfit::unserializeProp(ConditionAttr_t attr, PropStream& propStream)
{
if (attr == CONDITIONATTR_OUTFIT) {
return propStream.GET_VALUE(this->outfit);
}
return Condition::unserializeProp(attr, propStream);
}
示例5: unserializeProp
bool ConditionSoul::unserializeProp(ConditionAttr_t attr, PropStream& propStream)
{
if(attr == CONDITIONATTR_SOULGAIN)
{
uint32_t value = 0;
if(!propStream.GET_VALUE(value))
return false;
soulGain = value;
return true;
}
else if(attr == CONDITIONATTR_SOULTICKS)
{
uint32_t value = 0;
if(!propStream.GET_VALUE(value))
return false;
soulTicks = value;
return true;
}
return Condition::unserializeProp(attr, propStream);
}
示例6: loadFromOtb
int32_t Items::loadFromOtb(const std::string& file)
{
FileLoader f;
if (!f.openFile(file.c_str(), "OTBI")) {
return f.getError();
}
uint32_t type;
NODE node = f.getChildNode(NO_NODE, type);
PropStream props;
if (f.getProps(node, props)) {
//4 byte flags
//attributes
//0x01 = version data
uint32_t flags;
if (!props.GET_ULONG(flags)) {
return ERROR_INVALID_FORMAT;
}
uint8_t attr;
if (!props.GET_VALUE(attr)) {
return ERROR_INVALID_FORMAT;
}
if (attr == ROOT_ATTR_VERSION) {
uint16_t datalen;
if (!props.GET_VALUE(datalen)) {
return ERROR_INVALID_FORMAT;
}
if (datalen != sizeof(VERSIONINFO)) {
return ERROR_INVALID_FORMAT;
}
VERSIONINFO* vi;
if (!props.GET_STRUCT(vi)) {
return ERROR_INVALID_FORMAT;
}
Items::dwMajorVersion = vi->dwMajorVersion; //items otb format file version
Items::dwMinorVersion = vi->dwMinorVersion; //client version
Items::dwBuildNumber = vi->dwBuildNumber; //revision
}
}
if (Items::dwMajorVersion == 0xFFFFFFFF) {
std::cout << "[Warning - Items::loadFromOtb] items.otb using generic client version." << std::endl;
} else if (Items::dwMajorVersion != 3) {
std::cout << "Old version detected, a newer version of items.otb is required." << std::endl;
return ERROR_INVALID_FORMAT;
} else if (Items::dwMinorVersion < CLIENT_VERSION_1035) {
std::cout << "A newer version of items.otb is required." << std::endl;
return ERROR_INVALID_FORMAT;
}
node = f.getChildNode(node, type);
while (node != NO_NODE) {
PropStream stream;
if (!f.getProps(node, stream)) {
return f.getError();
}
uint32_t flags;
if (!stream.GET_VALUE(flags)) {
return ERROR_INVALID_FORMAT;
}
uint16_t serverId = 0;
uint16_t clientId = 0;
uint16_t speed = 0;
uint16_t lightLevel = 0;
uint16_t lightColor = 0;
uint16_t wareId = 0;
uint8_t alwaysOnTopOrder = 0;
uint8_t attrib;
while (stream.GET_VALUE(attrib)) {
uint16_t datalen;
if (!stream.GET_VALUE(datalen)) {
return ERROR_INVALID_FORMAT;
}
switch (attrib) {
case ITEM_ATTR_SERVERID: {
if (datalen != sizeof(uint16_t)) {
return ERROR_INVALID_FORMAT;
}
if (!stream.GET_USHORT(serverId)) {
return ERROR_INVALID_FORMAT;
}
if (serverId > 30000 && serverId < 30100) {
serverId -= 30000;
}
break;
}
case ITEM_ATTR_CLIENTID: {
//.........这里部分代码省略.........
示例7: loadFromOtb
int Items::loadFromOtb(std::string file)
{
ItemLoader f;
if(!f.openFile(file.c_str(), false, true)){
return f.getError();
}
unsigned long type,len;
const unsigned char* data;
NODE node = f.getChildNode(NO_NODE, type);
PropStream props;
if(f.getProps(node,props)){
//4 byte flags
//attributes
//0x01 = version data
unsigned long flags;
if(!props.GET_ULONG(flags)){
return ERROR_INVALID_FORMAT;
}
attribute_t attr;
datasize_t datalen = 0;
if(!props.GET_VALUE(attr)){
return ERROR_INVALID_FORMAT;
}
if(attr == ROOT_ATTR_VERSION){
if(!props.GET_VALUE(datalen)){
return ERROR_INVALID_FORMAT;
}
if(datalen != sizeof(VERSIONINFO)){
return ERROR_INVALID_FORMAT;
}
VERSIONINFO *vi;
if(!props.GET_STRUCT(vi)){
return ERROR_INVALID_FORMAT;
}
Items::dwMajorVersion = vi->dwMajorVersion;
Items::dwMinorVersion = vi->dwMinorVersion;
Items::dwBuildNumber = vi->dwBuildNumber;
}
}
if(Items::dwMinorVersion != CLIENT_VERSION_760){
std::cout << "Not supported items.otb client version." << std::endl;
return ERROR_INVALID_FORMAT;
}
node = f.getChildNode(node, type);
while(node != NO_NODE) {
data = f.getProps(node, len);
if(data == NULL && f.getError() != ERROR_NONE)
return f.getError();
flags_t flags;
if(data != NULL) {
const unsigned char* p = &data[0];
ItemType* iType = new ItemType();
bool loadedFlags = false;
while(p < data + len) {
iType->group = (itemgroup_t)type;
switch(type) {
case ITEM_GROUP_NONE:
case ITEM_GROUP_GROUND:
case ITEM_GROUP_CONTAINER:
case ITEM_GROUP_WEAPON:
case ITEM_GROUP_AMMUNITION:
case ITEM_GROUP_ARMOR:
case ITEM_GROUP_RUNE:
case ITEM_GROUP_TELEPORT:
case ITEM_GROUP_MAGICFIELD:
case ITEM_GROUP_WRITEABLE:
case ITEM_GROUP_KEY:
case ITEM_GROUP_SPLASH:
case ITEM_GROUP_FLUID:
{
if(!loadedFlags) {
//read 4 byte flags
memcpy((void*)&flags, p, sizeof(flags_t)); p+= sizeof(flags_t);
iType->blockSolid = ((flags & FLAG_BLOCK_SOLID) == FLAG_BLOCK_SOLID);
iType->blockProjectile = ((flags & FLAG_BLOCK_PROJECTILE) == FLAG_BLOCK_PROJECTILE);
iType->blockPathFind = ((flags & FLAG_BLOCK_PATHFIND) == FLAG_BLOCK_PATHFIND);
iType->hasHeight = ((flags & FLAG_HAS_HEIGHT) == FLAG_HAS_HEIGHT);
iType->useable = ((flags & FLAG_USEABLE) == FLAG_USEABLE);
iType->pickupable = ((flags & FLAG_PICKUPABLE) == FLAG_PICKUPABLE);
iType->moveable = ((flags & FLAG_MOVEABLE) == FLAG_MOVEABLE);
iType->stackable = ((flags & FLAG_STACKABLE) == FLAG_STACKABLE);
iType->floorChangeDown = ((flags & FLAG_FLOORCHANGEDOWN) == FLAG_FLOORCHANGEDOWN);
iType->floorChangeNorth = ((flags & FLAG_FLOORCHANGENORTH) == FLAG_FLOORCHANGENORTH);
iType->floorChangeEast = ((flags & FLAG_FLOORCHANGEEAST) == FLAG_FLOORCHANGEEAST);
iType->floorChangeSouth = ((flags & FLAG_FLOORCHANGESOUTH) == FLAG_FLOORCHANGESOUTH);
iType->floorChangeWest = ((flags & FLAG_FLOORCHANGEWEST) == FLAG_FLOORCHANGEWEST);
iType->alwaysOnTop = ((flags & FLAG_ALWAYSONTOP) == FLAG_ALWAYSONTOP);
iType->canDecay = !((flags & FLAG_CANNOTDECAY) == FLAG_CANNOTDECAY);
if(type == ITEM_GROUP_WRITEABLE) {
iType->RWInfo |= CAN_BE_WRITTEN;
//.........这里部分代码省略.........
示例8: unserialize
bool Condition::unserialize(PropStream& propStream)
{
uint8_t attr_type;
while(propStream.GET_UCHAR(attr_type) && attr_type != CONDITIONATTR_END.value()){
if(attr_type == enums::CONDITIONATTRIBUTE_MECHANIC){
int32_t value = 0;
if(!propStream.GET_VALUE(value)){
return false;
}
mechanicType = (MechanicType)value;
}
else if(attr_type == enums::CONDITIONATTRIBUTE_COMBAT){
int32_t value = 0;
if(!propStream.GET_VALUE(value)){
return false;
}
combatType = (CombatType)value;
return true;
}
else if(attr_type == enums::CONDITIONATTRIBUTE_TICKS){
uint32_t value = 0;
if(!propStream.GET_VALUE(value)){
return false;
}
ticks = value;
}
else if(attr_type == enums::CONDITIONATTRIBUTE_NAME){
std::string value;
if(!propStream.GET_STRING(value)){
return false;
}
name = value;
}
else if(attr_type == enums::CONDITIONATTRIBUTE_FLAGS){
uint32_t value = 0;
if(!propStream.GET_VALUE(value)){
return false;
}
flags = value;
}
else if(attr_type == enums::CONDITIONATTRIBUTE_EFFECT){
ConditionEffect effect;
if(!effect.unserialize(propStream)){
return false;
}
addEffect(effect);
}
else{
return false;
}
}
return true;
}
示例9: loadFromOtb
int Items::loadFromOtb(std::string file)
{
ItemLoader f;
if(!f.openFile(file.c_str(), false, true)){
return f.getError();
}
unsigned long type;
NODE node = f.getChildNode(NO_NODE, type);
PropStream props;
if(f.getProps(node,props)){
//4 byte flags
//attributes
//0x01 = version data
unsigned long flags;
if(!props.GET_ULONG(flags)){
return ERROR_INVALID_FORMAT;
}
attribute_t attr;
if(!props.GET_VALUE(attr)){
return ERROR_INVALID_FORMAT;
}
if(attr == ROOT_ATTR_VERSION){
datasize_t datalen = 0;
if(!props.GET_VALUE(datalen)){
return ERROR_INVALID_FORMAT;
}
if(datalen != sizeof(VERSIONINFO)){
return ERROR_INVALID_FORMAT;
}
VERSIONINFO *vi;
if(!props.GET_STRUCT(vi)){
return ERROR_INVALID_FORMAT;
}
Items::dwMajorVersion = vi->dwMajorVersion; //items otb format file version
Items::dwMinorVersion = vi->dwMinorVersion; //client version
Items::dwBuildNumber = vi->dwBuildNumber; //revision
}
}
if(Items::dwMajorVersion != 1){
std::cout << "Not supported items.otb version." << std::endl;
return ERROR_INVALID_FORMAT;
}
if(Items::dwMinorVersion != CLIENT_VERSION_760){
std::cout << "Not supported items.otb client version." << std::endl;
return ERROR_INVALID_FORMAT;
}
node = f.getChildNode(node, type);
while(node != NO_NODE){
PropStream props;
if(!f.getProps(node,props)){
return f.getError();
}
flags_t flags;
ItemType* iType = new ItemType();
iType->group = (itemgroup_t)type;
switch(type){
case ITEM_GROUP_NONE:
case ITEM_GROUP_GROUND:
case ITEM_GROUP_CONTAINER:
case ITEM_GROUP_WEAPON:
case ITEM_GROUP_AMMUNITION:
case ITEM_GROUP_ARMOR:
case ITEM_GROUP_RUNE:
case ITEM_GROUP_TELEPORT:
case ITEM_GROUP_MAGICFIELD:
case ITEM_GROUP_WRITEABLE:
case ITEM_GROUP_KEY:
case ITEM_GROUP_SPLASH:
case ITEM_GROUP_FLUID:
case ITEM_GROUP_DOOR:
break;
default:
return ERROR_INVALID_FORMAT;
break;
}
//read 4 byte flags
if(!props.GET_VALUE(flags)){
return ERROR_INVALID_FORMAT;
}
iType->blockSolid = ((flags & FLAG_BLOCK_SOLID) == FLAG_BLOCK_SOLID);
iType->blockProjectile = ((flags & FLAG_BLOCK_PROJECTILE) == FLAG_BLOCK_PROJECTILE);
iType->blockPathFind = ((flags & FLAG_BLOCK_PATHFIND) == FLAG_BLOCK_PATHFIND);
iType->hasHeight = ((flags & FLAG_HAS_HEIGHT) == FLAG_HAS_HEIGHT);
iType->useable = ((flags & FLAG_USEABLE) == FLAG_USEABLE);
iType->pickupable = ((flags & FLAG_PICKUPABLE) == FLAG_PICKUPABLE);
iType->moveable = ((flags & FLAG_MOVEABLE) == FLAG_MOVEABLE);
iType->stackable = ((flags & FLAG_STACKABLE) == FLAG_STACKABLE);
iType->floorChangeDown = ((flags & FLAG_FLOORCHANGEDOWN) == FLAG_FLOORCHANGEDOWN);
iType->floorChangeNorth = ((flags & FLAG_FLOORCHANGENORTH) == FLAG_FLOORCHANGENORTH);
iType->floorChangeEast = ((flags & FLAG_FLOORCHANGEEAST) == FLAG_FLOORCHANGEEAST);
//.........这里部分代码省略.........