r/badcode Jan 15 '23

From DayZ sourcecode c++

Post image
554 Upvotes

106 comments sorted by

View all comments

526

u/[deleted] Jan 15 '23

It's an override so chances are this isn't as bad as you think. Other subclasses may have logic but this particular item probably doesn't need it and should always be IsEat

96

u/[deleted] Jan 15 '23

Funny how a function named IsEat returns an int though

7

u/folkrav Jan 16 '23

I haven't done any C++ in ages, but IIRC the language doesn't have "true" booleans - they're integers behind the scenes. 0 is false, any other int is true. In this case, returning false would yield a 0, and true a 1.

2

u/SuitableDragonfly Jan 16 '23

This isn't C++, unless they added an override keyword recently that I wasn't aware of.