void sge::d3d9::vertex::buffer::unlock() const { // TODO: Move this if( lock_dest_ == nullptr ) throw sge::renderer::exception( FCPPT_TEXT("d3d9::vertex::buffer::unlock() you have to lock first!") ); converter_.unlock(); if( this->get().Unlock() != D3D_OK ) throw sge::renderer::exception( FCPPT_TEXT("Cannot unlock d3d vertex buffer!") ); lock_dest_ = nullptr; }
sge::cg::profile::object const sge::d3d9::cg::profile::create( IDirect3DDevice9 &_device, sge::cg::profile::shader_type const _type ) { sge::d3d9::cg::scoped_device const context( _device ); switch( _type ) { case sge::cg::profile::shader_type::vertex: return sge::d3d9::cg::profile::vertex( context ); case sge::cg::profile::shader_type::pixel: return sge::d3d9::cg::profile::pixel( context ); case sge::cg::profile::shader_type::geometry: throw sge::renderer::unsupported( FCPPT_TEXT("D3D9 Cg geometry shader"), FCPPT_TEXT("D3D10"), FCPPT_TEXT("") ); } FCPPT_ASSERT_UNREACHABLE; }
sanguis::client::states::waiting_for_player::waiting_for_player( my_context _ctx ) : my_base( _ctx ), log_{ this->context< sanguis::client::machine >().log_context(), sanguis::client::states::log_location(), sanguis::log_parameters( fcppt::log::name{ FCPPT_TEXT("waiting_for_player") } ) } { FCPPT_LOG_DEBUG( log_, fcppt::log::_ << FCPPT_TEXT("Entering waiting_for_player") ); }
boost::filesystem::path sanguis::load::model::make_path( sanguis::load::model::path const &_path ) { boost::filesystem::path const path( sanguis::media_path() / FCPPT_TEXT("models") / _path.get() ); if( !boost::filesystem::exists( path ) ) throw sanguis::exception{ FCPPT_TEXT("Model ") + fcppt::filesystem::path_to_string( _path.get() ) + FCPPT_TEXT(" not found!") }; return path; }
void sge::d3d9::cg::texture::set( IDirect3DDevice9 &_device, sge::cg::parameter::object const &_parameter, IDirect3DBaseTexture9 *const _texture ) { sge::d3d9::cg::scoped_device const context( _device ); if( ::cgD3D9SetTexture( _parameter.get(), _texture ) != D3D_OK ) throw sge::renderer::exception( FCPPT_TEXT("cgD3D9SetTexture failed") ); SGE_CG_CHECK_STATE( FCPPT_TEXT("cgD3D9SetTexture failed"), sge::renderer::exception ) }
sanguis::aura_type sanguis::client::load::auras::lookup_name( fcppt::string const &_name ) { return fcppt::optional::to_exception( fcppt::enum_::index_of_array( aura_types, _name ), [ &_name ]{ return sanguis::exception{ FCPPT_TEXT("auras::lookup_name ") + _name + FCPPT_TEXT(" failed!") }; } ); }
void gitbot::irc::client::process_line( std::string const &_s) { if( !is_prefix( "PING :", _s)) { FCPPT_LOG_DEBUG( mylogger, fcppt::log::_ << FCPPT_TEXT("Got a line, but it's not a ping, so doing nothing.")); return; } FCPPT_LOG_DEBUG( mylogger, fcppt::log::_ << FCPPT_TEXT("Got a ping, sending back pong with: ") << _s.substr(6)); write( "PONG :"+ _s.substr( 6)); }
void sanguis::client::server::mainloop() { try { impl_.run(); } catch( fcppt::exception const &_exception ) { FCPPT_LOG_ERROR( log_, fcppt::log::_ << FCPPT_TEXT("Error in server thread: ") << _exception.string() ); } catch( std::exception const &_exception ) { FCPPT_LOG_ERROR( log_, fcppt::log::_ << FCPPT_TEXT("Error in server thread: ") << _exception.what() ); } this->reset_running(); }
inline fcppt::cast::bad_dynamic::bad_dynamic( std::type_index const &_source, std::type_index const &_destination ) : fcppt::exception( FCPPT_TEXT("Invalid dynamic_cast from type \"") + fcppt::type_name_from_index( _source ) + FCPPT_TEXT("\" to type \"") + fcppt::type_name_from_index( _destination ) + FCPPT_TEXT('"') ), source_( _source ), destination_( _destination ) { }
fruitapp::fruit::material::object const fruitapp::fruit::material::from_json( sge::parse::json::object const &o) { return material::object( material::diffuse_color( sge::parse::json::find_and_convert_member<material::diffuse_color::value_type>( o, sge::parse::json::path( FCPPT_TEXT("diffuse-color")))), material::diffuse_coefficient( sge::parse::json::find_and_convert_member<material::diffuse_coefficient::value_type>( o, sge::parse::json::path( FCPPT_TEXT("diffuse-coefficient")))), material::specular_color( sge::parse::json::find_and_convert_member<material::diffuse_color::value_type>( o, sge::parse::json::path( FCPPT_TEXT("specular-color")))), material::specular_coefficient( sge::parse::json::find_and_convert_member<material::specular_coefficient::value_type>( o, sge::parse::json::path( FCPPT_TEXT("specular-coefficient")))), material::specular_shininess( sge::parse::json::find_and_convert_member<material::specular_shininess::value_type>( o, sge::parse::json::path( FCPPT_TEXT("specular-shininess"))))); }
void sge::d3d9::index_buffer::unlock() const { if( lock_dest_ == nullptr ) throw sge::renderer::exception( FCPPT_TEXT("d3d::index_buffer::unlock() you have to lock first!") ); // TODO: Move this to another function if( this->get().Unlock() != D3D_OK ) throw sge::renderer::exception( FCPPT_TEXT("Cannot unlock index buffer!") ); lock_dest_ = nullptr; }
int main() { fcppt::io::cout() << FCPPT_TEXT("Current version is ") << fcppt::version_string() << FCPPT_TEXT('\n'); }
fcppt::string sanguis::server::entities::enemies::pretty_name( sanguis::creator::enemy_type const _type ){ switch( _type ) { case sanguis::creator::enemy_type::wolf_black: return FCPPT_TEXT("Black Wolf"); case sanguis::creator::enemy_type::wolf_brown: return FCPPT_TEXT("Brown Wolf"); case sanguis::creator::enemy_type::wolf_white: return FCPPT_TEXT("White Wolf"); case sanguis::creator::enemy_type::zombie00: return FCPPT_TEXT("Shambler"); case sanguis::creator::enemy_type::zombie01: return FCPPT_TEXT("Runner"); case sanguis::creator::enemy_type::spider: return FCPPT_TEXT("Wasp Spider"); case sanguis::creator::enemy_type::skeleton: return FCPPT_TEXT("Skeleton"); case sanguis::creator::enemy_type::ghost: return FCPPT_TEXT("Ghost"); case sanguis::creator::enemy_type::maggot: return FCPPT_TEXT("Maggot"); case sanguis::creator::enemy_type::reaper: return FCPPT_TEXT("Grim Reaper"); } FCPPT_ASSERT_UNREACHABLE; }
void sanguis::client::config::settings::object::save() const { FCPPT_LOG_DEBUG( log_, fcppt::log::_ << FCPPT_TEXT("Trying to save settings to ") << fcppt::filesystem::path_to_string( path_ ) ); if( !sge::parse::ini::output::to_file( path_, start_ ) ) { FCPPT_LOG_ERROR( log_, fcppt::log::_ << FCPPT_TEXT("Writing the settings failed!") ); } }
awl::main::exit_code const sgeroids::main( awl::main::function_context const &_main_function_context) try { sgeroids::state_machine::object machine( _main_function_context.argc(), _main_function_context.argv()); fcppt::scoped_state_machine<sgeroids::state_machine::object> const scoped_machine( machine); return machine.run(); } catch( fcppt::exception const &e) { fcppt::io::cerr() << FCPPT_TEXT("fcppt::exception: ") << e.string() << FCPPT_TEXT("\n"); return awl::main::exit_failure(); } catch( std::exception const &e) { std::cerr << "std::exception: " << e.what() << "\n"; return awl::main::exit_failure(); }
inline fcppt::cast::bad_truncation_check::bad_truncation_check( fcppt::string const &_source_value, std::type_index const &_source, std::type_index const &_destination ) : fcppt::exception( FCPPT_TEXT("Invalid truncation_check_cast from ") + _source_value + FCPPT_TEXT(" of type \"") + fcppt::type_name_from_index( _source ) + FCPPT_TEXT("\" to type \"") + fcppt::type_name_from_index( _destination ) + FCPPT_TEXT('"') ), source_( _source ), destination_( _destination ) { }
sge::d3d9::cg::program::loaded_object::loaded_object( IDirect3DDevice9 &_device, sge::cg::program::object &_program ) : device_( _device ), program_( _program ) { sge::d3d9::cg::scoped_device const context( device_ ); if( ::cgD3D9LoadProgram( program_.get(), CG_FALSE, 0u ) != D3D_OK ) throw sge::renderer::exception( FCPPT_TEXT("cgD3D9LoadProgram failed") ); SGE_CG_CHECK_STATE( FCPPT_TEXT("cgD3D9LoadProgram failed"), sge::renderer::exception ) }
sanguis::optional_primary_weapon_type sanguis::client::load::model::lookup_weapon_name( sanguis::model::weapon_category_name const &_name ) { return _name.get() == FCPPT_TEXT("none") ? sanguis::optional_primary_weapon_type() : sanguis::optional_primary_weapon_type( fcppt::optional::to_exception( fcppt::algorithm::index_of_enum_array( weapon_types, _name ), [ &_name ]{ return sanguis::exception{ FCPPT_TEXT("lookup_weapon_name ") + _name.get() + FCPPT_TEXT(" failed!") }; } ) ) ; }
sge::dinput::joypad::ff::scoped_download::scoped_download( IDirectInputEffect &_effect ) : effect_{ _effect } { switch( effect_.Download() ) { case DI_OK: return; case static_cast< HRESULT >( DIERR_DEVICEFULL ): throw sge::input::exception{ FCPPT_TEXT("FF device is full!") }; default: throw sge::input::exception{ FCPPT_TEXT("Failed downloading an effect!") }; } }
boost::statechart::result insula::states::finished::react( events::render const &r) { context<game_outer>().react( r); context<game_inner>().react( r); fcppt::string const s = context<game_outer>().players_left() ? FCPPT_TEXT("Press enter for next player") : FCPPT_TEXT("Press enter for the score board"); sge::font::draw_text( context<game_outer>().large_font(), context<game_outer>().font_drawer(), FCPPT_TEXT("Great job!\n")+s, sge::font::pos::null(), fcppt::math::dim::structure_cast<sge::font::dim>( context<machine>().systems().renderer()->screen_size()), sge::font::align_h::center, sge::font::align_v::center, sge::font::flags::none); return discard_event(); }
void fruitapp::screen_shooter::callback( fruitapp::quick_log &_log) { fcppt::string const time_string = (fcppt::from_std_string( boost::posix_time::to_iso_string( boost::posix_time::second_clock::universal_time()))); boost::filesystem::path const target_dir = sge::config::cache_path( sge::config::app_name( fruitapp::name())) / FCPPT_TEXT("screenshots"); if(!boost::filesystem::exists(target_dir)) fcppt::filesystem::create_directory_exn( target_dir); boost::filesystem::path const dest_path = target_dir/(time_string+FCPPT_TEXT(".png")); sge::renderer::screenshot( renderer_, image_loader_, dest_path); _log.add_message( FCPPT_TEXT("Screenshot taken")); }
typename boost::mpl::if_< std::is_const< Arg >, sge::parse::json::value const &, sge::parse::json::value & >::type find_member_value_exn( Arg &_members, fcppt::string const &_name ) { return fcppt::optional::to_exception( sge::parse::json::find_member_value( _members, _name ), [ &_name ]{ return sge::parse::json::member_not_found( FCPPT_TEXT("Cannot find member \"") + _name + FCPPT_TEXT("\" in a json object's member list!") ); } ).get(); }
[[noreturn]] inline typename std::enable_if< !Stream::can_fail, alda::raw::stream::result< Stream, Type > >::type fail( fcppt::string const &_error ) { throw alda::raw::stream::failure{ FCPPT_TEXT("Type ") + fcppt::type_name_from_info( typeid( Type ) ) + FCPPT_TEXT(": ") + _error }; }
void gitbot::irc::client::commit_write_buffer() { if (!active_write_buffer_.empty() || passive_write_buffer_.empty()) return; FCPPT_LOG_DEBUG( mylogger, fcppt::log::_ << FCPPT_TEXT("-> ") << passive_write_buffer_ << FCPPT_TEXT(" (") << passive_write_buffer_.size() << FCPPT_TEXT(" bytes)")); active_write_buffer_.swap( passive_write_buffer_); boost::asio::async_write( socket_, boost::asio::buffer( active_write_buffer_), boost::bind( &client::handle_write, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); }
fcppt::string sanguis::tiles::impl::orientation_to_string( sanguis::tiles::orientation const _orientation ) { return fcppt::algorithm::map< fcppt::string >( fcppt::enum_::make_range< sanguis::tiles::direction >(), [ _orientation ]( sanguis::tiles::direction const _dir ) { return _orientation[ _dir ] ? FCPPT_TEXT('1') : FCPPT_TEXT('0') ; } ); }
awl::main::exit_code const fruitapp::main( awl::main::function_context const &_main_function_context) try { fruitlib::signal_stack_printer::object stack_printer; fruitapp::machine machine( _main_function_context.argc(), _main_function_context.argv()); fcppt::scoped_state_machine<fruitapp::machine> scoped_state_machine( machine); return machine.run(); } catch (fcppt::exception const &e) { fruitlib::message_box( FCPPT_TEXT("fcppt::exception: ")+ e.string()); return awl::main::exit_failure(); } catch (std::exception const &e) { fruitlib::message_box( FCPPT_TEXT("std::exception: ")+ fcppt::from_std_string( e.what())); return awl::main::exit_failure(); }
insula::physics::debug_drawer::debug_drawer( world &_world, sge::renderer::device_ptr const _renderer, graphics::camera::object &_camera) : world_( _world), renderer_( _renderer), camera_( _camera), shader_( renderer_, media_path()/FCPPT_TEXT("debug_vertex.glsl"), media_path()/FCPPT_TEXT("debug_fragment.glsl"), graphics::shader::vf_to_string<vertex_format>(), { graphics::shader::variable( "mvp", graphics::shader::variable_type::uniform, graphics::mat4()) }, graphics::shader::sampler_sequence()), debug_mode_( btIDebugDraw::DBG_NoDebug) // should be zero { world_.handle().setDebugDrawer( this); }
void gitbot::irc::client::handle_connect( boost::system::error_code const &_e, boost::asio::ip::tcp::resolver::iterator const _it) { if (_e) { FCPPT_ASSERT_MESSAGE( _it == boost::asio::ip::tcp::resolver::iterator(), FCPPT_TEXT("Tried every endpoint and couldn't connect to any of them")); FCPPT_LOG_DEBUG( mylogger, fcppt::log::_ << FCPPT_TEXT("Tried endpoint, now starting another one...")); socket_.close(); socket_.async_connect( *_it, boost::bind( &client::handle_connect, this, boost::asio::placeholders::error, boost::next( _it))); return; } FCPPT_LOG_DEBUG( mylogger, fcppt::log::_ << FCPPT_TEXT("In handle_connect, which was successful...")); passive_write_buffer_ += "NICK "+nick_+"\r\n"; passive_write_buffer_ += "USER "+nick_+" 0 * :"+user_+"\r\n"; BOOST_FOREACH(channel const &c,channels_) passive_write_buffer_ += "JOIN "+c+"\r\n"; commit_write_buffer(); timer_->expires_from_now( boost::posix_time::seconds( timeout_)); last_reception_ = clock::now(); timer_->async_wait( boost::bind( &client::handle_timeout, this, boost::asio::placeholders::error)); boost::asio::async_read_until( socket_, response_, "\r\n", boost::bind( &client::handle_read_line, this, boost::asio::placeholders::error)); }
void sge::parse::json::config::modify_user_value( sge::parse::json::object const &structure_json, sge::parse::json::object &user_json, json::path const &input_path, sge::parse::json::value const &new_value) { FCPPT_ASSERT_PRE( !input_path.empty()); sge::parse::json::value const &old_value = sge::parse::json::find_and_convert_member<sge::parse::json::value>( structure_json, input_path); if(old_value.type_index() != new_value.type_index()) throw sge::parse::exception( FCPPT_TEXT("Error trying to update the user configuration node \"")+ json::path_to_string( input_path)+ FCPPT_TEXT("\", the types of the old and new value didn't match. The old type was \"")+ fcppt::type_name_from_info( fcppt::variant::type_info( old_value))+ FCPPT_TEXT("\", the new type was \"")+ fcppt::type_name_from_info( fcppt::variant::type_info( new_value))); sge::parse::json::object &target = // 0 is not permitted, 1 would mean: just take a value from // user_json, > 1 means: recursively make a path in the user_json (std::distance( input_path.begin(), input_path.end()) > 1) ? json::make_recursive_objects( user_json, json::path( input_path.begin(), std::prev(input_path.end()))) : user_json; sge::parse::json::member_map::iterator const it = target.members.find( input_path.back()); if(it == target.members.end()) target.members.insert( json::member( input_path.back(), new_value)); else it->second = new_value; }
void insula::physics::debug_drawer::reportErrorWarning( char const* warningString) { fcppt::io::cerr << FCPPT_TEXT("Debug drawer warning: ") << fcppt::from_std_string(warningString) << FCPPT_TEXT("\n"); }