Skip to content

Instantly share code, notes, and snippets.

@michaelbartnett
Created May 30, 2011 04:00
Show Gist options
  • Save michaelbartnett/998433 to your computer and use it in GitHub Desktop.
Save michaelbartnett/998433 to your computer and use it in GitHub Desktop.
void SoundEventEntity::Serialize(VArchive &ar)
{
VisBaseEntity_cl::Serialize(ar);
char iLocalVersion = 0;
if (ar.IsLoading())
{
ar >> iLocalVersion;
VASSERT(iLocalVersion==0 && "Invalid version number");
ar.Read(EventName, sizeof(EventName));
ar >> MinRadius;
ar >> MaxRadius;
SoundEventEntity::InitFunction(); // ...since serialization does NOT call the InitFunction
}
else
{
ar << iLocalVersion; // very simple versioning to be able to load older versions
ar.Write(EventName, sizeof(EventName));
ar << MinRadius;
ar << MaxRadius;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment