| View previous topic :: View next topic |
| Author |
Message |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Sat Jun 23, 2012 5:39 pm Post subject: |
|
|
| wat
|
|
| Back to top |
|
 |
bfsdbsdfbdsfb Grandmaster Cheater
Reputation: 54
Joined: 06 Sep 2007 Posts: 702 Location: Oh noez.
|
Posted: Sat Jun 23, 2012 5:40 pm Post subject: |
|
|
uh I don't know anything about c++ but shouldn't you just use if then else statements?
_________________
bsdfbdsfb |
|
| Back to top |
|
 |
bfsdbsdfbdsfb Grandmaster Cheater
Reputation: 54
Joined: 06 Sep 2007 Posts: 702 Location: Oh noez.
|
Posted: Sat Jun 23, 2012 5:41 pm Post subject: |
|
|
| akaecius wrote: | | uh I don't know anything about c++ but shouldn't you just use if then else statements? |
_________________
bsdfbdsfb |
|
| Back to top |
|
 |
NotReallySureWhatGoesHere Expert Cheater
Reputation: -1
Joined: 20 Feb 2012 Posts: 110
|
|
| Back to top |
|
 |
bfsdbsdfbdsfb Grandmaster Cheater
Reputation: 54
Joined: 06 Sep 2007 Posts: 702 Location: Oh noez.
|
Posted: Sat Jun 23, 2012 5:42 pm Post subject: |
|
|
| Shrooms wrote: | | akaecius wrote: | | akaecius wrote: | | uh I don't know anything about c++ but shouldn't you just use if then else statements? |
|
you realize how huge the if statement would be... |
that's just what I'm guessing you could do. I bet there's some hyper smart function that someone else knows about.
I, however, would just do it like that if I knew how to code.
_________________
bsdfbdsfb |
|
| Back to top |
|
 |
RazZ91 Grandmaster Cheater Supreme
Reputation: 0
Joined: 20 Apr 2007 Posts: 1207 Location: Europe
|
Posted: Sat Jun 23, 2012 5:43 pm Post subject: |
|
|
Why'd you post this in random spam and not in the programming section? o.o
For your question, the answer is 42.
|
|
| Back to top |
|
 |
bfsdbsdfbdsfb Grandmaster Cheater
Reputation: 54
Joined: 06 Sep 2007 Posts: 702 Location: Oh noez.
|
Posted: Sat Jun 23, 2012 5:48 pm Post subject: |
|
|
I have a question though, since, you know, it seems like you care that your code is optimized etc.
why are all your variables(I'm assuming those are variables dwlootkey etc.) why do they all have such long names? That's duuuuum
_________________
bsdfbdsfb |
|
| Back to top |
|
 |
RazZ91 Grandmaster Cheater Supreme
Reputation: 0
Joined: 20 Apr 2007 Posts: 1207 Location: Europe
|
Posted: Sat Jun 23, 2012 5:50 pm Post subject: |
|
|
| Shrooms wrote: | | akaecius wrote: | I have a question though, since, you know, it seems like you care that your code is optimized etc.
why are all your variables(I'm assuming those are variables dwlootkey etc.) why do they all have such long names? That's duuuuum |
who gives a fuck about the names.... |
You seem to do.
|
|
| Back to top |
|
 |
bfsdbsdfbdsfb Grandmaster Cheater
Reputation: 54
Joined: 06 Sep 2007 Posts: 702 Location: Oh noez.
|
Posted: Sat Jun 23, 2012 5:51 pm Post subject: |
|
|
| RazZ91 wrote: | | Shrooms wrote: | | akaecius wrote: | I have a question though, since, you know, it seems like you care that your code is optimized etc.
why are all your variables(I'm assuming those are variables dwlootkey etc.) why do they all have such long names? That's duuuuum |
who gives a fuck about the names.... |
You seem to do. |
well you seem to like to lessen your work load so when you're writing down your text I'm assuming you'd like to write the least amount possible, which is then again why I'm asking as to why your variable names are so long.
_________________
bsdfbdsfb |
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Sat Jun 23, 2012 5:55 pm Post subject: |
|
|
I don't get it...
is this what you want?
| Code: | boolean allSameKeys(DWORD dwLootKey,DWORD dwAttackKey,DWORD dwHealthKey,DWORD dwManaKey,DWORD dwSkill1Key,DWORD dwSkill2Key,DWORD dwSkill3Key){
DWORD test = dwLootKey;
int count = 0;
boolean allsame = false;
if (dwAttackKey == test){
count++;
}
if (dwHealthKey == test){
count++;
}
if (dwManaKey == test){
count++;
}
if (dwSkill1Key == test){
count++;
}
if (dwSkill2Key == test){
count++;
}
if (dwSkill3Key == test){
count++;
}
if (count == 6){
allsame = true;
}
return allsame;
} |
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Jun 23, 2012 6:00 pm Post subject: |
|
|
[code]
Last edited by Noz3001 on Sat Jun 23, 2012 6:05 pm; edited 1 time in total |
|
| Back to top |
|
 |
bfsdbsdfbdsfb Grandmaster Cheater
Reputation: 54
Joined: 06 Sep 2007 Posts: 702 Location: Oh noez.
|
Posted: Sat Jun 23, 2012 6:00 pm Post subject: |
|
|
| gogodr wrote: | I don't get it...
is this what you want?
| Code: | boolean allSameKeys(DWORD dwLootKey,DWORD dwAttackKey,DWORD dwHealthKey,DWORD dwManaKey,DWORD dwSkill1Key,DWORD dwSkill2Key,DWORD dwSkill3Key){
DWORD test = dwLootKey;
int count = 0;
boolean allsame = false;
if (dwAttackKey == test){
count++;
}
if (dwHealthKey == test){
count++;
}
if (dwManaKey == test){
count++;
}
if (dwSkill1Key == test){
count++;
}
if (dwSkill2Key == test){
count++;
}
if (dwSkill3Key == test){
count++;
}
if (count == 6){
allsame = true;
}
return allsame;
} |
|
But what if he wants it to detect if just two of them are the same as well?
He could just do if/then/else and add a bunch of "or"s under the ifs.
_________________
bsdfbdsfb |
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Sat Jun 23, 2012 6:03 pm Post subject: |
|
|
| he said all
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Jun 23, 2012 6:19 pm Post subject: |
|
|
| Code: | DWORD d =
(dwLootKey ^ dwAttackKey)
| (dwHealthKey ^ dwManaKey)
| (dwSkill1Key ^ dwSkill2Key)
| (dwSkill3Key ^ dwLootKey); |
if d != 0, one or more is different. If d == 0, they are all the same.
Right?
|
|
| Back to top |
|
 |
gogodr I post too much
Reputation: 125
Joined: 19 Dec 2006 Posts: 2041
|
Posted: Sat Jun 23, 2012 6:26 pm Post subject: |
|
|
I have no idea with ^
I don't see it in
DWord (word low)
DWord (word low, word high)
DWord & operator+= (word a)
DWord operator+ (word a)
DWord operator- (DWord a)
DWord operator- (word a)
word operator/ (word divisor)
word operator% (word a)
bool operator! () const
word GetLowHalf () const
word GetHighHalf () const
word GetHighHalfAsBorrow () const
is it supposed to be a logic XOR ?
|
|
| Back to top |
|
 |
|