serializeVersion1 static method
Serializes a Peep into a single integer.
Implementation
static int serializeVersion1({required Peep peep}) {
final headIndex = Head.atoms.indexOf(
peep.head,
);
final faceIndex = Face.atoms.indexOf(
peep.face,
);
final facialHairIndex = FacialHair.atoms.indexOf(
peep.facialHair,
);
final accessoryIndex = Accessories.atoms.indexOf(
peep.accessory,
);
var uniquePeepId = 0;
uniquePeepId ^= headIndex;
uniquePeepId <<= 8;
uniquePeepId ^= faceIndex;
uniquePeepId <<= 8;
uniquePeepId ^= facialHairIndex;
uniquePeepId <<= 8;
uniquePeepId ^= accessoryIndex;
return uniquePeepId;
}