Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Whryy doesnt my code worked :'(

Name: Anonymous 2006-06-01 15:46

                    k = board[x-1][y];
                    if (((k&16384) == 0) && (((ang+512)&1024) > 0))
                    {
                        if (((k&1023) == door1) || ((k&1023) == door1+5))
                        {
                            doorx = x-1, doory = y, doorstat = door1;
                            if ((posx&1023) < 256)
                                posx = (posx&0xfc00)+256;
                        }
                        if (((k&1023) == door2) || ((k&1023) == door2+5))
                        {
                            doorx = x-1, doory = y, doorstat = door2;
                            if ((posx&1023) < 256)
                                posx = (posx&0xfc00)+256;
                        }
                        if (((k&1023) == door3) || ((k&1023) == door3+7))
                        {
                            doorx = x-1, doory = y, doorstat = door3;
                            if ((posx&1023) < 256)
                                posx = (posx&0xfc00)+256;
                        }
                        if ((((k&1023) == door4) && (coins >= 10)) || ((k&1023) == door4+6))
                        {
                            doorx = x-1, doory = y, doorstat = door4;
                            if ((posx&1023) < 256)
                                posx = (posx&0xfc00)+256;
                        }
                        if (((k&1023) == door5) || ((k&1023) == door5+7))
                        {
                            doorx = x-1, doory = y, doorstat = door5;
                            if ((posx&1023) < 256)
                                posx = (posx&0xfc00)+256;
                        }
                    }

fap fap fap

(http://www.advsys.net/ken/klab/labflsrc.zip ;) )

Name: Anonymous 2006-06-01 20:59

You like magic numbers waaaaay too much. Replace all that gibberish with some #define symbols.

Also, most of the code in >>1 is redundant. All those deepest if statements should be moved to a seperate function. You could make it half the size while being just as readable, easy.

Lastly, "if (((k&16384) == 0) && (((ang+512)&1024) > 0))" is needlessly verbose. This works exactly the same: "if (k&16384 && !(ang+512&1024)"

For >>2, you really ought to use getopt().

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List