Add Object:IsClassNative to check whether a class is native#764
Add Object:IsClassNative to check whether a class is native#764robojumper merged 3 commits intoX2CommunityCore:masterfrom
Object:IsClassNative to check whether a class is native#764Conversation
|
Why not check |
|
I'm conflicted. On one hand, it's more "magic" and can clash with the mental model where objects and their classes are entirely separate things (see #477 (comment), where I got confused about this) and introduces an inconsistency with other functions in On the other hand, the only kinds of Perhaps a final static function bool ClassIsNative(Class klass)
{
// This is the flag the UC VM uses to mark a class as native
return (klass.ObjectFlags.B & (1 << 26)) != 0;
}would be better? |
|
Yeah, |
|
Assume that's "as well as", so you call IsNative() or IsClassNative() depending what you're dealing with? |
|
No, a static function |
8a7e2bf to
3582f03
Compare
3582f03 to
ff08624
Compare
Object:IsNative to check whether a class is nativeObject:IsClassNative to check whether a class is native
|
What about #765? |
Xymanek
left a comment
There was a problem hiding this comment.
Please adjust the version info/check, now that the new approach is implemented
ff08624 to
85afd3f
Compare
|
Fixed. I hope. |
X2WOTCCommunityHighlander/Src/X2WOTCCommunityHighlander/Classes/X2WOTCCH_Components.uc
Outdated
Show resolved
Hide resolved
X2WOTCCommunityHighlander/Src/X2WOTCCommunityHighlander/Classes/X2WOTCCH_Components.uc
Outdated
Show resolved
Hide resolved
| 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); | ||
| } |
There was a problem hiding this comment.
Isn't this backwards incompatible? Since someone might be checking the engine version already
There was a problem hiding this comment.
Technically yes, but the only Engine feature we have is the AudioComponent WWise/SoundCue fix which I don't think anyone ever queried for.
There was a problem hiding this comment.
I don't think anyone ever
So far this kind of thought was allowed only in extreme cases, particularly related to new features
X2WOTCCommunityHighlander/Src/X2WOTCCommunityHighlander/Classes/X2WOTCCH_Components.uc
Show resolved
Hide resolved
|
Also, the matter of name collision still remains. I think naming the function Also 2: Shouldn't |
85afd3f to
f623fc1
Compare
|
Addressed. I would still like to get rid of the Engine template because it's not useful and there is no mod that ever checked that Engine version (it only contained a single bugfix). |
X2WOTCCommunityHighlander/Src/X2WOTCCommunityHighlander/Classes/X2WOTCCH_Components.uc
Outdated
Show resolved
Hide resolved
|
I mean, if you are so sure that no one ever checked the engine template, then I guess go ahead.... |
f623fc1 to
ddb23d2
Compare
ddb23d2 to
c8b1fda
Compare
In which we work our way into the innards of the UnrealScript virtual machine. Closes #767.
Original description below, see comments for current design:
Click to expand
You may call
<SomeObject>.class.IsNative()to determine whether the class is native, or, if you are working with aclass<_>already, skip the.classpart.Because I am a skeptical person and you should be too, here is a debug output that makes this implementation appear correct (interestingly enough,
GetClassDefaultObjectsyields objects for native classes first):https://pastebin.com/acG9Jc0a
This may come in useful for #762.