QString PhysicalLocation::toString() const { QStringList locs; QString loc, str; if (!locality().isEmpty()) locs += locality(); if (!region().isEmpty()) locs += region(); if (!country().isEmpty()) locs += country(); if (!locs.isEmpty()) { loc = locs.join(", "); } if (!text().isEmpty()) { str += text(); if (!loc.isEmpty()) str += " ("; } str += loc; if (!text().isEmpty() && !loc.isEmpty()) str += ")"; return str; }
virtual boost::any data(const Wt::WModelIndex& index, int role = Wt::DisplayRole) const { std::string id = ids_[index.row()]; switch (role) { case Wt::DisplayRole: { if (showOffset_) { boost::local_time::time_zone_ptr tz = tz_db_.time_zone_from_region(id); Wt::WTime t = Wt::WTime(0, 0, 0) .addSecs(tz->base_utc_offset().total_seconds()); std::string result = locality(id) + " (GMT" + t.toString("+hh:mm").toUTF8() + ")"; return result; } else return locality(id); } case Wt::LevelRole: return id.substr(0, id.find('/')); case BoostTimeZoneRole: return tz_db_.time_zone_from_region(id); case PosixTimeZoneRole: return tz_db_.time_zone_from_region(id)->to_posix_string(); default: return boost::any(); } }
parcelset::locality agas_locality( util::runtime_configuration const & ini) const { return parcelset::locality( locality( util::mpi_environment::enabled() ? 0 : -1 ) ); }
inline void allocate(In const& in , std::size_t blocksize_ , std::size_t nstreams, std::size_t s) { if (!allocated) { blocksize = blocksize_ ; std::size_t num = s / blocksize_ ; block_stream_dth.resize(num); block_stream_htd.resize(num); auto loc_ = locality(in); buffers.allocate(blocksize, nstreams , loc_); allocated = true; } }
void ts::scene::Skid_sound_controller::update() { for (auto& data : skid_data_) { auto car = data.car; const auto& car_def = car->car_definition(); const auto& terrain = car->current_terrain(); auto speed = car->speed(); auto slide_threshold = car_def.handling->slide_threshold; auto traction = car->current_traction(); bool skid_state = (speed != 0.0 && traction < slide_threshold && terrain.skid_mark); bool prev_state = static_cast<bool>(data.sound_effect); if (skid_state != prev_state) { if (skid_state) { int priority = car->locality() == world::Locality::Local ? 3 : 1; audio::Sound_properties properties; properties.position = car->position(); properties.min_distance = 100.0; properties.attenuation = 1.0; properties.volume = static_cast<float>(calculate_skid_volume(car->speed(), traction)); properties.relative_to_listener = false; data.sound_effect = sound_effect_controller_->play_looped_sound(skid_sound_, priority, properties); } else { sound_effect_controller_->stop_sound(data.sound_effect); data.sound_effect = {}; } } else { sound_effect_controller_->set_sound_position(data.sound_effect, car->position()); sound_effect_controller_->set_sound_volume(data.sound_effect, calculate_skid_volume(car->speed(), traction)); } } }
parcelset::locality create_locality() const { return parcelset::locality(locality()); }
bool PhysicalLocation::operator==(const PhysicalLocation& o) const { return country() == o.country() && region() == o.region() && locality() == o.locality() && area() == o.area() && street() == o.street() && building() == o.building() && floor() == o.floor() && room() == o.room() && postalcode() == o.postalcode() && text() == o.text(); }
parcelset::locality connection_handler::create_locality() const { return parcelset::locality(locality()); }
inline void transfer_dth( Out & out , int blockid, Stream & stream ,std::size_t streamid , std::size_t leftover = 0) { auto loc_ = locality(out); transfer_dth(out,blockid,stream,streamid,leftover,loc_); }
inline void transfer_htd( In & in, int blockid, Stream & stream ,std::size_t streamid , std::size_t leftover = 0 ) { auto loc_ = locality(in); transfer_htd(in,blockid,stream,streamid,leftover, loc_); }