Boost enable_if works differently from std::enable_if, so the build is
broken when using Boost.TypeTraits. The broken code has been present
for a long time and no one reported it. Remove the fallback to Boost.
Previously, if the player was invulnerable, it was impossible to grab an
invulnerability powerup. Relax this by allowing a spawn-induced fake
invulnerability not to count as invulnerable for this test. Players
still cannot grab an invulnerability powerup if they are still under the
influence of a prior invulnerability powerup.
An optimizing compiler should inline these tests. Moving them out makes
the code easier to read, since the statements can focus on what is
updated, rather than how it is done.
Change the clearing of MultiLevelInv during initialization to reduce
wasted stores. MultiLevelInv has three fields.
Field ::Initial is not accessed by MultiLevelInv_CountLevelPowerups, and
is overwritten immediately afterward, so it does not need to be cleared
first.
Field ::Current is unconditionally cleared by
MultiLevelInv_CountLevelPowerups, so it does not need to be cleared
first.
Field ::RespawnTimer is not accessed by
MultiLevelInv_CountLevelPowerups, but needs to be cleared. Add a clear
of field .RespawnTimer and remove the clear of the entire structure.
All callers of MultiLevelInv_Count passed a constant value. Factor
out the top level blocks of MultiLevelInv_Count into helper functions,
then create two new functions corresponding to MultiLevelInv_Count(0)
and MultiLevelInv_Count(1), implemented by calling the appropriate new
helper functions.