Trying to shorting a bit of code

Hi, I'm quite new at this stuff but what I'm trying to do is shorting this as I'm going to have to do it for 24 different letters(variables) and I can see already how lengthy this is going to be.

I basically want my player to pick up a thing then drop it somewhere else (which works) but I don't want to be able to pick up 2 items at the one time so I'v set the items to a = true, then a = false once I have picked it up, then back to true when I've dropped it.

            if((a == b) && (a == c) && (b = c) && (a != true) && (b != true) && (c != true))

This is for my 2nd game(1st was a pong clone) in c++/SDL I'm trying to make and I'm about 800+ lines of code into it now :-S

Any help would be much appreciated, Thanks.
> for 24 different letters(variables)
Consider an array.
Or a bitset
I don't understand the code, and how it relates to the picking-up and dropping of objects.
There is an error, (b = c) is an assignment, it assigns the value of c to the variable b.

In any case, if ((a == b) && (a == c)) then it is implied that b must be equal to c, it isn't necessary to test it.

There may be similar implications for the test for something != true too.

Still, I'd agree that an array may be a sensible approach. Maybe even a string, where you can test for the presence of absence of a specific letter or letters, may allow for simplification - but more information would be needed about the requirements to see whether that makes sense.
Topic archived. No new replies allowed.