As discussed in bugs-and-issues on the BYONDiscord, Kapu's project had a weird issue where bodypart_flags = parent_type::bodypart_flags would compile for some types and not others. bodypart_flags is just a var treated like a bitfield using defines.
Some reason a proc implementation for get_offset is altering whether the compiler thinks that the above code is no longer a constant expression. I have renamed it to blargfish and the error still occurs.
Numbered Steps to Reproduce Problem:
Code Snippet (if applicable) to Reproduce Problem:
/world
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default
view = 6 // show up to 6 tiles outward from center (13x13 view)
#define NONE 0
#define BP_BLEEDING (1<<0)
#define BP_HAS_BLOOD (1<<1)
#define BP_HAS_BONES (1<<2)
/obj/item/bodypart
var/bodypart_flags = NONE
/obj/item/bodypart/proc/blargfish() // Comment out for workaround
return
/obj/item/bodypart/arm/left/abductor
//parent_type = /obj/item/bodypart/arm/left // Uncomment for workaround
bodypart_flags = parent_type::bodypart_flags & ~BP_HAS_BLOOD
/obj/item/bodypart/arm/right/abductor
//parent_type = /obj/item/bodypart/arm/right // Uncomment for workaround
bodypart_flags = parent_type::bodypart_flags & ~BP_HAS_BLOOD
/obj/item/bodypart/chest
bodypart_flags = (BP_HAS_BLOOD | BP_HAS_BONES)
/obj/item/bodypart/arm
bodypart_flags = (BP_HAS_BLOOD | BP_HAS_BONES) // Comment out for workaround
/obj/item/bodypart/leg
bodypart_flags = (BP_HAS_BLOOD | BP_HAS_BONES) // Comment out for workaround
Expected Results:
To compile using the :: operator and a proc named get_offset (or blargfish)
Actual Results:
: expected a constant expression
Does the problem occur:
Every time? Or how often?
Every time.
In other games?
Yes
In other user accounts?
Yes
On other computers?
Yes
When does the problem NOT occur?
See workarounds.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
N/A requires 515. Did not test on earlier versions of 515.
Workarounds:
- Remove the proc implementation for above
- Specify the parent_type before using parent_type::
- Do not override a var in an intermediary child if the deepest child will be using parent_type::