I'm making a chess game to learn a bit more about C++. When a player tries to make a move it gets validated. My validation was not working tho so I had a play around with the code to try an figure out what was going wrong. Heres a snippet from a validation function:
What I don't get here is that the first printf statment prints the character 't' when I move a knight, but the stuff in the second printf statment does not get displayed even though the variable t=='t'. Anyone know why this would be?Code:bool piece::CheckMove(int sx, int sy, int ex, int ey, char t) { printf("%c", t); if(t=='k') if(RookMove(sx, sy, ex, ey)==true)return true; else if(t=='t') printf("hdeghsdav");//if(KnightMove(sx, sy, ex, ey)==true)return true; else if(t=='s') if(BishopMove(sx, sy, ex, ey)==true)return true; else if(t==6) if(QueenMove(sx, sy, ex, ey)==true)return true; else if(t==5) if(KingMove(sx, sy, ex, ey)==true)return true; else if(t=='n') if(PawnMove(sx, sy, ex, ey)==true)return true; }



LinkBack URL
About LinkBacks


