From: "John Bodfish" Newsgroups: comp.os.msdos.djgpp Subject: Re: Bit-wise compare Date: 22 Jul 1997 15:32:41 GMT Organization: Ameritech Library Services Lines: 22 Message-ID: <01bc96b4$02a86000$dfcde7c0@JOHNB.als.ameritech.com> References: <33D36DA3 DOT 7EB2 AT lr DOT net> NNTP-Posting-Host: n5223.als.ameritech.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Isaac Waldron wrote in article <33D36DA3 DOT 7EB2 AT lr DOT net>... > I am working on an RPG computer game, and I was wondering if it is > possible to do the following: Yes it's possible, and you're almost there. Your problem is a common one: confusion of logical AND/OR (&&/||) operators with bitwise AND/OR (&/|). Make these changes to your program: [snip] > int has_item(int a, int b) > { > if (a & b) // Changed '&&' to '&' [snip] > a = a | WEAPON_SWORD_1; // Changed '||' to '|' > b = b | WEAPON_SWORD_2; // Changed '||' to '|' That should do it. -- John Bodfish bodfish AT als DOT ameritech DOT com