4 ms·
bool is_alive(const Entity* unit) { return unit->hp > ZERO_FLOAT; } Super easy… Likewise I’m with you, the more I code, the more I see these kinds of th
by gabereiser 4y ago
bool is_alive(const Entity* unit) {
return unit->hp > ZERO_FLOAT;
}
Super easy…
Likewise I’m with you, the more I code, the more I see these kinds of things as bad design choices. If you’re going to deal with a type, keep it that type. If you’re going to convert, you need to take care of edge cases like OP. And don’t just add 0.0001f; that’s an exploit waiting to happen by someone with a macro to pickup/drop relics.