I have this function from my final project (a game) and it's supposed to call another function if the condition is true, sometimes my program will call capturePlayer()
and some times it won't. I don't know why does this happens and I know the condition it's true because of the printf's
I put in there. BTW I'm using graphics.h
and pages for the game and when the program don't call the function the it won't even change the page and tell you that you won (which happens even before the condition). Thanks for your help.
void youWin(int score)
{
char name[15], Score[5];
int ret;
points records[RP];
setactivepage(0);
setcolor(GREEN);
settextstyle(GOTHIC_FONT, HORIZ_DIR, 10);
setbkcolor(BLACK);
cleardevice();
outtextxy(640-textwidth("YOU WIN!")/2, 360-textheight("YOU WIN!")/2, "YOU WIN!");
delay(1000);
sprintf(Score, "%d", score);
readRecords(records);
ret = strcmp(Score, records[4].score);
if(ret > 0)
{
strcpy(records[4].score, Score);
printf("About to capture.");
cleardevice();
setactivepage(0);
capturePlayer(name, Score, records);
}
}