Skip to content

Instantly share code, notes, and snippets.

@pmiddend
Created December 30, 2015 14:13
Show Gist options
  • Select an option

  • Save pmiddend/42f15b08384b22cbb6bf to your computer and use it in GitHub Desktop.

Select an option

Save pmiddend/42f15b08384b22cbb6bf to your computer and use it in GitHub Desktop.
fcppt::optional<level_actor>
load_actor(std::istream &s)
{
auto id = fcppt::io::read<level_actor::id_type>(s,fcppt::endianness::format::little);
auto pos_x = fcppt::io::read<level_actor::pos_type>(s,fcppt::endianness::format::little);
auto pos_y = fcppt::io::read<level_actor::pos_type>(s,fcppt::endianness::format::little);
return
fcppt::optional_apply(
[](
level_actor::id_type const _id,
level_actor::pos_type const _pos_x,
level_actor::pos_type const _pos_y)
{
return level_actor{_id,_pos_x,_pos_y};
},
id,
pos_x,
pos_y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment