endless-sky / endless-sky

Space exploration, trading, and combat game.
https://endless-sky.github.io/
GNU General Public License v3.0
5.9k stars 1.04k forks source link

ES is not longer buildable on the most recent Linux Mint #10403

Closed SomeTroglodyte closed 3 months ago

SomeTroglodyte commented 3 months ago

Location

General

Describe the issue

Up until two weeks ago, ES was buildable on the most recent Linux Mint 22 "Wilma". Thanks to #10362 this is no longer the case. With Mint 22 being a month old, Mint users will be excluded for the next 23 months.

Expected content

Clarify that distributions emphasizing long term support are undesirables.

https://github.com/endless-sky/endless-sky/blob/master/docs/readme-cmake.md#linux states a minimum of Ubuntu 22.04, however, by now, 24.04 "noble" is NOT ENOUGH.

warp-core commented 3 months ago

Linux Mint 22 seems to come with GCC 13 which, as far as I know, can still build Endless Sky. What are you using to build the game?

eebop commented 3 months ago

Ubuntu 22.04 - compiles fine on my system

tibetiroka commented 3 months ago

Have you tried doing a clean build? cmake --build build --target clean should clear the build directory. CMake sometimes gets confused when compiler options change, and doesn't recompile everything by itself.

SomeTroglodyte commented 3 months ago

What are you using to build the game

Abusing Android Studio as pure git GUI, git pull from es-master into my local master clone, then cmake --build --preset linux-debug (or -release) from terminal

cmake --build build --target clean

"Error: could not load cache"

... cmake --build --preset linux-debug --clean-first is more like it, but throws all the "has no member named ‘contains’" errors just like without cleaning

Linux Mint 22 seems to come with GCC 13 which, as far as I know, can still build Endless Sky.

gcc --version gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0

That's the point, that compat went down the drain with the two "gcc20" PR's

For the record, to build current master this is the absolute minimum revert:

```patch Subject: [PATCH] Revert gcc20 changes --- Index: source/test/Test.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/test/Test.cpp b/source/test/Test.cpp --- a/source/test/Test.cpp +++ b/source/test/Test.cpp @@ -445,7 +445,7 @@ // If we encounter a branch entry twice, then resume the gameloop before the second encounter. // Encountering branch entries twice typically only happen in "wait loops" and we should give // the game cycles to proceed if we are in a wait loop for something that happens over time. - if(context.branchesSinceGameStep.contains(context.callstack.back())) + if(context.branchesSinceGameStep.count(context.callstack.back())) { continueGameLoop = true; break; Index: source/Government.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Government.cpp b/source/Government.cpp --- a/source/Government.cpp +++ b/source/Government.cpp @@ -132,7 +132,7 @@ bool removeAll = (remove && !hasValue); // If this is the first entry for the given key, and we are not in "add" // or "remove" mode, its previous value should be cleared. - bool overwriteAll = (!add && !remove && shouldOverwrite.contains(key)); + bool overwriteAll = (!add && !remove && shouldOverwrite.count(key)); if(removeAll || overwriteAll) { @@ -490,7 +490,7 @@ return PenaltyHelper(eventType, penaltyFor); const int id = other->id; - const auto &penalties = useForeignPenaltiesFor.contains(id) ? other->penaltyFor : penaltyFor; + const auto &penalties = useForeignPenaltiesFor.count(id) ? other->penaltyFor : penaltyFor; const auto it = customPenalties.find(id); if(it == customPenalties.end()) @@ -522,7 +522,7 @@ bool Government::Trusts(const Government *government) const { - return government == this || trusted.contains(government); + return government == this || trusted.count(government); } Index: source/GameAction.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/GameAction.cpp b/source/GameAction.cpp --- a/source/GameAction.cpp +++ b/source/GameAction.cpp @@ -422,7 +422,7 @@ // mission as failed. It will not be removed from the player's mission // list until it is safe to do so. for(const Mission &mission : player.Missions()) - if(fail.contains(mission.Identifier())) + if(fail.count(mission.Identifier())) player.FailMission(mission); } if(failCaller && caller) Index: source/UniverseObjects.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/UniverseObjects.cpp b/source/UniverseObjects.cpp --- a/source/UniverseObjects.cpp +++ b/source/UniverseObjects.cpp @@ -200,7 +200,7 @@ // Class objects with a deferred definition should still get named when content is loaded. auto NameIfDeferred = [](const set &deferred, auto &it) { - if(deferred.contains(it.first)) + if(deferred.count(it.first)) it.second.SetName(it.first); else return false; @@ -246,7 +246,7 @@ // Plugins may alter stock fleets with new variants that exclusively use plugin ships. // Rather than disable the whole fleet due to these non-instantiable variants, remove them. it.second.RemoveInvalidVariants(); - if(!it.second.IsValid() && !deferred["fleet"].contains(it.first)) + if(!it.second.IsValid() && !deferred["fleet"].count(it.first)) Warn("fleet", it.first); } // Government names are used in mission NPC blocks and LocationFilters. @@ -271,7 +271,7 @@ NameAndWarn("outfit", it); // Outfitters are never serialized. for(const auto &it : outfitSales) - if(it.second.empty() && !deferred["outfitter"].contains(it.first)) + if(it.second.empty() && !deferred["outfitter"].count(it.first)) Logger::LogError("Warning: outfitter \"" + it.first + "\" is referred to, but has no outfits."); // Phrases are never serialized. for(const auto &it : phrases) @@ -290,7 +290,7 @@ } // Shipyards are never serialized. for(const auto &it : shipSales) - if(it.second.empty() && !deferred["shipyard"].contains(it.first)) + if(it.second.empty() && !deferred["shipyard"].count(it.first)) Logger::LogError("Warning: shipyard \"" + it.first + "\" is referred to, but has no ships."); // System names are used by a number of classes. for(auto &&it : systems) @@ -475,7 +475,7 @@ { static const set canDisable = {"mission", "event", "person"}; const string &category = node.Token(1); - if(canDisable.contains(category)) + if(canDisable.count(category)) { if(node.HasChildren()) for(const DataNode &child : node) Index: source/Engine.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Engine.cpp b/source/Engine.cpp --- a/source/Engine.cpp +++ b/source/Engine.cpp @@ -100,10 +100,36 @@ return Radar::UNFRIENDLY; } - constexpr auto PrunePointers = [](auto &objects) { erase_if(objects, - [](const auto &obj) { return obj->ShouldBeRemoved(); }); }; - constexpr auto Prune = [](auto &objects) { erase_if(objects, - [](const auto &obj) { return obj.ShouldBeRemoved(); }); }; + template + void Prune(vector &objects) + { + // First, erase any of the old objects that should be removed. + typename vector::iterator in = objects.begin(); + while(in != objects.end() && !in->ShouldBeRemoved()) + ++in; + + typename vector::iterator out = in; + while(in != objects.end()) + { + if(!in->ShouldBeRemoved()) + *out++ = std::move(*in); + ++in; + } + if(out != objects.end()) + objects.erase(out, objects.end()); + } + + template + void Prune(list> &objects) + { + for(auto it = objects.begin(); it != objects.end(); ) + { + if((*it)->ShouldBeRemoved()) + it = objects.erase(it); + else + ++it; + } + } template void Append(vector &objects, vector &added) @@ -963,7 +989,7 @@ bool inRange = offset.LengthSquared() <= scanRangeMetric; // Autocatalog asteroid: Record that the player knows this type of asteroid is available here. - if(shouldCatalogAsteroids && !asteroidsScanned.contains(minable->DisplayName())) + if(shouldCatalogAsteroids && !asteroidsScanned.count(minable->DisplayName())) { scanComplete = false; if(!Random::Int(10) && inRange) @@ -1493,7 +1519,7 @@ player.SetSystem(*playerSystem); EnterSystem(); } - PrunePointers(ships); + Prune(ships); // Move the asteroids. This must be done before collision detection. Minables // may create visuals or flotsam. @@ -1503,7 +1529,7 @@ // checks if any ship has picked it up. for(const shared_ptr &it : flotsam) it->Move(newVisuals); - PrunePointers(flotsam); + Prune(flotsam); // Move the projectiles. for(Projectile &projectile : projectiles) @@ -2649,7 +2675,7 @@ // Check who currently has a grudge against this government. Also check if // someone has already said "thank you" today. - if(grudge.contains(attacker)) + if(grudge.count(attacker)) { shared_ptr previous = grudge[attacker].lock(); // If the previous ship is destroyed, or was able to send a Index: source/PlayerInfo.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/PlayerInfo.cpp b/source/PlayerInfo.cpp --- a/source/PlayerInfo.cpp +++ b/source/PlayerInfo.cpp @@ -581,7 +581,7 @@ { seen.insert(system); for(const System *neighbor : system->VisibleNeighbors()) - if(!neighbor->Hidden() || system->Links().contains(neighbor)) + if(!neighbor->Hidden() || system->Links().count(neighbor)) seen.insert(neighbor); } } @@ -988,7 +988,7 @@ bool PlayerInfo::HasLicense(const string &name) const { - return licenses.contains(name); + return licenses.count(name); } @@ -2480,16 +2480,16 @@ // Shrouded systems have special considerations as to whether they're currently seen or not. bool shrouded = system.Shrouded(); - if(!shrouded && seen.contains(&system)) + if(!shrouded && seen.count(&system)) return true; auto usesSystem = [&system](const Mission &m) noexcept -> bool { if(!m.IsVisible()) return false; - if(m.Waypoints().contains(&system)) + if(m.Waypoints().count(&system)) return true; - if(m.MarkedSystems().contains(&system)) + if(m.MarkedSystems().count(&system)) return true; for(auto &&p : m.Stopovers()) if(p->IsInSystem(&system)) @@ -2508,7 +2508,7 @@ [&](const System *s) noexcept -> bool { return CanView(*s); })) return true; // A shrouded system not linked to a viewable system must be visible from the current system. - if(!system.VisibleNeighbors().contains(this->system)) + if(!system.VisibleNeighbors().count(this->system)) return false; // If a shrouded system is in visible range, then it can be seen if it is not also hidden. return !system.Hidden(); @@ -2532,7 +2532,7 @@ // Check if the player has visited the given system. bool PlayerInfo::HasVisited(const System &system) const { - return visitedSystems.contains(&system); + return visitedSystems.count(&system); } @@ -2540,7 +2540,7 @@ // Check if the player has visited the given planet. bool PlayerInfo::HasVisited(const Planet &planet) const { - return visitedPlanets.contains(&planet); + return visitedPlanets.count(&planet); } @@ -2570,7 +2570,7 @@ visitedSystems.insert(&system); seen.insert(&system); for(const System *neighbor : system.VisibleNeighbors()) - if(!neighbor->Hidden() || system.Links().contains(neighbor)) + if(!neighbor->Hidden() || system.Links().count(neighbor)) seen.insert(neighbor); } @@ -3829,7 +3829,7 @@ if(!flagship || !flagship->GetPlanet()) return false; string attribute = name.substr(strlen("flagship planet attribute: ")); - return flagship->GetPlanet()->Attributes().contains(attribute); + return flagship->GetPlanet()->Attributes().count(attribute); }; flagshipPlanetAttributesProvider.SetGetFunction(flagshipPlanetAttributesFun); @@ -4257,10 +4257,10 @@ vector missionsToRemove; for(const auto &it : cargo.MissionCargo()) - if(!active.contains(it.first)) + if(!active.count(it.first)) missionsToRemove.push_back(it.first); for(const auto &it : cargo.PassengerList()) - if(!active.contains(it.first)) + if(!active.count(it.first)) missionsToRemove.push_back(it.first); for(const Mission *mission : missionsToRemove) cargo.RemoveMissionCargo(mission); @@ -4647,7 +4647,7 @@ // Planets should not fine you if you have mission clearance or are infiltrating. for(const Mission &mission : missions) if(mission.HasClearance(planet) || (!mission.HasFullClearance() && - (mission.Destination() == planet || mission.Stopovers().contains(planet)))) + (mission.Destination() == planet || mission.Stopovers().count(planet)))) return; // The planet's government must have the authority to enforce laws. Index: source/PlayerInfoPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/PlayerInfoPanel.cpp b/source/PlayerInfoPanel.cpp --- a/source/PlayerInfoPanel.cpp +++ b/source/PlayerInfoPanel.cpp @@ -361,7 +361,7 @@ } else if(shift) { - if(panelState.AllSelected().contains(selectedIndex)) + if(panelState.AllSelected().count(selectedIndex)) panelState.Deselect(panelState.SelectedIndex()); if(isValidIndex) panelState.SetSelectedIndex(selectedIndex); @@ -522,7 +522,7 @@ if(panelState.CanEdit() && (shift || control || clicks < 2)) { // If the control+click was on an already selected ship, deselect it. - if(control && panelState.AllSelected().contains(hoverIndex)) + if(control && panelState.AllSelected().count(hoverIndex)) panelState.Deselect(hoverIndex); else { @@ -536,7 +536,7 @@ panelState.SelectMany(start, end + 1); panelState.SetSelectedIndex(hoverIndex); } - else if(panelState.AllSelected().contains(hoverIndex)) + else if(panelState.AllSelected().count(hoverIndex)) { // If the click is on an already selected line, start dragging // but do not change the selection. @@ -741,7 +741,7 @@ // Check if this row is selected. if(panelState.SelectedIndex() == index) table.DrawHighlight(selectedBack); - else if(panelState.AllSelected().contains(index)) + else if(panelState.AllSelected().count(index)) table.DrawHighlight(back); // Find out if the mouse is hovering over the ship Index: source/OutfitterPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/OutfitterPanel.cpp b/source/OutfitterPanel.cpp --- a/source/OutfitterPanel.cpp +++ b/source/OutfitterPanel.cpp @@ -69,7 +69,7 @@ for(auto &&it : ship.Outfits()) { const Outfit *outfit = it.first; - if(outfit->Ammo() && !outfit->IsWeapon() && !armed.contains(outfit)) + if(outfit->Ammo() && !outfit->IsWeapon() && !armed.count(outfit)) toRefill.emplace(outfit->Ammo()); } return toRefill; @@ -255,7 +255,7 @@ if(selectedOutfit) { - outfitInfo.Update(*selectedOutfit, player, CanSell(), collapsed.contains(DESCRIPTION)); + outfitInfo.Update(*selectedOutfit, player, CanSell(), collapsed.count(DESCRIPTION)); selectedItem = selectedOutfit->DisplayName(); const Sprite *thumbnail = selectedOutfit->Thumbnail(); @@ -276,7 +276,7 @@ if(hasDescription) { - if(!collapsed.contains(DESCRIPTION)) + if(!collapsed.count(DESCRIPTION)) { descriptionOffset = outfitInfo.DescriptionHeight(); outfitInfo.DrawDescription(startPoint); Index: source/MapShipyardPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/MapShipyardPanel.cpp b/source/MapShipyardPanel.cpp --- a/source/MapShipyardPanel.cpp +++ b/source/MapShipyardPanel.cpp @@ -266,7 +266,7 @@ for(const auto &it : GameData::Planets()) if(it.second.IsValid() && player.CanView(*it.second.GetSystem())) for(const Ship *ship : it.second.Shipyard()) - if(!seen.contains(ship)) + if(!seen.count(ship)) { catalog[ship->Attributes().Category()].push_back(ship); seen.insert(ship); @@ -278,7 +278,7 @@ { const Ship *model = GameData::Ships().Get(it->TrueModelName()); ++parkedShips[it->GetSystem()][model]; - if(!seen.contains(model)) + if(!seen.count(model)) { catalog[model->Attributes().Category()].push_back(model); seen.insert(model); Index: source/GameData.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/GameData.cpp b/source/GameData.cpp --- a/source/GameData.cpp +++ b/source/GameData.cpp @@ -777,7 +777,7 @@ // Custom messages to be shown when trying to land on certain stellar objects. bool GameData::HasLandingMessage(const Sprite *sprite) { - return objects.landingMessages.contains(sprite); + return objects.landingMessages.count(sprite); } Index: source/MapSalesPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/MapSalesPanel.cpp b/source/MapSalesPanel.cpp --- a/source/MapSalesPanel.cpp +++ b/source/MapSalesPanel.cpp @@ -327,7 +327,7 @@ bool MapSalesPanel::DrawHeader(Point &corner, const string &category) { - bool hide = collapsed.contains(category); + bool hide = collapsed.count(category); if(!hidPrevious) corner.Y() += 50.; hidPrevious = hide; @@ -432,7 +432,7 @@ void MapSalesPanel::ClickCategory(const string &name) { - bool isHidden = collapsed.contains(name); + bool isHidden = collapsed.count(name); if(SDL_GetModState() & KMOD_SHIFT) { // If the shift key is held down, hide or show all categories. Index: source/MapOutfitterPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/MapOutfitterPanel.cpp b/source/MapOutfitterPanel.cpp --- a/source/MapOutfitterPanel.cpp +++ b/source/MapOutfitterPanel.cpp @@ -278,7 +278,7 @@ for(auto &&it : GameData::Planets()) if(it.second.IsValid() && player.CanView(*it.second.GetSystem())) for(const Outfit *outfit : it.second.Outfitter()) - if(!seen.contains(outfit)) + if(!seen.count(outfit)) { catalog[outfit->Category()].push_back(outfit); seen.insert(outfit); @@ -288,7 +288,7 @@ for(const auto &it : player.PlanetaryStorage()) if(it.first->HasOutfitter()) for(const auto &oit : it.second.Outfits()) - if(!seen.contains(oit.first)) + if(!seen.count(oit.first)) { catalog[oit.first->Category()].push_back(oit.first); seen.insert(oit.first); @@ -296,7 +296,7 @@ // Add all known minables. for(const auto &it : player.Harvested()) - if(!seen.contains(it.second)) + if(!seen.count(it.second)) { catalog[it.second->Category()].push_back(it.second); seen.insert(it.second); Index: source/Conversation.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Conversation.cpp b/source/Conversation.cpp --- a/source/Conversation.cpp +++ b/source/Conversation.cpp @@ -619,7 +619,7 @@ // Add a label, pointing to whatever node is created next. void Conversation::AddLabel(const string &label, const DataNode &node) { - if(labels.contains(label)) + if(labels.count(label)) { node.PrintTrace("Error: Conversation: label \"" + label + "\" is used more than once:"); return; Index: source/LocationFilter.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/LocationFilter.cpp b/source/LocationFilter.cpp --- a/source/LocationFilter.cpp +++ b/source/LocationFilter.cpp @@ -343,10 +343,10 @@ if(!shipCategory.empty()) return false; - if(!governments.empty() && !governments.contains(planet->GetGovernment())) + if(!governments.empty() && !governments.count(planet->GetGovernment())) return false; - if(!planets.empty() && !planets.contains(planet)) + if(!planets.empty() && !planets.count(planet)) return false; for(const set &attr : attributes) if(!SetsIntersect(attr, planet->Attributes())) @@ -382,12 +382,12 @@ bool LocationFilter::Matches(const Ship &ship) const { const System *origin = ship.GetSystem(); - if(!systems.empty() && !systems.contains(origin)) + if(!systems.empty() && !systems.count(origin)) return false; - if(!governments.empty() && !governments.contains(ship.GetGovernment())) + if(!governments.empty() && !governments.count(ship.GetGovernment())) return false; - if(!shipCategory.empty() && !shipCategory.contains(ship.Attributes().Category())) + if(!shipCategory.empty() && !shipCategory.count(ship.Attributes().Category())) return false; if(!attributes.empty()) @@ -497,7 +497,7 @@ if(planet.IsWormhole() || (requireSpaceport && !planet.GetPort().HasService(Port::ServicesType::OffersMissions)) || (!hasClearance && !planet.CanLand())) - if(planets.empty() || !planets.contains(&planet)) + if(planets.empty() || !planets.count(&planet)) continue; if(Matches(&planet, origin)) options.push_back(&planet); @@ -609,14 +609,14 @@ { if(!system || !system->IsValid()) return false; - if(!systems.empty() && !systems.contains(system)) + if(!systems.empty() && !systems.count(system)) return false; // Don't check these filters again if they were already checked as a part of // checking if a planet matches. if(!didPlanet) { - if(!governments.empty() && !governments.contains(system->GetGovernment())) + if(!governments.empty() && !governments.count(system->GetGovernment())) return false; // This filter is being applied to a system, not a planet. Index: source/MapDetailPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/MapDetailPanel.cpp b/source/MapDetailPanel.cpp --- a/source/MapDetailPanel.cpp +++ b/source/MapDetailPanel.cpp @@ -499,7 +499,7 @@ // The same "planet" may appear multiple times in one system, // providing multiple landing and departure points (e.g. ringworlds). const Planet *planet = object.GetPlanet(); - if(planet->IsWormhole() || !planet->IsAccessible(player.Flagship()) || shown.contains(planet)) + if(planet->IsWormhole() || !planet->IsAccessible(player.Flagship()) || shown.count(planet)) continue; planetCards.emplace_back(object, number, player.HasVisited(*planet)); Index: source/GameEvent.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/GameEvent.cpp b/source/GameEvent.cpp --- a/source/GameEvent.cpp +++ b/source/GameEvent.cpp @@ -48,7 +48,7 @@ auto definitions = map> {}; for(auto &&node : changes) - if(node.Size() >= 2 && node.HasChildren() && DEFINITION_NODES.contains(node.Token(0))) + if(node.Size() >= 2 && node.HasChildren() && DEFINITION_NODES.count(node.Token(0))) { const string &key = node.Token(0); const string &name = node.Token(1); @@ -116,7 +116,7 @@ planetsToUnvisit.push_back(GameData::Planets().Get(child.Token(1))); else if(key == "visit planet" && child.Size() >= 2) planetsToVisit.push_back(GameData::Planets().Get(child.Token(1))); - else if(allowedChanges.contains(key)) + else if(allowedChanges.count(key)) changes.push_back(child); else conditionsToApply.Add(child); @@ -199,11 +199,11 @@ for(auto &&systems : {systemsToVisit, systemsToUnvisit}) for(auto &&system : systems) - if(!system->IsValid() && !deferred["system"].contains(system->Name())) + if(!system->IsValid() && !deferred["system"].count(system->Name())) return "contains invalid system \"" + system->Name() + "\"."; for(auto &&planets : {planetsToVisit, planetsToUnvisit}) for(auto &&planet : planets) - if(!planet->IsValid() && !deferred["planet"].contains(planet->TrueName())) + if(!planet->IsValid() && !deferred["planet"].count(planet->TrueName())) return "contains invalid planet \"" + planet->TrueName() + "\"."; return isDefined ? "" : "not defined"; Index: source/MapPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/MapPanel.cpp b/source/MapPanel.cpp --- a/source/MapPanel.cpp +++ b/source/MapPanel.cpp @@ -429,7 +429,7 @@ Point center = .5 * (jump[0]->Position() + jump[1]->Position()); const Point &drawPos = GameData::Interfaces().Get("hud")->GetPoint("mini-map"); set drawnSystems = { jump[0], jump[1] }; - bool isLink = jump[0]->Links().contains(jump[1]); + bool isLink = jump[0]->Links().count(jump[1]); const Set &colors = GameData::Colors(); const Color ¤tColor = colors.Get("active mission")->Additive(alpha * 2.f); @@ -465,7 +465,7 @@ Point unit = (from - to).Unit() * LINK_OFFSET; LineShader::Draw(from - unit, to + unit, LINK_WIDTH, lineColor); - if(drawnSystems.contains(link)) + if(drawnSystems.count(link)) continue; drawnSystems.insert(link); @@ -904,7 +904,7 @@ bool MapPanel::GetTravelInfo(const System *previous, const System *next, const double jumpRange, bool &isJump, bool &isWormhole, bool &isMappable, Color *wormholeColor) const { - const bool isHyper = previous->Links().contains(next); + const bool isHyper = previous->Links().count(next); isWormhole = false; isMappable = false; // Short-circuit the loop for MissionPanel, which draws hyperlinks and wormholes the same. @@ -925,7 +925,7 @@ break; } } - isJump = !isHyper && !isWormhole && previous->JumpNeighbors(jumpRange).contains(next); + isJump = !isHyper && !isWormhole && previous->JumpNeighbors(jumpRange).count(next); return isHyper || isWormhole || isJump; } Index: source/EscortDisplay.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/EscortDisplay.cpp b/source/EscortDisplay.cpp --- a/source/EscortDisplay.cpp +++ b/source/EscortDisplay.cpp @@ -240,7 +240,7 @@ int height = 0; for(Icon &icon : icons) { - if(!unstackable.contains(icon.sprite) && (!cheapest || *cheapest < icon)) + if(!unstackable.count(icon.sprite) && (!cheapest || *cheapest < icon)) cheapest = &icon; height += icon.Height(); Index: source/System.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/System.cpp b/source/System.cpp --- a/source/System.cpp +++ b/source/System.cpp @@ -127,8 +127,8 @@ bool removeAll = (remove && !hasValue && !(key == "object" && child.HasChildren())); // If this is the first entry for the given key, and we are not in "add" // or "remove" mode, its previous value should be cleared. - bool overwriteAll = (!add && !remove && shouldOverwrite.contains(key)); - overwriteAll |= (!add && !remove && key == "minables" && shouldOverwrite.contains("asteroids")); + bool overwriteAll = (!add && !remove && shouldOverwrite.count(key)); + overwriteAll |= (!add && !remove && key == "minables" && shouldOverwrite.count("asteroids")); // Clear the data of the given type. if(removeAll || overwriteAll) { Index: source/PlanetPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/PlanetPanel.cpp b/source/PlanetPanel.cpp --- a/source/PlanetPanel.cpp +++ b/source/PlanetPanel.cpp @@ -354,7 +354,7 @@ }; for(const auto &result : flightChecks) for(const auto &warning : result.second) - if(jumpWarnings.contains(warning)) + if(jumpWarnings.count(warning)) { ++nonJumpCount; break; Index: source/Fleet.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Fleet.cpp b/source/Fleet.cpp --- a/source/Fleet.cpp +++ b/source/Fleet.cpp @@ -435,7 +435,7 @@ } )); - if(!canEnter || system.Links().empty() || (source && !system.Links().contains(source))) + if(!canEnter || system.Links().empty() || (source && !system.Links().count(source))) { Place(system, ship); return &system; Index: source/Politics.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Politics.cpp b/source/Politics.cpp --- a/source/Politics.cpp +++ b/source/Politics.cpp @@ -89,9 +89,9 @@ swap(first, second); if(first->IsPlayer()) { - if(bribed.contains(second)) + if(bribed.count(second)) return false; - if(provoked.contains(second)) + if(provoked.count(second)) return true; auto it = reputationWith.find(second); @@ -183,11 +183,11 @@ return false; if(!planet->IsInhabited()) return true; - if(dominatedPlanets.contains(planet)) + if(dominatedPlanets.count(planet)) return true; - if(bribedPlanets.contains(planet)) + if(bribedPlanets.count(planet)) return true; - if(provoked.contains(planet->GetGovernment())) + if(provoked.count(planet->GetGovernment())) return false; return Reputation(planet->GetGovernment()) >= planet->RequiredReputation(); @@ -199,7 +199,7 @@ { if(!planet || !planet->GetSystem()) return false; - if(dominatedPlanets.contains(planet)) + if(dominatedPlanets.count(planet)) return true; auto it = bribedPlanets.find(planet); @@ -231,7 +231,7 @@ bool Politics::HasDominated(const Planet *planet) const { - return dominatedPlanets.contains(planet); + return dominatedPlanets.count(planet); } @@ -241,7 +241,7 @@ { // Do nothing if you have already been fined today, or if you evade // detection. - if(fined.contains(gov) || Random::Real() > security || !gov->GetFineFraction()) + if(fined.count(gov) || Random::Real() > security || !gov->GetFineFraction()) return ""; string reason; Index: source/text/FontSet.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/text/FontSet.cpp b/source/text/FontSet.cpp --- a/source/text/FontSet.cpp +++ b/source/text/FontSet.cpp @@ -29,7 +29,7 @@ void FontSet::Add(const string &path, int size) { - if(!fonts.contains(size)) + if(!fonts.count(size)) fonts[size].Load(path); } Index: source/ConditionSet.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/ConditionSet.cpp b/source/ConditionSet.cpp --- a/source/ConditionSet.cpp +++ b/source/ConditionSet.cpp @@ -69,7 +69,7 @@ static const set comparison = { "==", "!=", "<", ">", "<=", ">=" }; - return comparison.contains(op); + return comparison.count(op); } bool IsAssignment(const string &op) @@ -77,7 +77,7 @@ static const set assignment = { "=", "+=", "-=", "*=", "/=", "?=" }; - return assignment.contains(op); + return assignment.count(op); } bool IsSimple(const string &op) @@ -85,7 +85,7 @@ static const set simple = { "(", ")", "+", "-", "*", "/", "%" }; - return simple.contains(op); + return simple.count(op); } int Precedence(const string &op) @@ -106,7 +106,7 @@ "||", "&&", "&=", "|=", "<<", ">>" }; for(const string &str : tokens) - if(invalids.contains(str)) + if(invalids.count(str)) return true; return false; } Index: source/Plugins.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Plugins.cpp b/source/Plugins.cpp --- a/source/Plugins.cpp +++ b/source/Plugins.cpp @@ -74,7 +74,7 @@ // Check and log collisions between optional and required dependencies. for(const string &dependency : optional) { - if(required.contains(dependency)) + if(required.count(dependency)) dependencyCollisions += dependency + ", "; } if(!dependencyCollisions.empty()) @@ -89,7 +89,7 @@ // Check and log collisions between conflicted and required dependencies. for(const string &dependency : conflicted) { - if(required.contains(dependency)) + if(required.count(dependency)) { isValid = false; dependencyCollisions += dependency + ", "; @@ -107,7 +107,7 @@ // Check and log collisions between optional and conflicted dependencies. for(const string &dependency : conflicted) { - if(optional.contains(dependency)) + if(optional.count(dependency)) { isValid = false; dependencyCollisions += dependency + ", "; Index: source/Interface.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Interface.cpp b/source/Interface.cpp --- a/source/Interface.cpp +++ b/source/Interface.cpp @@ -159,7 +159,7 @@ // Check if a named point exists. bool Interface::HasPoint(const string &name) const { - return points.contains(name); + return points.count(name); } Index: source/TextReplacements.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/TextReplacements.cpp b/source/TextReplacements.cpp --- a/source/TextReplacements.cpp +++ b/source/TextReplacements.cpp @@ -57,7 +57,7 @@ key += ">"; child.PrintTrace("Warning: text replacements must be suffixed by \">\":"); } - if(reserved.contains(key)) + if(reserved.count(key)) { child.PrintTrace("Skipping reserved substitution key:"); continue; Index: tests/unit/src/test_datafile.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/tests/unit/src/test_datafile.cpp b/tests/unit/src/test_datafile.cpp --- a/tests/unit/src/test_datafile.cpp +++ b/tests/unit/src/test_datafile.cpp @@ -89,7 +89,7 @@ std::set children{"foo", "something"}; for(const auto &parent : root) for(const auto &child : parent) - REQUIRE(children.contains(child.Token(0))); + REQUIRE(children.count(child.Token(0))); } AND_THEN( "iterating child nodes visits their child nodes" ) { for(const auto &parent : root) Index: source/Depreciation.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Depreciation.cpp b/source/Depreciation.cpp --- a/source/Depreciation.cpp +++ b/source/Depreciation.cpp @@ -101,7 +101,7 @@ WriteSorted(ships, [](const ShipElement *lhs, const ShipElement *rhs) { return lhs->first->TrueModelName() < rhs->first->TrueModelName(); }, - [=, this, &out](const ShipElement &sit) + [=, &out](const ShipElement &sit) { out.Write("ship", sit.first->TrueModelName()); out.BeginChild(); @@ -120,7 +120,7 @@ WriteSorted(outfits, [](const OutfitElement *lhs, const OutfitElement *rhs) { return lhs->first->TrueName() < rhs->first->TrueName(); }, - [=, this, &out](const OutfitElement &oit) + [=, &out](const OutfitElement &oit) { out.Write("outfit", oit.first->TrueName()); out.BeginChild(); Index: source/ShipJumpNavigation.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/ShipJumpNavigation.cpp b/source/ShipJumpNavigation.cpp --- a/source/ShipJumpNavigation.cpp +++ b/source/ShipJumpNavigation.cpp @@ -136,7 +136,7 @@ { if(!from || !to) return make_pair(JumpType::NONE, 0.); - bool linked = from->Links().contains(to); + bool linked = from->Links().count(to); double hyperFuelNeeded = HyperdriveFuel(); // If these two systems are linked, or if the system we're jumping from has its own jump range, // then use the cheapest jump drive available, which is mapped to a distance of 0. @@ -160,7 +160,7 @@ if(!from || !to) return false; - if(from->Links().contains(to) && (hasHyperdrive || hasJumpDrive)) + if(from->Links().count(to) && (hasHyperdrive || hasJumpDrive)) return true; if(!hasJumpDrive) Index: source/PrintData.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/PrintData.cpp b/source/PrintData.cpp --- a/source/PrintData.cpp +++ b/source/PrintData.cpp @@ -131,7 +131,7 @@ for(auto &it : objects) { const Type &object = it.second; - if(object.Attributes().contains(attribute)) + if(object.Attributes().count(attribute)) cout << (index++ ? ';' : ',') << DataWriter::Quote(it.first); } cout << '\n'; @@ -714,7 +714,7 @@ for(const char *const *it = argv + 1; *it; ++it) { string arg = *it; - if(OTHER_VALID_ARGS.contains(arg) || OUTFIT_ARGS.contains(arg)) + if(OTHER_VALID_ARGS.count(arg) || OUTFIT_ARGS.count(arg)) return true; } return false; @@ -732,7 +732,7 @@ Ships(argv); break; } - else if(OUTFIT_ARGS.contains(arg)) + else if(OUTFIT_ARGS.count(arg)) { Outfits(argv); break; Index: source/Set.h IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Set.h b/source/Set.h --- a/source/Set.h +++ b/source/Set.h @@ -34,7 +34,7 @@ // pointer rather than creating the item. const Type *Find(const std::string &name) const; - bool Has(const std::string &name) const { return data.contains(name); } + bool Has(const std::string &name) const { return data.count(name); } typename std::map::iterator begin() { return data.begin(); } typename std::map::const_iterator begin() const { return data.begin(); } Index: source/Mission.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Mission.cpp b/source/Mission.cpp --- a/source/Mission.cpp +++ b/source/Mission.cpp @@ -472,10 +472,10 @@ it.second.Save(out); // Save any "on enter" actions that have not been performed. for(const auto &it : onEnter) - if(!didEnter.contains(&it.second)) + if(!didEnter.count(&it.second)) it.second.Save(out); for(const MissionAction &action : genericOnEnter) - if(!didEnter.contains(&action)) + if(!didEnter.count(&action)) action.Save(out); } out.EndChild(); @@ -760,7 +760,7 @@ { if(clearance.empty()) return false; - if(planet == destination || stopovers.contains(planet) || visitedStopovers.contains(planet)) + if(planet == destination || stopovers.count(planet) || visitedStopovers.count(planet)) return true; return (!clearanceFilter.IsEmpty() && clearanceFilter.Matches(planet)); } @@ -1156,7 +1156,7 @@ requiredActions.insert(Trigger::WAYPOINT); } for(const auto &it : actions) - if(requiredActions.contains(it.first) && it.second.RequiresGiftedShip(shipId)) + if(requiredActions.count(it.first) && it.second.RequiresGiftedShip(shipId)) return true; return false; @@ -1620,7 +1620,7 @@ { const auto eit = onEnter.find(system); const auto originalSize = didEnter.size(); - if(eit != onEnter.end() && !didEnter.contains(&eit->second) && eit->second.CanBeDone(player, IsFailed(player))) + if(eit != onEnter.end() && !didEnter.count(&eit->second) && eit->second.CanBeDone(player, IsFailed(player))) { eit->second.Do(player, ui, this); didEnter.insert(&eit->second); @@ -1629,7 +1629,7 @@ // which may use a LocationFilter to govern which systems it can be performed in. else for(MissionAction &action : genericOnEnter) - if(!didEnter.contains(&action) && action.CanBeDone(player, IsFailed(player))) + if(!didEnter.count(&action) && action.CanBeDone(player, IsFailed(player))) { action.Do(player, ui, this); didEnter.insert(&action); Index: source/AI.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/AI.cpp b/source/AI.cpp --- a/source/AI.cpp +++ b/source/AI.cpp @@ -3093,7 +3093,7 @@ { // This function is only called for ships that are in the player's system. // Update the radius that the ship is searching for asteroids at. - bool isNew = !miningAngle.contains(&ship); + bool isNew = !miningAngle.count(&ship); Angle &angle = miningAngle[&ship]; if(isNew) { @@ -3165,7 +3165,7 @@ double scanRangeMetric = 10000. * max(64., ship.Attributes().Get("asteroid scan power") + ship.Attributes().Get("tactical scan power")); for(const shared_ptr &it : flotsam) { - if(!ship.CanPickUp(*it) || avoid.contains(it.get())) + if(!ship.CanPickUp(*it) || avoid.count(it.get())) continue; // Only pick up flotsam that is nearby and that you are facing toward. Player escorts should // always attempt to pick up nearby flotsams when they are given a harvest order, and so ignore @@ -3291,7 +3291,7 @@ // TODO: This could use an "Avoid" method, to account for other in-system hazards. // Simple approximation: move equally away from both the system center and the // nearest enemy, until the constrainment boundary is reached. - if(ship.GetPersonality().IsUnconstrained() || !fenceCount.contains(&ship)) + if(ship.GetPersonality().IsUnconstrained() || !fenceCount.count(&ship)) safety = 2 * ship.Position().Unit() - nearestEnemy->Position().Unit(); else safety = -ship.Position().Unit(); @@ -3417,7 +3417,7 @@ if(distance < maxScanRange) { Point away; - if(ship.GetPersonality().IsUnconstrained() || !fenceCount.contains(&ship)) + if(ship.GetPersonality().IsUnconstrained() || !fenceCount.count(&ship)) away = pos - scanningPos; else away = -pos; @@ -4776,7 +4776,7 @@ // "Know your enemies." enemyStrength[gov.first] += enemy.second; for(const auto &ally : strength) - if(ally.first->IsEnemy(enemy.first) && !allies.contains(ally.first)) + if(ally.first->IsEnemy(enemy.first) && !allies.count(ally.first)) { // "The enemy of my enemy is my friend." allyStrength[gov.first] += ally.second; @@ -4791,7 +4791,7 @@ const Government *gov = it->GetGovernment(); // Check if this ship's government has the authority to enforce scans & fines in this system. - if(!scanPermissions.contains(gov)) + if(!scanPermissions.count(gov)) scanPermissions.emplace(gov, gov && gov->CanEnforce(playerSystem)); // Only have ships update their strength estimate once per second on average. @@ -4903,7 +4903,7 @@ continue; gaveOrder = true; - hasMismatch |= !orders.contains(ship); + hasMismatch |= !orders.count(ship); Orders &existing = orders[ship]; existing.MergeOrders(newOrders, hasMismatch, alreadyHarvesting, orderOperation); Index: source/LoadPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/LoadPanel.cpp b/source/LoadPanel.cpp --- a/source/LoadPanel.cpp +++ b/source/LoadPanel.cpp @@ -215,7 +215,7 @@ string hoverText; // Draw the list of snapshots for the selected pilot. - if(!selectedPilot.empty() && files.contains(selectedPilot)) + if(!selectedPilot.empty() && files.count(selectedPilot)) { const Point topLeft = snapshotBox.TopLeft(); Point currentTopLeft = topLeft + Point(0, -centerScroll); Index: source/ShopPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/ShopPanel.cpp b/source/ShopPanel.cpp --- a/source/ShopPanel.cpp +++ b/source/ShopPanel.cpp @@ -410,7 +410,7 @@ if(CanShowInSidebar(*ship, here)) playerShips.insert(ship); - if(!playerShips.contains(playerShip)) + if(!playerShips.count(playerShip)) playerShip = playerShips.empty() ? nullptr : *playerShips.begin(); } else @@ -424,7 +424,7 @@ if(CanShowInSidebar(*ship, here)) playerShips.insert(ship); - if(!playerShips.contains(playerShip)) + if(!playerShips.count(playerShip)) playerShip = playerShips.empty() ? nullptr : *playerShips.begin(); } } @@ -746,7 +746,7 @@ point.Y() += ICON_TILE; } - bool isSelected = playerShips.contains(ship.get()); + bool isSelected = playerShips.count(ship.get()); const Sprite *background = SpriteSet::Get(isSelected ? "ui/icon selected" : "ui/icon unselected"); SpriteShader::Draw(background, point); // If this is one of the selected ships, check if the currently hovered @@ -998,7 +998,7 @@ point.Y() += bigFont.Height() + 20; nextY += bigFont.Height() + 20; - bool isCollapsed = collapsed.contains(category); + bool isCollapsed = collapsed.count(category); bool isEmpty = true; for(const string &name : it->second) { @@ -1059,7 +1059,7 @@ int ShopPanel::DrawPlayerShipInfo(const Point &point) { - shipInfo.Update(*playerShip, player, collapsed.contains("description"), true); + shipInfo.Update(*playerShip, player, collapsed.count("description"), true); shipInfo.DrawAttributes(point, !isOutfitter); const int attributesHeight = shipInfo.GetAttributesHeight(!isOutfitter); shipInfo.DrawOutfits(Point(point.X(), point.Y() + attributesHeight)); @@ -1185,7 +1185,7 @@ } else if(!control) playerShips.clear(); - else if(playerShips.contains(ship)) + else if(playerShips.count(ship)) { playerShips.erase(ship); if(playerShip == ship) Index: source/pi.h IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/pi.h b/source/pi.h --- a/source/pi.h +++ b/source/pi.h @@ -15,10 +15,9 @@ #pragma once -#include - -constexpr double PI = std::numbers::pi; +// Constants to replace M_PI (which is not available on all operating systems). +constexpr double PI = 3.14159265358979323846; constexpr double TO_RAD = PI / 180.; constexpr double TO_DEG = 180. / PI; Index: source/ShipyardPanel.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/ShipyardPanel.cpp b/source/ShipyardPanel.cpp --- a/source/ShipyardPanel.cpp +++ b/source/ShipyardPanel.cpp @@ -163,7 +163,7 @@ if(selectedShip) { - shipInfo.Update(*selectedShip, player, collapsed.contains(DESCRIPTION), true); + shipInfo.Update(*selectedShip, player, collapsed.count(DESCRIPTION), true); selectedItem = selectedShip->DisplayModelName(); const Point spriteCenter(center.X(), center.Y() + 20 + TileSize() / 2); @@ -186,7 +186,7 @@ if(hasDescription) { - if(!collapsed.contains(DESCRIPTION)) + if(!collapsed.count(DESCRIPTION)) { descriptionOffset = shipInfo.DescriptionHeight(); shipInfo.DrawDescription(startPoint); Index: source/DistanceMap.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/DistanceMap.cpp b/source/DistanceMap.cpp --- a/source/DistanceMap.cpp +++ b/source/DistanceMap.cpp @@ -94,7 +94,7 @@ // Find out if the given system is reachable. bool DistanceMap::HasRoute(const System *system) const { - return route.contains(system); + return route.count(system); } Index: source/Ship.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Ship.cpp b/source/Ship.cpp --- a/source/Ship.cpp +++ b/source/Ship.cpp @@ -902,8 +902,8 @@ Logger::LogError(message + "\" (no current system)."); targetSystem = nullptr; } - else if(!currentSystem->Links().contains(targetSystem) - && (!navigation.JumpRange() || !currentSystem->JumpNeighbors(navigation.JumpRange()).contains(targetSystem))) + else if(!currentSystem->Links().count(targetSystem) + && (!navigation.JumpRange() || !currentSystem->JumpNeighbors(navigation.JumpRange()).count(targetSystem))) { Logger::LogError(message + "\" by hyperlink or jump from system \"" + currentSystem->Name() + ".\""); targetSystem = nullptr; Index: source/Planet.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Planet.cpp b/source/Planet.cpp --- a/source/Planet.cpp +++ b/source/Planet.cpp @@ -92,7 +92,7 @@ removeAll |= (!add && !remove && hasValue && value == "clear"); // If this is the first entry for the given key, and we are not in "add" // or "remove" mode, its previous value should be cleared. - bool overwriteAll = (!add && !remove && !removeAll && shouldOverwrite.contains(key)); + bool overwriteAll = (!add && !remove && !removeAll && shouldOverwrite.count(key)); // Clear the data of the given type. if(removeAll || overwriteAll) { @@ -238,7 +238,7 @@ // For reverse compatibility, if this planet has a spaceport but it was not custom loaded, // and the planet has the "uninhabited" attribute, replace the spaceport with a special-case // uninhabited spaceport. - if(attributes.contains("uninhabited") && HasNamedPort() && !port.CustomLoaded()) + if(attributes.count("uninhabited") && HasNamedPort() && !port.CustomLoaded()) port.LoadUninhabitedSpaceport(); // Apply any auto-attributes to this planet depending on what it has. @@ -284,7 +284,7 @@ } // Precalculate commonly used values that can only change due to Load(). - inhabited = (HasServices() || requiredReputation || !defenseFleets.empty()) && !attributes.contains("uninhabited"); + inhabited = (HasServices() || requiredReputation || !defenseFleets.empty()) && !attributes.count("uninhabited"); SetRequiredAttributes(Attributes(), requiredAttributes); } Index: source/Information.cpp IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/source/Information.cpp b/source/Information.cpp --- a/source/Information.cpp +++ b/source/Information.cpp @@ -138,7 +138,7 @@ if(condition.front() == '!') return !HasCondition(condition.substr(1)); - return conditions.contains(condition); + return conditions.count(condition); } ```

... 99% identical to a 'git revert' of 10362, but done error by error to make sure no compatible change is toasted.

And also - not urgent in any way, it's unplayable anyway, but more due to my own private factors. Compared to a few weeks back on Mint 21.3, now on Mint 22 with the newer oibaf mesa drivers it's sluggish as hell, though seemingly not through reduced fps (built-in load doesn't go over 40% cpu / 50% gpu - isn't there an actual fps display too?)... Needs experimenting - revert the nightly mesa stuff first. But there's other distracting foss projects...

Also for the record - I get it, the lack of contains is absolutely disgusting, embarrassing for the old gcc, medieval even. We Mint'ers frequently suffer from such "stone-age regressions" - took ages to get a useable gimp, darktable is way behind, even nemo is unstable.... We're used to it, in exchange for some "LTS" peace of mind. Just so you know, some distros aren't yet ready to leave the dark ages...

SomeTroglodyte commented 3 months ago

Also for the record, the best I can get to in a semi-clean fashion is gcc14, which doesn't build ES either:

sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y
sudo apt update
sudo apt install gcc-14 g++-14 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 200 --slave /usr/bin/g++ g++ /usr/bin/g++-14 --slave /usr/bin/gcov gcov /usr/bin/gcov-13
gcc --version
gcc (Ubuntu 14.2.0-1ubuntu1~24.04) 14.2.0
warp-core commented 3 months ago

I set up a VM and installed Linux Mint 22, ran:

sudo apt install git cmake ninja-build curl libsdl2-dev libpng-dev libjpeg-dev libgl1-mesa-dev libglew-dev libopenal-dev libmad0-dev uuid-dev catch2
git clone https://github.com/endless-sky/endless-sky
cd endless-sky
cmake --preset linux
cmake --build --preset linux-debug

And it built. It already had gcc 13.2.0 installed.

It seems to me like your cmake configuration hasn't been updated and it's still trying to build with an older version of C++. Have you tried deleting the build directory and running cmake --preset linux before building?

SomeTroglodyte commented 3 months ago

Oh I get it - no "Keep it Simple", language level and compiler version have no correlation. Duh.

So, the issue is, regenerating the preset didn't clean up... running cmake --preset linux before building I DID think of, but not re-cloning. OK, manually deleting 'build' does it too. Oh my, sorry for bothering.