Anonymous Login
2017-07-28 08:36 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001854OpenClonkEngine - C4Scriptpublic2017-04-25 10:57
ReporterMarky 
Assigned ToClonkonaut 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformWindows 7 64-bitOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001854: The "..." parameter does not work in _inherited(...) functions
DescriptionThe call _inherited(...); seems not to pass all parameters to the inherited functions (but rather "nil" for all parameters).

Here is what I did: In System.ocg of a custom scenario I added a script that appends to Library_HUDAdapter:


protected func OnEnergyChange(int change, int cause, int caused_by)
{
    Log("OnEnergyChange: %d %d %d", change, cause, caused_by);
    return _inherited(...);
}

When calling "DoEnergy(-2)" on a clonk the function did always log "OnEnergyChange: 0 0 0", until I replaced the _inherited(...); with _inherited(change, cause, caused_by, ...); in all occurrences of "OnEnergyChange".
This may be a serious error because usually functions rely on the parameters being passed correctly.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0005500

Zapper (developer)

"..." is not supposed to pass all parameters.
It just passes the unnamed ones.

In your case, you would have to write inherited(change, cause, caused_by, ...);

~0005501

Marky (developer)

Ok, but then the scripts of the whole game are seriously broken. All occurrences of "OnEnergyChange" call _inherited(...) - and so many other functions do that, too.

~0005502

Sven2 (developer)

Maybe we should warn if ... is used at a different index between parameters and an inherited call. Usually, the function signature does not change between overloads.

~0005503

Marky (developer)

Yes, the warning is a good idea!

~0005662

Marky (developer)

This can be closed then, right?

~0005663

Clonkonaut (developer)

Ok.
+Notes

-Issue History
Date Modified Username Field Change
2016-11-25 21:21 Marky New Issue
2016-11-25 21:32 Zapper Note Added: 0005500
2016-11-25 21:41 Marky Note Added: 0005501
2016-11-26 07:30 Sven2 Note Added: 0005502
2016-11-26 08:56 Marky Note Added: 0005503
2017-04-24 15:12 Marky Note Added: 0005662
2017-04-25 10:57 Clonkonaut Assigned To => Clonkonaut
2017-04-25 10:57 Clonkonaut Status new => closed
2017-04-25 10:57 Clonkonaut Resolution open => no change required
2017-04-25 10:57 Clonkonaut Note Added: 0005663
+Issue History