/**
* Load the game elements from the input stream.
* @param ldr Input stream to load from.
* @note Order of loading should be the same as in #SaveElements.
*/
static void LoadElements(Loader &ldr)
{
uint32 version = ldr.OpenBlock("FCTS");
if (version > 3) ldr.SetFailMessage("Bad file header");
ldr.CloseBlock();
Loader reset_loader(nullptr);
LoadDate(ldr);
_world.Load((version >= 3) ? ldr : reset_loader);
Random::Load(ldr);
_finances_manager.Load((version >= 2) ? ldr : reset_loader);
if (reset_loader.IsFail()) ldr.SetFailMessage(reset_loader.GetFailMessage());
}
/**
* Write the game elements to the output stream.
* @param svr Output stream to write to.
* @note Order of saving should be the same as in #LoadElements.
*/
static void SaveElements(Saver &svr)
{
svr.StartBlock("FCTS", 3);
svr.EndBlock();
SaveDate(svr);
_world.Save(svr);
Random::Save(svr);
_finances_manager.Save(svr);
}