void Quota::loadFromConfig(const String & config_elem, const String & name_, Poco::Util::AbstractConfiguration & config, pcg64 & rng) { name = name_; bool new_keyed_by_ip = config.has(config_elem + ".keyed_by_ip"); bool new_is_keyed = new_keyed_by_ip || config.has(config_elem + ".keyed"); if (new_is_keyed != is_keyed || new_keyed_by_ip != keyed_by_ip) { keyed_by_ip = new_keyed_by_ip; is_keyed = new_is_keyed; /// Meaning of keys has been changed. Throw away accumulated values. quota_for_keys.clear(); } ignore_key_if_not_keyed = config.has(config_elem + ".ignore_key_if_not_keyed"); QuotaForIntervals new_max(name, {}); new_max.initFromConfig(config_elem, config, rng); if (!new_max.hasEqualConfiguration(max)) { max = new_max; for (auto & quota : quota_for_keys) quota.second->setMax(max); } }
t_work *new_work(char *str) { char *ptr; t_work *ans; ptr = str; if (!(ans = (t_work *)malloc(sizeof(t_work)))) malloc_fail(); while (*ptr != '\0') ptr++; ans->map = new_dim(0, 0); ans->taken = *(--ptr); ans->obstacle = *(--ptr); ans->room = *(--ptr); *(ptr) = 'X'; ans->map->height = ft_atoi(str); if (ans->map->height == 0 || ans->taken == ans->room || ans->taken == ans->obstacle || ans->room == ans->obstacle) return (0); ans->max = new_max(); ans->cur_line = 0; ans->to_be_skipped = 0; return (ans); }
cgray::rt::AABB cgray::rt::AABB::operator+(const Vector3f & point) const { Vector3f new_min(std::min(min_[0], point[0]), std::min(min_[1], point[1]), std::min(min_[2], point[2])); Vector3f new_max(std::max(max_[0], point[0]), std::max(max_[1], point[1]), std::max(max_[2], point[2])); return AABB(new_min, new_max); }
cgray::rt::AABB cgray::rt::AABB::operator+(const AABB & ref) const { Vector3f new_min(std::min(min_[0], ref.min_[0]), std::min(min_[1], ref.min_[1]), std::min(min_[2], ref.min_[2])); Vector3f new_max(std::max(max_[0], ref.max_[0]), std::max(max_[1], ref.max_[1]), std::max(max_[2], ref.max_[2])); return AABB(new_min, new_max); }