Anonymous Login
2018-04-19 23:17 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001854OpenClonkEngine - C4Scriptpublic2017-04-25 08:57
Assigned ToClonkonaut 
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




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, ...);


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.


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.


Marky (developer)

Yes, the warning is a good idea!


Marky (developer)

This can be closed then, right?


Clonkonaut (developer)


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