Raised This Month: $ Target: $400
 0% 

Adding, removing, checking bitsums


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-27-2007 , 21:28   Re: Adding, removing, checking bitsums
Reply With Quote #2

Quote:
Originally Posted by Cheap_Suit View Post
I was just wondering if I did this the correct way.

PHP Code:
#define FLAG_A (1<<0)
#define FLAG_B (1<<1)
#define FLAG_B (1<<2)
 
stock get_player_flags(idflags)
 return (
g_user_flags[id] & flags)
 
stock set_player_flags(idflags)
 return 
g_user_flags[id] |= flags
 
// add
set_player_flags(idFLAG_A)
 
// remove
set_player_flags(id, ~FLAG_B)
 
// check
if(!get_player_flags(idFLAG_C))
  return 
Sorry i don't know anything about bitsum stuff the only flaw is a typo because you define 2 times FLAG_B
But it looks correct..0o

greetz regalis
__________________
regalis 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 10:41.


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