Currently the version check is done via templates, which was invented when XComGame was the only package being replaced. This has 2 downsides:
- Cannot use this info in
CreateTemplates (or OnPreCreateTemplates)
- It relies on
XComGame creating templates for other packages, which makes it unreliable for error detection since it will report Engine replacement as missing if XComGame one wasn't loaded
While we cannot remove the existing approach due to BC, I propose we switch to a method of class-is-not-none and then getting default values, similar to how the CHEngineVersion template is created, in places which we control (eg. shell) and in future additions (eg. DLC2, #764)
|
// CHL: We can't create templates in Engine, so we use this to create the template in XComGame |
|
class CHEngineVersion extends Object; |
|
if (class'Engine.CHEngineVersion' != none) |
|
{ |
|
class'X2TacticalGameRuleset'.static.ReleaseScriptLog("X2WOTCCommunityHighlander: Creating Engine version template..."); |
|
`CREATE_X2TEMPLATE(class'CHXComGameVersionTemplate', XComGameVersion, 'CHEngineVersion'); |
|
XComGameVersion.MajorVersion = class'Engine.CHEngineVersion'.default.MajorVersion; |
|
XComGameVersion.MinorVersion = class'Engine.CHEngineVersion'.default.MinorVersion; |
|
XComGameVersion.PatchVersion = class'Engine.CHEngineVersion'.default.PatchVersion; |
|
XComGameVersion.Commit = class'Engine.CHEngineVersion'.default.Commit; |
|
class'X2TacticalGameRuleset'.static.ReleaseScriptLog("X2WOTCCommunityHighlander: Created Engine version template with version" @ XComGameVersion.MajorVersion $ "." $ XComGameVersion.MinorVersion $ "." $ XComGameVersion.PatchVersion); |
|
Templates.AddItem(XComGameVersion); |
|
} |
|
Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHEngineVersion'), SelfVersion, "Engine", true, true)); |
|
Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHXComGameVersion'), SelfVersion, "XComGame", true, true)); |
Currently the version check is done via templates, which was invented when
XComGamewas the only package being replaced. This has 2 downsides:CreateTemplates(orOnPreCreateTemplates)XComGamecreating templates for other packages, which makes it unreliable for error detection since it will reportEnginereplacement as missing ifXComGameone wasn't loadedWhile we cannot remove the existing approach due to BC, I propose we switch to a method of class-is-not-none and then getting default values, similar to how the
CHEngineVersiontemplate is created, in places which we control (eg. shell) and in future additions (eg. DLC2, #764)X2WOTCCommunityHighlander/X2WOTCCommunityHighlander/Src/Engine/Classes/CHEngineVersion.uc
Lines 1 to 2 in fb9537d
X2WOTCCommunityHighlander/X2WOTCCommunityHighlander/Src/XComGame/Classes/CHXComGameVersion.uc
Lines 25 to 35 in fb9537d
X2WOTCCommunityHighlander/X2WOTCCommunityHighlander/Src/X2WOTCCommunityHighlander/Classes/X2WOTCCH_Components.uc
Lines 46 to 47 in fb9537d