action.cpp and actions.cpp code cleanup:
Use pre- instead of postfix increment.
Declaration and assignment of variables in one line.
Merged if condition checks.
Removed redundant brackets.
Added and removed newlines.
Fixed indentation.
Approved by PS Jenkins bot, Sam Spilsbury.