MCGalaxy icon indicating copy to clipboard operation
MCGalaxy copied to clipboard

Plugin: Run time VS Compile time variant issue

Open rdebath opened this issue 2 years ago • 3 comments

If I have a plugin that looks at the value Block.MaxRaw it uses the value that existed when the Plugin was compiled. NOT the value that the variable has now. (Also applies to Block.ExtendedCount)

This happens if the plugin is compiled without TEN_BIT_BLOCKS set but is attached to a server with it set (or vs. versa).

Doh: Make it "readonly" not "const".

Can you add a function to return this value as it is now and (probably) make the existing constant internal.

You might consider renaming the existing constant so existing Plugins like NA2's CmdMake only need a recompile not a code change.

rdebath avatar Mar 01 '22 10:03 rdebath

It's intentionally const so that internal code that uses it performs slightly faster, it wasn't really intended for external code

UnknownShadow200 avatar Mar 01 '22 13:03 UnknownShadow200

I suspect the theoretical speed difference is not distinguishable, but that's fine, my crossed out suggestion would apply. But likely with a readonly variable instead of a function.

rdebath avatar Mar 02 '22 07:03 rdebath

I changed internal constant to a different name and changed ExtendedCount to readonly (same thing will be done to MaxRaw eventually)

UnknownShadow200 avatar Mar 06 '22 13:03 UnknownShadow200