Esempio n. 1
0
bool ItemAttributes::unserializeAttributeMap(PropStream& stream)
{

  uint16_t n;
  if(stream.GET_USHORT(n)){
    createAttributes();

    std::string key;
    ItemAttribute attrib;

    while(n--){
      if(!stream.GET_STRING(key))
        return false;
      if(!attrib.unserialize(stream))
        return false;
      (*attributes)[key] = attrib;
    }
  }
  return true;
}
bool ItemAttributes::unserializeMap(PropStream& stream)
{
	uint16_t n;
	if(!stream.getShort(n))
		return true;

	createAttributes();
	while(n--)
	{
		std::string key;
		if(!stream.getString(key))
			return false;

		ItemAttribute attr;
		if(!attr.unserialize(stream))
			return false;

		(*attributes)[key] = attr;
	}

	return true;
}