sanguis::server::entities::remove_from_world_result sanguis::server::entities::with_ghosts::remove_from_world() { sanguis::server::environment::object &cur_environment( FCPPT_ASSERT_OPTIONAL_ERROR( this->environment() ).get() ); return sanguis::server::entities::remove_from_world_result( fcppt::algorithm::map_concat< sanguis::collision::world::body_exit_container >( ghosts_, [ this, &cur_environment ]( sanguis::server::collision::ghost &_ghost ) { return _ghost.destroy( cur_environment.collision_world() ); } ) ); }
void fcppt::log::detail::auto_context::transfer( fcppt::log::context &_context, fcppt::log::object &_object ) { fcppt::log::detail::auto_context_rep &rep( FCPPT_ASSERT_OPTIONAL_ERROR( rep_ ) ); rep.context().remove( rep.node() ); rep.context( _context ); rep.node( _context.add( rep.location(), _object ) ); }
sanguis::creator::impl::optional_pos sanguis::creator::impl::closest_empty( sanguis::creator::grid const &_grid, sanguis::creator::pos const _pos ) { return sanguis::creator::impl::find_closest( _grid, _pos, [ &_grid ]( sanguis::creator::pos const _p ){ return FCPPT_ASSERT_OPTIONAL_ERROR( fcppt::container::grid::at_optional( _grid, _p ) ).get() == sanguis::creator::tile::nothing; }, fcppt::optional::object< sanguis::creator::pos::value_type >{} ); }
GLvoid * sge::opengl::buffer::hardware::map_buffer_range( GLenum const _flags, GLsizei const _first, GLsizei const _size ) { GLvoid *const ret( FCPPT_ASSERT_OPTIONAL_ERROR( config_.map_buffer_range() ).get()( type_.get(), _first, _size, _flags ) ); SGE_OPENGL_CHECK_STATE( FCPPT_TEXT("glMapBufferRange failed"), sge::renderer::exception ) return ret; }
IDirect3DVertexBuffer9 & sge::d3d9::vertex::buffer::get() const { return *FCPPT_ASSERT_OPTIONAL_ERROR( buffer_ ); }
sge::camera::projection_matrix sge::camera::spherical::object::projection_matrix() const { return FCPPT_ASSERT_OPTIONAL_ERROR( projection_matrix_ ); }
IDirect3DIndexBuffer9 & sge::d3d9::index_buffer::get() const { return *FCPPT_ASSERT_OPTIONAL_ERROR( buffer_ ); }
sanguis::server::center sanguis::server::collision::body::center() const { return sanguis::server::collision::from_center( FCPPT_ASSERT_OPTIONAL_ERROR( body_ )->center() ); }
sanguis::server::speed sanguis::server::collision::body::speed() const { return sanguis::server::collision::from_speed( FCPPT_ASSERT_OPTIONAL_ERROR( body_ )->speed() ); }
void sanguis::server::entities::enemies::enemy::remove_from_game() { fcppt::optional::maybe_void( spawn_owner_.get().get(), [ this ]( fcppt::reference< sanguis::server::entities::with_links > const _spawn_owner ) { fcppt::cast::static_downcast< sanguis::server::entities::spawns::spawn & >( _spawn_owner.get() ) .unregister( *this ); } ); sanguis::server::environment::object &cur_environment( FCPPT_ASSERT_OPTIONAL_ERROR( this->environment() ).get() ); sanguis::server::environment::insert_no_result( cur_environment, fcppt::unique_ptr_to_base< sanguis::server::entities::simple >( fcppt::make_unique_ptr< sanguis::server::entities::exp_area >( exp_ ) ), sanguis::server::entities::insert_parameters_center( this->center() ) ); cur_environment.pickup_chance( pickup_probability_, difficulty_, this->center() ); }
void sanguis::server::collision::body::center( sanguis::server::center const _center ) { FCPPT_ASSERT_OPTIONAL_ERROR( body_ )->center( sanguis::server::collision::to_center( _center ) ); }
void sanguis::server::collision::body::speed( sanguis::server::speed const _speed ) { FCPPT_ASSERT_OPTIONAL_ERROR( body_ )->speed( sanguis::server::collision::to_speed( _speed ) ); }
sge::camera::coordinate_system::object sge::camera::spherical::coordinate_system::to_camera_coordinate_system( spherical::coordinate_system::object const &_coordinate_system, spherical::origin const &_origin ) { sge::camera::coordinate_system::forward const forward_vector( spherical_coordinates( _coordinate_system ) ); sge::camera::coordinate_system::position const position_vector( _origin.get() + _coordinate_system.radius().get() * forward_vector.get() ); sge::camera::coordinate_system::right const right_vector( FCPPT_ASSERT_OPTIONAL_ERROR( fcppt::math::vector::normalize( fcppt::math::vector::cross( forward_vector.get(), sge::renderer::vector3{ 0.0f, 1.0f, 0.0f } ) ) ) ); // No need to normalize here sge::camera::coordinate_system::up const up_vector( fcppt::math::vector::cross( right_vector.get(), forward_vector.get() ) ); return sge::camera::coordinate_system::object( right_vector, up_vector, forward_vector, position_vector ); }
void sanguis::client::draw2d::entities::buffs::slow::remove( sanguis::client::draw2d::entities::model::object &_model ) { _model.color( FCPPT_ASSERT_OPTIONAL_ERROR( previous_color_ ) ); previous_color_ = optional_color(); }
void sge::d3d9::texture::basic_buffer< Types >::unlock() const { Types::unlock( *FCPPT_ASSERT_OPTIONAL_ERROR( buffer_ ) ); buffer_ = optional_d3d_buffer_unique_ptr(); locked_dest_ = locked_dest(); }
void sanguis::server::entities::exp_area::remove_from_game() { // TODO: Do this differently! fcppt::algorithm::map_iteration_second( player_links_, []( sanguis::server::entities::auto_weak_link const &_link ) { return _link.get().has_value() ? fcppt::algorithm::update_action::keep : fcppt::algorithm::update_action::remove ; } ); for( auto &player_link : player_links_ ) fcppt::cast::static_downcast< sanguis::server::entities::player & >( FCPPT_ASSERT_OPTIONAL_ERROR( player_link.second.get() ).get() ).add_exp( sanguis::server::exp( exp_.get() / fcppt::cast::int_to_float< sanguis::server::exp::value_type >( player_links_.size() ) ) ); }
sanguis::collision::world::body_enter_container sanguis::server::entities::with_ghosts::add_ghost( sanguis::server::collision::ghost &&_ghost ) { ghosts_.push_back( std::move( _ghost ) ); return ghosts_.back().transfer( FCPPT_ASSERT_OPTIONAL_ERROR( this->environment() ).get().collision_world(), this->center() ); }
sanguis::collision::world::body_exit_container sanguis::server::collision::body::remove( sanguis::collision::world::object &_world ) { sanguis::collision::world::body_exit_container result( _world.deactivate_body( *FCPPT_ASSERT_OPTIONAL_ERROR( body_ ) ) ); body_ = optional_body_unique_ptr(); return result; }
void sanguis::server::ai::behavior::follow_friend::target_enters( sanguis::server::entities::with_body &_with_body ) { FCPPT_ASSERT_ERROR( potential_targets_.insert( fcppt::make_ref( _with_body ) ) .second ); target_ = FCPPT_ASSERT_OPTIONAL_ERROR( this->first_target() ).get().link(); }
sanguis::client::draw2d::entities::order_function sanguis::client::draw2d::entities::order_function_from_vector( sanguis::client::draw2d::z_ordering_vector &&_orders ) { // TODO: Use capture by move sanguis::client::draw2d::z_ordering_vector const orders( std::move( _orders ) ); return sanguis::client::draw2d::entities::order_function{ [ orders ]( sanguis::client::draw2d::sprite::index const _index ) { return fcppt::optional::from( fcppt::optional::copy_value( fcppt::container::at_optional( orders, _index.get() ) ), [ orders ]{ // TODO: error message return FCPPT_ASSERT_OPTIONAL_ERROR( fcppt::container::maybe_back( orders ) ).get(); } ); } }; }
void sge::scenic::render_context::cg::object::render( sge::renderer::index::buffer const &_index_buffer, sge::scenic::index_buffer_range const &_index_buffer_range) { context_.render_indexed( _index_buffer, sge::renderer::vertex::first( 0u ), sge::renderer::vertex::count( FCPPT_ASSERT_OPTIONAL_ERROR( current_vertex_buffer_ ).get().linear_size() ), sge::renderer::primitive_type::triangle_list, _index_buffer_range.first_index(), _index_buffer_range.index_count() ); }
void sanguis::server::entities::with_ai::update() { sanguis::server::entities::with_weapon::update(); if( update_timer_.expired() ) { // TODO: Make this easier in sge FCPPT_ASSERT_OPTIONAL_ERROR( ai_ )->run( update_timer_.now() - update_timer_.last_time() ); update_timer_.reset(); } }
sge::camera::tracking::object::object( sge::camera::optional_projection_matrix const &_projection_matrix, sge::camera::tracking::keyframe_sequence const &_keyframes, sge::camera::tracking::is_looping const _is_looping ) : sge::camera::base{}, sge::camera::is_dynamic{}, sge::camera::has_mutable_projection{}, projection_matrix_{ _projection_matrix }, keyframes_{ _keyframes }, is_looping_{ _is_looping }, current_keyframe_{ keyframes_.begin(), cyclic_iterator::boundary{ keyframes_.begin(), keyframes_.end() } }, current_time_point_{ 0.0f }, coordinate_system_{ FCPPT_ASSERT_OPTIONAL_ERROR( fcppt::container::maybe_front( keyframes_ ) ).get().coordinate_system() }, finished_{ false } { }
void fcppt::log::level_stream::log( fcppt::log::detail::temporary_output const &_output, fcppt::log::format::function const &_additional_formatter ) { fcppt::io::ostream &dest( FCPPT_ASSERT_OPTIONAL_ERROR( dest_ ) ); dest << fcppt::log::format::create_chain( _additional_formatter, this->formatter() )( _output.result() ); dest.flush(); }
void sanguis::server::entities::projectiles::rocket::remove_from_game() { sanguis::server::environment::insert_no_result( FCPPT_ASSERT_OPTIONAL_ERROR( this->environment() ).get(), fcppt::unique_ptr_to_base< sanguis::server::entities::simple >( fcppt::make_unique_ptr< sanguis::server::entities::projectiles::aoe_damage >( this->team(), this->aoe(), damage_, damage_modifiers_ ) ), sanguis::server::entities::insert_parameters_center( this->center() ) ); }
void sge::d3d9::render_context::object::offscreen_target( sge::renderer::target::optional_offscreen_ref const &_new_target ) { fcppt::optional::maybe( _new_target, [ this ]{ { sge::d3d9::target::base &cur_target( FCPPT_ASSERT_OPTIONAL_ERROR( offscreen_target_ ).get() ); cur_target.active( false ); } offscreen_target_ = sge::d3d9::render_context::object::optional_target_base_ref(); scoped_target_.target().active( true ); }, [ this ]( fcppt::reference< sge::renderer::target::offscreen > const _target ) { FCPPT_ASSERT_PRE( !offscreen_target_.has_value() ); scoped_target_.target().active( false ); sge::d3d9::target::base &new_target( dynamic_cast< sge::d3d9::target::base & >( _target.get() ) ); new_target.active( true ); offscreen_target_ = sge::d3d9::render_context::object::optional_target_base_ref( fcppt::make_ref( new_target ) ); } ); }
boost::statechart::result sanguis::server::weapons::states::castpoint::react( sanguis::server::weapons::events::poll const & ) { if( !attack_time_.expired() ) return this->discard_event(); sanguis::server::entities::with_weapon &owner( this->context< sanguis::server::weapons::weapon >().owner() ); return fcppt::optional::maybe( owner.target(), [ this ] { this->post_event( sanguis::server::weapons::events::stop() ); return this->transit< sanguis::server::weapons::states::backswing >(); }, [ &owner, this ]( sanguis::server::weapons::target const _target ) { switch( this->context< sanguis::server::weapons::weapon >().do_attack( sanguis::server::weapons::attack( fcppt::optional::maybe( this->context< sanguis::server::weapons::weapon >().accuracy(), [ &owner ] { return owner.angle(); }, [ &owner, this ]( sanguis::server::weapons::attributes::accuracy const _accuracy ) { return sanguis::server::weapons::random_angle( this->context< sanguis::server::weapons::weapon >().random_generator(), _accuracy.value(), owner.angle() ); } ), FCPPT_ASSERT_OPTIONAL_ERROR( owner.environment() ).get(), _target ) ) ) { case sanguis::server::weapons::attack_result::success: this->context< sanguis::server::weapons::weapon >().use_magazine_item(); break; case sanguis::server::weapons::attack_result::failure: break; } if( cancelled_ ) this->post_event( sanguis::server::weapons::events::stop() ); return this->transit< sanguis::server::weapons::states::backswing >(); } ); }
sanguis::creator::impl::result sanguis::creator::impl::generators::graveyard( sanguis::creator::impl::parameters const &_parameters ) { sanguis::creator::impl::reachable_grid initial_maze{ sanguis::creator::grid::dim{ 9u, 9u }, sanguis::creator::impl::reachable(false) }; sanguis::creator::impl::generate_maze( initial_maze, _parameters.randgen() ); sanguis::creator::grid grid{ sanguis::creator::impl::maze_to_tile_grid( initial_maze, 1u, 5u, sanguis::creator::tile::nothing, sanguis::creator::tile::hedge ) }; sanguis::creator::opening_container_array openings( sanguis::creator::impl::place_openings( grid, _parameters.randgen(), _parameters.opening_count_array() ) ); typedef fcppt::random::distribution::basic< sanguis::creator::impl::random::uniform_int< unsigned > > uniform_int2; auto fill_tile_random( fcppt::random::make_variate( _parameters.randgen(), uniform_int2{ uniform_int2::param_type::min{ 0u }, uniform_int2::param_type::max{ 10u } } ) ); typedef fcppt::random::distribution::basic< sanguis::creator::impl::random::uniform_int< sanguis::creator::tile > > uniform_tile_enum; sanguis::creator::background_grid grid_bg{ grid.size(), sanguis::creator::background_tile::grass }; // TODO: Draw this from a container auto random_dirt_grass( fcppt::random::make_variate( _parameters.randgen(), uniform_int2{ uniform_int2::param_type::min{ 0u }, uniform_int2::param_type::max{ 1u } } ) ); for( auto const pos : sanguis::creator::impl::interior_range( grid_bg ) ) pos.value() = random_dirt_grass() ? sanguis::creator::background_tile::dirt : sanguis::creator::background_tile::grass; auto random_grave( fcppt::random::make_variate( _parameters.randgen(), uniform_tile_enum( uniform_tile_enum::param_type::min( sanguis::creator::tile::grave2 ), uniform_tile_enum::param_type::max( sanguis::creator::tile::grave5 ) ) ) ); for( auto const cell : fcppt::container::grid::make_pos_ref_range( grid ) ) { if( cell.value() == sanguis::creator::tile::nothing && fill_tile_random() == 0 && FCPPT_ASSERT_OPTIONAL_ERROR( fcppt::container::grid::at_optional( grid_bg, cell.pos() ) ).get() == sanguis::creator::background_tile::grass ) cell.value() = random_grave(); } sanguis::creator::spawn_container spawners{ sanguis::creator::impl::place_spawners( _parameters.log(), grid, openings, 10u, _parameters.randgen(), sanguis::creator::impl::enemy_type_container{ sanguis::creator::enemy_type::zombie00, sanguis::creator::enemy_type::zombie01, sanguis::creator::enemy_type::skeleton, sanguis::creator::enemy_type::ghost }, _parameters.spawn_boss(), sanguis::creator::tile::grave1 ) }; return sanguis::creator::impl::result( std::move( grid ), std::move( grid_bg ), std::move( openings ), std::move( spawners ), sanguis::creator::destructible_container() // TODO ); }
sanguis::client::perk::choosable_state sanguis::client::perk::choosable( sanguis::perk_type const _type, sanguis::client::perk::tree const &_tree, sanguis::client::player_level const _player_level, sanguis::client::perk::remaining_levels const _remaining_levels ) { sanguis::client::perk::tree const &node( sanguis::client::perk::find_info_const( _type, _tree ) ); sanguis::client::perk::info const &info( FCPPT_ASSERT_OPTIONAL_ERROR( node.value() ) ); sanguis::client::perk::tree const &parent_node( FCPPT_ASSERT_OPTIONAL_ERROR( node.parent() ).get() ); if( info.max_level().get() == info.level() ) return sanguis::client::perk::choosable_state::max_level; if( fcppt::optional::maybe( parent_node.value(), fcppt::const_( false ), [ &info ]( sanguis::client::perk::info const &_parent_info ) { return _parent_info.level() < info.required_parent_level().get(); } ) ) return sanguis::client::perk::choosable_state::parent_level; if( info.required_player_level().get() > _player_level ) return sanguis::client::perk::choosable_state::player_level; if( _remaining_levels.get().get() == 0u ) return sanguis::client::perk::choosable_state::level_up; return sanguis::client::perk::choosable_state::ok; }
sanguis::client::perk::tree_unique_ptr sanguis::client::perk::make_tree( sanguis::messages::server::types::perk_tree_node_vector const &_list ) { // This code is highly dependent on the order in which the server sends // the perks sanguis::client::perk::tree_unique_ptr ret( fcppt::make_unique_ptr< sanguis::client::perk::tree >( sanguis::client::perk::optional_info() ) ); for( auto const &item : _list ) ::tree_position( *ret, item.get< sanguis::messages::roles::perk_parent >() ).push_back( sanguis::client::perk::optional_info( sanguis::client::perk::info( item.get< sanguis::messages::roles::perk_label >(), sanguis::client::perk::level( sanguis::client::level( item.get< sanguis::messages::roles::perk_level >() ) ), sanguis::client::perk::required_parent_level( sanguis::client::perk::level( sanguis::client::level( item.get< sanguis::messages::roles::required_perk_parent_level >() ) ) ), sanguis::client::perk::required_player_level( sanguis::client::player_level( sanguis::client::level( item.get< sanguis::messages::roles::required_perk_player_level >() ) ) ), sanguis::client::perk::max_level( sanguis::client::perk::level( sanguis::client::level( item.get< sanguis::messages::roles::max_perk_level >() ) ) ) ) ) ); ret->sort( []( sanguis::client::perk::optional_info const &_left, sanguis::client::perk::optional_info const &_right ) { return sanguis::client::perk::to_category( FCPPT_ASSERT_OPTIONAL_ERROR( _left ).perk_type() ) < sanguis::client::perk::to_category( FCPPT_ASSERT_OPTIONAL_ERROR( _right ).perk_type() ); } ); return ret; }