@Warboy, or any other openXcom dev:
I've seen the code for the reaction fire (code dwonloaded not longer than 3 days ago), and I think, that this isn't exactly what it was like in the original, and perhaps what is written here isn't what the author had in mind.
while (true)
{
if (!tryReactionSnap(reactor, unit))
break;
reactor = getReactor(spotters, unit);
result = true;
if (reactor == unit)
break;
}
The reaciton fire routines finish in two cases:
1) the best "reactor" was unable to fire.
2) all reactors have worse reflexes than the spotted unit.
Only The second case is corresponding to the original implementation. The whole round of checking reaction fire is finished if and only if the spotted unit has the greatest reaction score.
In your algorithm it's either this, or a situation where the shooter fails to shoot the reaction snap, which is fully dependant on what this condition gets evaluated to ( true or false )
if (action.weapon && action.weapon->getAmmoItem() && action.weapon->getAmmoItem()->getAmmoQuantity() && unit->getTimeUnits() >= action.TU)
(the first check btw isn't necessarry and just creates noise - you are using the action.weapon pointer 4 statemnes earlier)
Not knowing your internal architecture with details I cannot say when would the getAmmoItem() return a null pointer, but the rest of the condition tells us, that this returns false when a unit has not enough time units for its action OR the currently considered reactionist is out of ammo.
This in turn means, that if I have sick reactions ( like for example Point Man from FEAR series ), and have exactly one time unit less than I need to fire a time consuming fire action, then none of my buddies will fire.
This makes many situations where good reacionists are stomped by that break invoked because a better reaction guy was unable to perform a shot for whatever reason ( other than problems with line of fire, because this is not checked in the tryReactionSnap as far as I've seen ).
I hope this will help you improve the code and functionality of the product.
Regards,
djemon_lda