Skip to content

Better cooked package replacement check #765

@Xymanek

Description

@Xymanek

Currently the version check is done via templates, which was invented when XComGame was the only package being replaced. This has 2 downsides:

  1. Cannot use this info in CreateTemplates (or OnPreCreateTemplates)
  2. 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));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions