Cleanup
This commit is contained in:
17
hangman.c
17
hangman.c
@@ -34,6 +34,7 @@ int main(int argc, char **argv) {
|
|||||||
initscr();
|
initscr();
|
||||||
atexit(quitProgram);
|
atexit(quitProgram);
|
||||||
game_state *gs;
|
game_state *gs;
|
||||||
|
|
||||||
gs = malloc(sizeof(game_state));
|
gs = malloc(sizeof(game_state));
|
||||||
initCoordinates(gs);
|
initCoordinates(gs);
|
||||||
gs->allowedMoves = DEFAULTTRIES;
|
gs->allowedMoves = DEFAULTTRIES;
|
||||||
@@ -101,7 +102,6 @@ void startGame(game_state *gs) {
|
|||||||
updateScreen(gs);
|
updateScreen(gs);
|
||||||
playerInput(gs);
|
playerInput(gs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,7 +147,6 @@ void initGuessWord(game_state *gs, char *filename) {
|
|||||||
/* Random line from file */
|
/* Random line from file */
|
||||||
readRandomLine(filename, gs->guessWord);
|
readRandomLine(filename, gs->guessWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make String all lowercase */
|
/* Make String all lowercase */
|
||||||
@@ -225,7 +224,6 @@ void drawGuessWord(game_state *gs) {
|
|||||||
}
|
}
|
||||||
gs->wordRows = rows; //set the number of rows for clearing the screen later
|
gs->wordRows = rows; //set the number of rows for clearing the screen later
|
||||||
tempstartpos = xcounter = gs->centerx - (gs->wordLength / rows);
|
tempstartpos = xcounter = gs->centerx - (gs->wordLength / rows);
|
||||||
|
|
||||||
}
|
}
|
||||||
for (i = startpos; i < startpos + (gs->wordLength * 2); i++) {
|
for (i = startpos; i < startpos + (gs->wordLength * 2); i++) {
|
||||||
if (xcounter >= gs->centerx + (gs->wordLength / rows)) {
|
if (xcounter >= gs->centerx + (gs->wordLength / rows)) {
|
||||||
@@ -385,7 +383,6 @@ void readRandomLine(char *file, char *result) {
|
|||||||
/* remove \n at the end of the line */
|
/* remove \n at the end of the line */
|
||||||
wordlength = strlen(result);
|
wordlength = strlen(result);
|
||||||
result[wordlength - 1] = '\0';
|
result[wordlength - 1] = '\0';
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,17 +441,5 @@ void drawFigure(game_state *gs, int drawNext) {
|
|||||||
state++;
|
state++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void lala(void) {
|
|
||||||
int c;
|
|
||||||
if ((c = getch()) == 10) {
|
|
||||||
c *= 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user