Raised This Month: $ Target: $400
 0% 

Variables


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 05-09-2012 , 19:40   Re: Variables
Reply With Quote #7

If you didn't want to create an array you could try something like

new max = max(szNoScope, max(szNormal, max(szGravity, szVip)));
if (szNoScope == max) {
} else if (szNormal == max) {
} else if (szGravity == max) {
} else { // implied that szVip is max
}

Which I think would be the simplest for you to implement. The only problem with this method (and the array method) is that this will only tell you the first one that equals max, so to get more then one equaling max, just make them each their own if-statement.


As a side note, don't use hungarian notation in a type-less language if you don't understand how it works. It's really annoying when it's super important to understand your code.
http://en.wikipedia.org/wiki/Hungarian_notation
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]

Last edited by Tirant; 05-09-2012 at 19:45.
Tirant is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode