| 52 | } |
| 53 | |
| 54 | ServerModResolution ServerModResolver::Resolve(const ServerModList& server, const ModCatalog& catalog) const |
| 55 | { |
| 56 | ServerModResolution out; |
| 57 | |
| 58 | for (const ModId& id : server.Required()) |
| 59 | { |
| 60 | if (_installed.count(id) != 0) |
| 61 | { |
| 62 | out._satisfied.push_back(id); |
| 63 | continue; |
| 64 | } |
| 65 | if (const ModCatalogEntry* e = catalog.Find(id)) |
| 66 | { |
| 67 | out._toDownload.push_back( |
| 68 | {id, e->Name().empty() ? id.Value() : e->Name(), e->DownloadUrl(), e->FolderName(), e->SizeBytes()}); |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | out._blocked.push_back(id); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | // Only an exact-match server forces extras off; otherwise the player keeps them. |
| 77 | if (server.RequiresExactMatch()) |
| 78 | { |
| 79 | std::unordered_set<ModId, ModId::Hash> seen; |
| 80 | for (const ModId& id : _active) |
| 81 | { |
| 82 | if (id.Empty() || server.Requires(id)) |
| 83 | { |
| 84 | continue; |
| 85 | } |
| 86 | if (seen.insert(id).second) |
| 87 | { |
| 88 | out._toDisable.push_back(id); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | return out; |
| 94 | } |
| 95 | |
| 96 | } // namespace Poseidon |