Disable DLC_2 check for now

Disable DLC_2 check for now

class X2WOTCCH_Components extends Object config(CHLComponents);

enum CHLComponentStatus
{
	// OK
	eCHLCS_NotExpectedNotFound,
	eCHLCS_OK,
	// Warnings
	eCHLCS_VersionMismatch,
	eCHLCS_ExpectedNotFound,
	// Errors
	eCHLCS_RequiredNotFound,
};

struct CHLComponent
{
	var string DisplayName;
	var string DisplayVersion;
	var CHLComponentStatus CompStatus;
};

//var config bool DLC2ReplacementEnabled;
//var config bool DLC3ReplacementEnabled;

var localized string VersionFormat;
var localized string RequiredNotFound;
var localized string ExpectedNotFound;
var localized string NotExpectedNotFound;

var localized string VersionMismatches;
var localized string WarningsLabel;
var localized string ErrorsLabel;

static function array<CHLComponent> GetComponentInfo()
{
	local X2StrategyElementTemplateManager Manager;
	local X2StrategyElementTemplate SelfVersion;
	local array<string> DLCNames;
	local array<CHLComponent> Comps;

	Manager = class'X2StrategyElementTemplateManager'.static.GetStrategyElementTemplateManager();
	DLCNames = class'Helpers'.static.GetInstalledDLCNames();

	SelfVersion = Manager.FindStrategyElementTemplate('CHWOTCVersion');
	Comps.AddItem(BuildComponent(SelfVersion, none, "X2WOTCCommunityHighlander", true, true));
	Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHEngineVersion'), SelfVersion, "Engine", true, true));
	Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHXComGameVersion'), SelfVersion, "XComGame", true, true));

	/* FIXME: Uncomment when a DLC 2 Highlander is added
	if (DLCNames.Find("DLC_2") != INDEX_NONE)
	{
		Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHDLC2Version'), SelfVersion, "DLC_2", false, default.DLC2ReplacementEnabled));
	}
	*/

	/* FIXME: Uncomment when a DLC_3 Highlander is added
	if (DLCNames.Find("DLC_3") != INDEX_NONE)
	{
		Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHDLC3Version'), SelfVersion, "DLC_3", false, default.DLC3ReplacementEnabled));
	}
	*/

	return Comps;
}

static function CHLComponent BuildComponent(X2StrategyElementTemplate Template, X2StrategyElementTemplate CompareVersion, string ComponentName, bool Required, bool Expected)
{
	local CHLComponent Comp;

	Comp.DisplayName = ComponentName;

	if (Template != none)
	{
		Comp.DisplayVersion = FormatVersion(Template);
		if (CompareVersion != none)
		{
			if (CHXComGameVersionTemplate(Template).GetVersionNumber() == CHXComGameVersionTemplate(CompareVersion).GetVersionNumber())
			{
				Comp.CompStatus = eCHLCS_OK;
			}
			else
			{
				Comp.CompStatus = eCHLCS_VersionMismatch;
			}
		}
		else
		{
			Comp.CompStatus = eCHLCS_OK;
		}
	}
	else
	{
		if (Required)
		{
			Comp.DisplayVersion = default.RequiredNotFound;
			Comp.CompStatus = eCHLCS_RequiredNotFound;
		}
		else if (Expected)
		{
			Comp.DisplayVersion = default.ExpectedNotFound;
			Comp.CompStatus = eCHLCS_ExpectedNotFound;
		}
		else
		{
			Comp.DisplayVersion = default.NotExpectedNotFound;
			Comp.CompStatus = eCHLCS_NotExpectedNotFound;
		}
	}

	return Comp;
}

static function string FormatVersion(X2StrategyElementTemplate Version)
{
	local string Ret;

	Ret = default.VersionFormat;
	Ret = Repl(Ret, "%MAJOR", CHXComGameVersionTemplate(Version).MajorVersion);
	Ret = Repl(Ret, "%MINOR", CHXComGameVersionTemplate(Version).MinorVersion);
	Ret = Repl(Ret, "%PATCH", CHXComGameVersionTemplate(Version).PatchVersion);

	return Ret;
}

class X2WOTCCH_Components extends Object config(CHLComponents);

enum CHLComponentStatus
{
	// OK
	eCHLCS_NotExpectedNotFound,
	eCHLCS_OK,
	// Warnings
	eCHLCS_VersionMismatch,
	eCHLCS_ExpectedNotFound,
	// Errors
	eCHLCS_RequiredNotFound,
};

struct CHLComponent
{
	var string DisplayName;
	var string DisplayVersion;
	var CHLComponentStatus CompStatus;
};

var config bool DLC2ReplacementEnabled;
//var config bool DLC3ReplacementEnabled;

var localized string VersionFormat;
var localized string RequiredNotFound;
var localized string ExpectedNotFound;
var localized string NotExpectedNotFound;

var localized string VersionMismatches;
var localized string WarningsLabel;
var localized string ErrorsLabel;

static function array<CHLComponent> GetComponentInfo()
{
	local X2StrategyElementTemplateManager Manager;
	local X2StrategyElementTemplate SelfVersion;
	local array<string> DLCNames;
	local array<CHLComponent> Comps;

	Manager = class'X2StrategyElementTemplateManager'.static.GetStrategyElementTemplateManager();
	DLCNames = class'Helpers'.static.GetInstalledDLCNames();

	SelfVersion = Manager.FindStrategyElementTemplate('CHWOTCVersion');
	Comps.AddItem(BuildComponent(SelfVersion, none, "X2WOTCCommunityHighlander", true, true));
	Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHEngineVersion'), SelfVersion, "Engine", true, true));
	Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHXComGameVersion'), SelfVersion, "XComGame", true, true));

	if (DLCNames.Find("DLC_2") != INDEX_NONE)
	{
		Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHDLC2Version'), SelfVersion, "DLC_2", false, default.DLC2ReplacementEnabled));
	}

	/* FIXME: Uncomment when a DLC_3 Highlander is added
	if (DLCNames.Find("DLC_3") != INDEX_NONE)
	{
		Comps.AddItem(BuildComponent(Manager.FindStrategyElementTemplate('CHDLC3Version'), SelfVersion, "DLC_3", false, default.DLC3ReplacementEnabled));
	}
	*/

	return Comps;
}

static function CHLComponent BuildComponent(X2StrategyElementTemplate Template, X2StrategyElementTemplate CompareVersion, string ComponentName, bool Required, bool Expected)
{
	local CHLComponent Comp;

	Comp.DisplayName = ComponentName;

	if (Template != none)
	{
		Comp.DisplayVersion = FormatVersion(Template);
		if (CompareVersion != none)
		{
			if (CHXComGameVersionTemplate(Template).GetVersionNumber() == CHXComGameVersionTemplate(CompareVersion).GetVersionNumber())
			{
				Comp.CompStatus = eCHLCS_OK;
			}
			else
			{
				Comp.CompStatus = eCHLCS_VersionMismatch;
			}
		}
		else
		{
			Comp.CompStatus = eCHLCS_OK;
		}
	}
	else
	{
		if (Required)
		{
			Comp.DisplayVersion = default.RequiredNotFound;
			Comp.CompStatus = eCHLCS_RequiredNotFound;
		}
		else if (Expected)
		{
			Comp.DisplayVersion = default.ExpectedNotFound;
			Comp.CompStatus = eCHLCS_ExpectedNotFound;
		}
		else
		{
			Comp.DisplayVersion = default.NotExpectedNotFound;
			Comp.CompStatus = eCHLCS_NotExpectedNotFound;
		}
	}

	return Comp;
}

static function string FormatVersion(X2StrategyElementTemplate Version)
{
	local string Ret;

	Ret = default.VersionFormat;
	Ret = Repl(Ret, "%MAJOR", CHXComGameVersionTemplate(Version).MajorVersion);
	Ret = Repl(Ret, "%MINOR", CHXComGameVersionTemplate(Version).MinorVersion);
	Ret = Repl(Ret, "%PATCH", CHXComGameVersionTemplate(Version).PatchVersion);

	return Ret;
}


Update math.uc

Update math.uc

Added SGN()

# math.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.5 on 3/3/2014 5:18:43 PM
# Comment: Converts math-related code from PowerBASIC to C++

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: False
Exclude: False
Comment: Converts math-related code from PowerBASIC to C++
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Comment: ^ (power)
Pass: 1

Criteria: 2
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 3
Enabled: True
BackColor: Gold
Precedence: 100
Find: {x} ^ {y}  {@Note: precedence property set to 100}
Replace: pow({x}, {y})

Criteria: 4
Comment: Bitwise AND and OR
Pass: 2

Criteria: 5
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 6
Enabled: True
Comment: Bitwise AND and OR
BackColor: YellowGreen
Find: ({expr})
Replace: ({@Eval: Replace(Replace('{expr}', "And", "&"), "Or", "|")})

Criteria: 7
Comment: Everything else
Pass: 3

Criteria: 8
Enabled: True
Find: {@Start}
      {@Note:
         ToDo:  \ exp10 frac sgn shift
               eqv imp bin hex oct Not
               and fix LCase for next version
      }
Replace: #include <math.h>
         #include <stdlib.h>
         {@Note: rand & srand are in stdlib.h}

Criteria: 9
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 10
Enabled: False
Find: {func: Abs|Sin|Cos|Tan|Exp|Exp2|Log|Log2|Log10|Ceil}
Replace: {@Evaluate: LCase({func})}

Criteria: 11
Enabled: True
Find: Mod
Replace: %

Criteria: 12
Enabled: True
BackColor: Yellow
Find: Atn
Replace: atan

Criteria: 13
Enabled: True
BackColor: Lime
Find: Sqr
Replace: sqrt

Criteria: 14
Enabled: True
BackColor: Brown
Find: Fix
Replace: trunc

Criteria: 15
Enabled: True
BackColor: Pink
Find: Cint
Replace: lround

Criteria: 16
Enabled: True
BackColor: Red
Find: Incr {var:1}
Replace: {var}++

Criteria: 17
Enabled: True
BackColor: RoyalBlue
Find: Decr {var:1}
Replace: {var}--

Criteria: 18
Enabled: True
Comment: Logical (short-circuit) AND
Find: And
Replace: &&

Criteria: 19
Enabled: True
Comment: Logical (short-circuit) OR
BackColor: Purple
Find: Or
Replace: ||

Criteria: 20
Enabled: True
BackColor: Khaki
Find: Xor
Replace: ^

Criteria: 21
Enabled: True
BackColor: Green
Find: Not
Replace: ~

Criteria: 22
Enabled: True
SkipOver: True
Find: #{metastatement:1} Not
Replace: [Skip over]

Criteria: 23
Enabled: True
BackColor: Silver
Find: IsTrue {x}
Replace: ({x} <> 0)

Criteria: 24
Enabled: True
BackColor: SandyBrown
Find: IsFalse {x}
Replace: !{x}

Criteria: 25
Enabled: True
BackColor: Violet
Find: <>
Replace: !=

Criteria: 26
Enabled: True
Find: Randomize {number}
Replace: srand({number})

Criteria: 27
Enabled: True
Find: Rnd[()]
Replace: (rand() / RAND_MAX)

Criteria: 28
Enabled: True
Find: Rnd({a}, {b})
Replace: (rand() % ({b}) + ({a}))

Criteria: 29
Enabled: True
Find: Shift Right {ivar}, {countexpr}
Replace: {ivar} = ({ivar} >> {countexpr})

Criteria: 30
Enabled: True
Find: Shift Left {ivar}, {countexpr}
Replace: {ivar} = ({ivar} << {countexpr})

Criteria: 31
Enabled: True
Selected: True
Find: Sgn({number})
Replace: PB_SGN({number})

# End Search

# math.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.5 on 2/3/2014 6:22:47 PM
# Comment: Converts math-related code from PowerBASIC to C++

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: False
Exclude: False
Comment: Converts math-related code from PowerBASIC to C++
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Comment: ^ (power)
Pass: 1

Criteria: 2
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 3
Enabled: True
BackColor: Gold
Precedence: 100
Find: {x} ^ {y}  {@Note: precedence property set to 100}
Replace: pow({x}, {y})

Criteria: 4
Comment: Bitwise AND and OR
Pass: 2

Criteria: 5
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 6
Enabled: True
Comment: Bitwise AND and OR
BackColor: YellowGreen
Find: ({expr})
Replace: ({@Eval: Replace(Replace('{expr}', "And", "&"), "Or", "|")})

Criteria: 7
Comment: Everything else
Pass: 3

Criteria: 8
Enabled: True
Find: {@Start}
      {@Note:
         ToDo:  \ exp10 frac sgn shift
               eqv imp bin hex oct Not
               and fix LCase for next version
      }
Replace: #include <math.h>
         #include <stdlib.h>
         {@Note: rand & srand are in stdlib.h}

Criteria: 9
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 10
Enabled: False
Find: {func: Abs|Sin|Cos|Tan|Exp|Exp2|Log|Log2|Log10|Ceil}
Replace: {@Evaluate: LCase({func})}

Criteria: 11
Enabled: True
Find: Mod
Replace: %

Criteria: 12
Enabled: True
BackColor: Yellow
Find: Atn
Replace: atan

Criteria: 13
Enabled: True
BackColor: Lime
Find: Sqr
Replace: sqrt

Criteria: 14
Enabled: True
BackColor: Brown
Find: Fix
Replace: trunc

Criteria: 15
Enabled: True
BackColor: Pink
Find: Cint
Replace: lround

Criteria: 16
Enabled: True
BackColor: Red
Find: Incr {var:1}
Replace: {var}++

Criteria: 17
Enabled: True
BackColor: RoyalBlue
Find: Decr {var:1}
Replace: {var}--

Criteria: 18
Enabled: True
Comment: Logical (short-circuit) AND
Find: And
Replace: &&

Criteria: 19
Enabled: True
Comment: Logical (short-circuit) OR
BackColor: Purple
Find: Or
Replace: ||

Criteria: 20
Enabled: True
BackColor: Khaki
Find: Xor
Replace: ^

Criteria: 21
Enabled: True
BackColor: Green
Find: Not
Replace: ~

Criteria: 22
Enabled: True
SkipOver: True
Find: #{metastatement:1} Not
Replace: [Skip over]

Criteria: 23
Enabled: True
BackColor: Silver
Find: IsTrue {x}
Replace: ({x} <> 0)

Criteria: 24
Enabled: True
BackColor: SandyBrown
Find: IsFalse {x}
Replace: !{x}

Criteria: 25
Enabled: True
BackColor: Violet
Find: <>
Replace: !=

Criteria: 26
Enabled: True
Find: Randomize {number}
Replace: srand({number})

Criteria: 27
Enabled: True
Find: Rnd[()]
Replace: (rand() / RAND_MAX)

Criteria: 28
Enabled: True
Find: Rnd({a}, {b})
Replace: (rand() % ({b}) + ({a}))

Criteria: 29
Enabled: True
Find: Shift Right {ivar}, {countexpr}
Replace: {ivar} = ({ivar} >> {countexpr})

Criteria: 30
Enabled: True
Selected: True
Find: Shift Left {ivar}, {countexpr}
Replace: {ivar} = ({ivar} << {countexpr})

# End Search


Update print.uc

Update print.uc

# print.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.95 on 4/11/2014 3:00:18 PM
# Comment:

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment:
Selected: False
Highlight: False
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Highlight: True
BackColor: Yellow
PassOnce: False
Find:
Replace: {@Token:: : ~~ Properties: ucStatementSep }
         {@Token:: [\x27_].* ~~ Properties: ucWhiteSpace}

Criteria: 2
Comment:
Pass: 1

Criteria: 3
BackColor: Purple
Find: Print
Replace: cout <<

Criteria: 4
PassOnce: False
Find: Print ,
Replace: Print "",

Criteria: 5
BackColor: Green
PassOnce: False
Find: Print {etc},,
Replace: Print {etc}, "",

Criteria: 6
Comment: Add ENDL to lines that need it
Pass: 2

Criteria: 7
Selected: True
Highlight: True
BackColor: DarkKhaki
Find: cout << [{data}]
Replace: cout << {data} << endl;

Criteria: 8
Highlight: True
BackColor: DeepSkyBlue
Find: cout << [{data}] {punc: ; | , }{end: {nl} | : }
Replace: cout << {data} {punc}{end}

Criteria: 9
Comment:
Pass: 3

Criteria: 10
Highlight: True
BackColor: Lime
PassOnce: False
Find: cout << {data}, [{more}]
Replace: cout << PZONE << {data}{more: : cout << {more}}

Criteria: 11
BackColor: SlateBlue
PassOnce: False
Find: cout << {data}; [{more}]
Replace: cout << {data}{more: : cout << {more}}

Criteria: 12
Comment: Clean up
Pass: 4

Criteria: 13
Highlight: True
BackColor: RoyalBlue
PassOnce: False
Find: << <<
Replace: <<

Criteria: 14
BackColor: SlateBlue
PassOnce: False
Find: cout << {data} : cout <<
Replace: cout << {data} <<

# End Search

# print.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.95 on 4/10/2014 5:25:00 PM
# Comment:

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment:
Selected: False
Highlight: False
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Highlight: True
BackColor: Yellow
PassOnce: False
Find:
Replace: {@Token:: : ~~ Properties: ucStatementSep }
         {@Token:: [\x27\_].* ~~ Properties: ucWhiteSpace}

Criteria: 2
Comment:
Pass: 1

Criteria: 3
BackColor: Purple
Find: Print
Replace: cout <<

Criteria: 4
PassOnce: False
Find: Print ,
Replace: Print "",

Criteria: 5
BackColor: Green
PassOnce: False
Find: Print {etc},,
Replace: Print {etc}, "",

Criteria: 6
Comment: Add ENDL to lines that need it
Pass: 2

Criteria: 7
Highlight: True
BackColor: DarkKhaki
Find: cout << [{data}]
Replace: cout << {data} << endl

Criteria: 8
Highlight: True
BackColor: DeepSkyBlue
Find: cout << [{data}] {punc: ; | , }{end: {nl} | : }
Replace: cout << {data} {punc}{end}

Criteria: 9
Comment:
Pass: 3

Criteria: 10
Highlight: True
BackColor: Lime
PassOnce: False
Find: cout << {data}, [{more}]
Replace: cout << PZONE << {data}{more: : cout << {more}}

Criteria: 11
BackColor: SlateBlue
PassOnce: False
Find: cout << {data}; [{more}]
Replace: cout << {data}{more: : cout << {more}}

Criteria: 12
Comment: Clean up
Pass: 4

Criteria: 13
Highlight: True
BackColor: RoyalBlue
PassOnce: False
Find: << <<
Replace: <<

Criteria: 14
Selected: True
BackColor: SlateBlue
PassOnce: False
Find: cout << {data} : cout <<
Replace: cout << {data} <<

# End Search