View Single Post
nosoop
Veteran Member
Join Date: Aug 2014
Old 02-16-2019 , 15:07   Re: How to return multiple values and apply conditionals for all possible combination
Reply With Quote #7

You can save an indentation level by stripping the surrounding else { /* ... */ } nesting since you're returning from the function early anyways.

There's also the possibility of or-ing the UpgdChoiceBitVec and !bHasAmmoUpgrd result together, and storing the result of UpgdChoiceBitVec may help with readability so it's less characters to read.

Since all the decision making just determines if SelectUpgrd(client, bIsVip); is called or not, you could reduce it down to a couple of boolean variables to check against (even down to a single one if you want to sacrifice readability).

I wouldn't worry about it too much as long as the code works; you'll pick up these things as you learn.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline