class tile
{
public:
int TileNum;
bool Passable;
bool Illusion;
bool DrawAbove;
unsignedint HideOnCondition;
bool CastShadow;
bool ShowShadow;
tile()
{
TileNum=998;
Passable=false;
Illusion=false;
DrawAbove=false;
HideOnCondition=0;
CastShadow=true;
ShowShadow=true;
}
friendclass boost::serialization::access;
// When the class Archive corresponds to an output archive, the
// & operator is defined similar to <<. Likewise, when the class Archive
// is a type of input archive the & operator is defined similar to >>.
template<class Archive>
void save(Archive & ar, constunsignedint version) const
{
ar & TileNum;
ar & HideOnCondition;
unsignedint bitTotal = 0;
if (Passable) bitTotal +=1 ;
if (Illusion) bitTotal +=2;
if (DrawAbove) bitTotal +=4 ;
if (CastShadow) bitTotal +=8 ;
if (ShowShadow) bitTotal +=16 ;
ar & bitTotal;
}
template<class Archive>
void load(Archive & ar, constunsignedint version)
{
unsignedint bitTotal;
ar & TileNum;
ar & HideOnCondition;
ar & bitTotal;
Passable=false;
if((bitTotal & 1) == 1)Passable=true;
Illusion=false;
if((bitTotal & 2) == 2)Illusion=true;
DrawAbove=false;
if((bitTotal & 4) == 4)DrawAbove=true;
CastShadow=false;
if((bitTotal & 8) == 8)CastShadow=true;
ShowShadow=false;
if((bitTotal & 16) == 16)ShowShadow=true;
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
};
the output looks correct (if I comment out the loading line so, it runs to the saving line)