MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CheckVersion

Method CheckVersion

engine/Poseidon/Asset/Addon/AddonSystem.cpp:139–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139bool AddonSystem::CheckVersion(const RString& prefix, const ParamEntry& addon)
140{
141 const ParamEntry* patches = addon.FindEntry("CfgPatches");
142 if (!patches || patches->GetEntryCount() == 0)
143 return false;
144
145 RString strVersion = GetAppVersion();
146 int version = VersionToInt(strVersion);
147
148 for (int i = 0; i < patches->GetEntryCount(); i++)
149 {
150 const ParamEntry& patch = patches->GetEntry(i);
151 const ParamEntry* entry = patch.FindEntry("requiredVersion");
152 if (entry)
153 {
154 RString required = *entry;
155 if (VersionToInt(required) > version)
156 {
157 WarningMessage("Addon '%s' requires version %s or higher", (const char*)patch.GetName(),
158 (const char*)required);
159 return false;
160 }
161 }
162 const AddonInfo& info = s_addonRegistry[patch.GetName()];
163 if (s_addonRegistry.NotNull(info))
164 RptF("Conflicting addon %s in '%s', previous definition in '%s'", (const char*)patch.GetName(),
165 (const char*)prefix, (const char*)info.GetPrefix());
166 else
167 s_addonRegistry.Add(AddonInfo(patch.GetName(), prefix));
168 }
169
170 return true;
171}
172
173bool AddonSystem::ParseAddonConfig(const RString& prefixPath)
174{

Callers

nothing calls this directly

Calls 10

GetAppVersionFunction · 0.85
VersionToIntFunction · 0.85
WarningMessageFunction · 0.85
AddonInfoClass · 0.85
FindEntryMethod · 0.45
GetEntryCountMethod · 0.45
GetNameMethod · 0.45
NotNullMethod · 0.45
GetPrefixMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected