Example #1
0
  bool serialize(spire::ComponentSerialize& s, uint64_t /* entityID */)
  {
    std::string asset = assetName;
    s.serialize("name", asset);

    // If we are deserializing, then we need to absolutely sure that
    // requestInitiated is false (although it should be from the constructor
    // and the fact that we did not serialize it).
    if (s.isDeserializing())
    {
      requestInitiated = false;
      setAssetName(asset.c_str());
    }
    return true;
  }
Example #2
0
int addAsset(zoneInfo_t* info, int type, const char* name, void* data)
{
	if(info->assetCount >= MAX_ASSET_COUNT) Com_Error(true, "Tell Apadayo to increase MAX_ASSET_COUNT!");
	int a = containsAsset(info, type, name);
	if(a >= 0) return a;

	// force data to have correct name
	const char* assetName = getAssetName(type, data);
	if (strcmp(assetName, name))
	{
		setAssetName(type, data, name);
	}

	info->assets[info->assetCount].name = R_HashString(name);
	info->assets[info->assetCount].type = type;
	info->assets[info->assetCount].data = data;
#if ZB_DEBUG
	info->assets[info->assetCount].debugName = name;
	info->assets[info->assetCount].verified = false;
#endif

	return info->assetCount++;
}