ClassiCube / MCGalaxy

A Minecraft Classic / ClassiCube server software
GNU General Public License v3.0
168 stars 79 forks source link

Plugin: Run time VS Compile time variant issue #689

Open rdebath opened 2 years ago

rdebath commented 2 years ago

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.

UnknownShadow200 commented 2 years ago

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

rdebath commented 2 years ago

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.

UnknownShadow200 commented 2 years ago

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