/*! * Two house numbers are considered to be equal if * * country, city, postcode, suburb, street, housenumber, name, and shop equal * * or housenumber, street, name, and shop equal, and country, city, and postcode do not differ (ignoring empty values), * and lat/lon difference is less than DISTANCE_THRESHOLD */ bool HouseNumber::isSameAddress(HouseNumber const& rhs) const { if(getName().toLower()!=rhs.getName().toLower() || getShop().toLower()!=rhs.getShop().toLower() || getNumber().toLower()!=rhs.getNumber().toLower() || getStreet().toLower()!=rhs.getStreet().toLower() || getNumber()=="" || getStreet()=="") { return false; } if(getPostcode().toLower()==rhs.getPostcode().toLower() && getPostcode()!="" && getCity().toLower()==rhs.getCity().toLower() && getCity()!="" && getSuburb().toLower()==rhs.getSuburb().toLower() && getCountry().toLower()==rhs.getCountry().toLower() && getCountry()!="") { return true; } // consider two house numbers with similar address information and little distance to each other to be equal if(myAbs(getLat()-rhs.getLat())>DISTANCE_THRESHOLD || myAbs(getLon()-rhs.getLon())>DISTANCE_THRESHOLD) return false; if(getPostcode()!="" && rhs.getPostcode()!="" && getPostcode().toLower()!=rhs.getPostcode().toLower()) return false; if(getCity()!="" && rhs.getCity()!="" && getCity().toLower()!=rhs.getCity().toLower()) return false; if(getSuburb()!="" && rhs.getSuburb()!="" && getSuburb()!=rhs.getSuburb()) return false; if(getCountry()!="" && rhs.getCountry()!="" && getCountry().toLower()!=rhs.getCountry().toLower()) return false; return true; }
void PublicHubsFrame::updateList() { //CLockRedraw<> l_lock_draw(m_ctrlHubs); m_ctrlHubs.DeleteAllItems(); users = 0; visibleHubs = 0; double size = -1; FilterModes mode = NONE; int sel = ctrlFilterSel.GetCurSel(); bool doSizeCompare = parseFilter(mode, size); auto cnt = m_ctrlHubs.GetItemCount(); for (auto i = m_hubs.cbegin(); i != m_hubs.cend(); ++i) { if (matchFilter(*i, sel, doSizeCompare, mode, size)) { TStringList l; l.resize(COLUMN_LAST); l[COLUMN_NAME] = Text::toT(i->getName()); string l_description = i->getDescription(); boost::replace_all(l_description, ".px.", ""); l[COLUMN_DESCRIPTION] = Text::toT(l_description); l[COLUMN_USERS] = Util::toStringW(i->getUsers()); l[COLUMN_SERVER] = Text::toT(i->getServer()); l[COLUMN_COUNTRY] = Text::toT(i->getCountry()); // !SMT!-IP l[COLUMN_SHARED] = Util::formatBytesW(i->getShared()); l[COLUMN_MINSHARE] = Util::formatBytesW(i->getMinShare()); l[COLUMN_MINSLOTS] = Util::toStringW(i->getMinSlots()); l[COLUMN_MAXHUBS] = Util::toStringW(i->getMaxHubs()); l[COLUMN_MAXUSERS] = Util::toStringW(i->getMaxUsers()); l[COLUMN_RELIABILITY] = Util::toStringW(i->getReliability()); l[COLUMN_RATING] = Text::toT(i->getRating()); const auto l_country = i->getCountry(); dcassert(!l_country.empty()); const auto l_index_country = WinUtil::getFlagIndexByName(l_country.c_str()); //const auto l_index = m_ctrlHubs.insert(cnt++, l, l_index_country); // !SMT!-IP /* LVITEM lvItem = { 0 }; lvItem.mask = LVIF_IMAGE; lvItem.iItem = l_index; lvItem.iImage = isOnline(i->getServer()) ? 0 : 1; m_ctrlHubs.SetItem(&lvItem); */ visibleHubs++; users += i->getUsers(); } } m_ctrlHubs.resort(); updateStatus(); }
/*! * compares QString("%1%2%3%4%5%6%7") * .arg(number_).arg(street_).arg(postcode_).arg(city_).arg(suburb_).arg(country_).arg(name_).arg(shop_).toLower() * thus, the house numbers are sorted by address (used for treeHousenumbers) * @note the address information must be complete */ bool HouseNumber::isLessThanAddress(HouseNumber const& rhs) const { if(getNumber().toLower()!=rhs.getNumber().toLower()) return getNumber().toLower()<rhs.getNumber().toLower(); if(getStreet().toLower()!=rhs.getStreet().toLower()) return getStreet().toLower()<rhs.getStreet().toLower(); if(getPostcode().toLower()!=rhs.getPostcode().toLower()) return getPostcode().toLower()<rhs.getPostcode().toLower(); if(getCity().toLower()!=rhs.getCity().toLower()) return getCity().toLower()<rhs.getCity().toLower(); if(getSuburb().toLower()!=rhs.getSuburb().toLower()) return getSuburb().toLower()<rhs.getSuburb().toLower(); if(getCountry().toLower()!=rhs.getCountry().toLower()) return getCountry().toLower()<rhs.getCountry().toLower(); if(getName().toLower()!=rhs.getName().toLower()) return getName().toLower()<rhs.getName().toLower(); return getShop().toLower()<rhs.getShop().toLower(); }
void Airspace::debug() { qDebug() << "AsName=" << getName() << "ASId=" << getId() << "AsType=" << getTypeName(getTypeID()) << "Country=" << getCountry() << "ULimit=" << m_uLimit.getMeters() << "LLimit=" << m_lLimit.getMeters(); }
/** * Generates a brand new saved game with starting data. * @return A new saved game. */ SavedGame *Ruleset::newSave() const { SavedGame *save = new SavedGame(); // Add countries for (std::vector<std::string>::const_iterator i = _countriesIndex.begin(); i != _countriesIndex.end(); ++i) { save->getCountries()->push_back(new Country(getCountry(*i))); } // Adjust funding to total $6M int missing = ((6000 - save->getCountryFunding()/1000) / (int)save->getCountries()->size()) * 1000; for (std::vector<Country*>::iterator i = save->getCountries()->begin(); i != save->getCountries()->end(); ++i) { (*i)->setFunding((*i)->getFunding().back() + missing); } save->setFunds(save->getCountryFunding()); // Add regions for (std::vector<std::string>::const_iterator i = _regionsIndex.begin(); i != _regionsIndex.end(); ++i) { save->getRegions()->push_back(new Region(getRegion(*i))); } // Set up IDs std::map<std::string, int> ids; for (std::vector<std::string>::const_iterator i = _craftsIndex.begin(); i != _craftsIndex.end(); ++i) { ids[*i] = 1; } save->initIds(ids); // Set up starting base Base *base = new Base(this); base->load(_startingBase, save, true); // Correct IDs for (std::vector<Craft*>::const_iterator i = base->getCrafts()->begin(); i != base->getCrafts()->end(); ++i) { save->getId((*i)->getRules()->getType()); } // Generate soldiers int soldiers = _startingBase["randomSoldiers"].as<int>(0); for (int i = 0; i < soldiers; ++i) { Soldier *soldier = new Soldier(getSoldier("XCOM"), getArmor("STR_NONE_UC"), &_names, save->getId("STR_SOLDIER")); soldier->setCraft(base->getCrafts()->front()); base->getSoldiers()->push_back(soldier); } save->getBases()->push_back(base); // Setup alien strategy save->getAlienStrategy().init(this); save->setTime(_startingTime); return save; }
eLanguageEntry(eListBox<eLanguageEntry>* lb, eString id, eString name) : eListBoxEntry( (eListBox<eListBoxEntry>*)lb), id(id), name(name) { eString language=id; if (id.find('_') != eString::npos) id=id.left(id.find('_')); eString str("country_"); str+=getCountry(id.c_str()); pixmap=eSkin::getActive()->queryImage(str); if (!pixmap) { eDebug("dont find %s use country_missing", str.c_str() ); pixmap=eSkin::getActive()->queryImage(eString("country_missing")); } if (!font.pointSize) font = eSkin::getActive()->queryFont("eListBox.EntryText.normal"); para=0; }
Airspace* Airspace::createAirspaceObject() { // We need that method because the default constructor cannot setup a // complete airspace. The default constructor is only used as a collection // container during parsing of airspace source file. Airspace* as = new Airspace( getName(), getTypeID(), getProjectedPolygon(), m_uLimit.getFeet(), m_uLimitType, m_lLimit.getFeet(), m_lLimitType, m_id, getCountry() ); as->setFlarmAlertZone( m_flarmAlertZone ); return as; }
QString getLocale() { DWORD bufsize = 256; wchar_t buffer[256]; GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, buffer, bufsize); QString lang = QString("").fromWCharArray(buffer).toLatin1(); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buffer, bufsize); QString country = getCountry(); auto locale = lang + "_" + country; return XUtils::StandLoacle(locale); }
QString getTimezone() { return XUtils::StandTimezone(getCountry(), getGMT()); }