rename word files
This commit is contained in:
parent
7679dd9c6c
commit
94de0130bc
20
src/main.c
20
src/main.c
@ -19,30 +19,30 @@ void parse_arguments(int argc, char *argv[], char *filename, char *difficulty) {
|
||||
int i;
|
||||
|
||||
/* Default values */
|
||||
strcpy(filename, "pyrdle_words_easy.txt");
|
||||
strcpy(filename, "cordle_words_easy.txt");
|
||||
strcpy(difficulty, "EASY");
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "--easy") == 0) {
|
||||
strcpy(filename, "pyrdle_words_easy.txt");
|
||||
strcpy(filename, "cordle_words_easy.txt");
|
||||
strcpy(difficulty, "EASY");
|
||||
} else if (strcmp(argv[i], "--medium") == 0) {
|
||||
strcpy(filename, "pyrdle_words_medium.txt");
|
||||
strcpy(filename, "cordle_words_medium.txt");
|
||||
strcpy(difficulty, "MEDIUM");
|
||||
} else if (strcmp(argv[i], "--hard") == 0) {
|
||||
strcpy(filename, "pyrdle_words_hard.txt");
|
||||
strcpy(difficulty, "HARD");
|
||||
} else if (strcmp(argv[i], "--techy") == 0) {
|
||||
strcpy(filename, "pyrdle_words_techy.txt");
|
||||
strcpy(filename, "cordle_words_techy.txt");
|
||||
strcpy(difficulty, "TECHNICAL");
|
||||
} else if (strcmp(argv[i], "--literary") == 0) {
|
||||
strcpy(filename, "pyrdle_words_literary.txt");
|
||||
strcpy(filename, "cordle_words_literary.txt");
|
||||
strcpy(difficulty, "LITERARY");
|
||||
} else if (strcmp(argv[i], "--cultural") == 0) {
|
||||
strcpy(filename, "pyrdle_words_cultural.txt");
|
||||
strcpy(filename, "cordle_words_cultural.txt");
|
||||
strcpy(difficulty, "CULTURAL");
|
||||
} else if (strcmp(argv[i], "--full") == 0) {
|
||||
strcpy(filename, "pyrdle_words_full.txt");
|
||||
strcpy(filename, "cordle_words_full.txt");
|
||||
strcpy(difficulty, "FULL");
|
||||
} else if (strcmp(argv[i], "--wordlist") == 0 && i + 1 < argc) {
|
||||
strcpy(filename, argv[i + 1]);
|
||||
@ -53,7 +53,7 @@ void parse_arguments(int argc, char *argv[], char *filename, char *difficulty) {
|
||||
}
|
||||
|
||||
/* Main game loop */
|
||||
int main_game_loop(int argc, char *argv[]) {
|
||||
int main_game_loop(const int argc, char *argv[]) {
|
||||
WINDOW *stdscr;
|
||||
GameState game;
|
||||
char filename[MAX_FILENAME];
|
||||
@ -87,8 +87,8 @@ int main_game_loop(int argc, char *argv[]) {
|
||||
|
||||
if (!load_words(&game, filename)) {
|
||||
/* Try fallback */
|
||||
if (strcmp(filename, "pyrdle_words.txt") != 0 &&
|
||||
load_words(&game, "pyrdle_words.txt")) {
|
||||
if (strcmp(filename, "cordle_words.txt") != 0 &&
|
||||
load_words(&game, "cordle_words.txt")) {
|
||||
strcpy(difficulty, "DEFAULT");
|
||||
} else {
|
||||
mvaddstr(0, 0, "Error: Could not load word list");
|
||||
|
||||
3
src/ui.c
3
src/ui.c
@ -4,7 +4,6 @@
|
||||
/* ui.c - User interface implementation */
|
||||
#include "../include/ui.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Keyboard layout */
|
||||
static const char *keyboard_rows[3] = {
|
||||
@ -123,7 +122,7 @@ void draw_keyboard(WINDOW *win, GameState *game, int y) {
|
||||
}
|
||||
|
||||
/* Draw centered message */
|
||||
void draw_message(WINDOW *win, const char *message, int y, int color_pair) {
|
||||
void draw_message(WINDOW *win, const char *message, const int y, const int color_pair) {
|
||||
int height, width, x;
|
||||
|
||||
getmaxyx(win, height, width);
|
||||
|
||||
@ -59,14 +59,14 @@ int load_words(GameState *game, const char *filename) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Select random target word */
|
||||
/* Select a random target word */
|
||||
srand((unsigned int) time(NULL));
|
||||
strcpy(game->target_word, game->words[rand() % game->word_count]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Check if word exists in word list */
|
||||
/* Check if word exists in a word list */
|
||||
int is_valid_word(GameState *game, const char *word) {
|
||||
int i;
|
||||
char upper_word[WORD_LENGTH + 1];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user