diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 13a99c8..bfd9bec 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -25,7 +25,7 @@ static void trim_and_toupper(char*dest, const char*src, int max_len) { int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { unsigned int count = 0; char line_buffer[MAX_LINE_LEN]; - const char* DELIMITERS=",:\n"; + const char* DELIMITERS=",:\n;"; while (count < maxWordCount && fgets(line_buffer, MAX_LINE_LEN, file)!= NULL) { char* token = strtok(line_buffer, DELIMITERS); diff --git a/Start_Windows/main.c b/Start_Windows/main.c index e125bdb..3873bb6 100644 --- a/Start_Windows/main.c +++ b/Start_Windows/main.c @@ -5,7 +5,7 @@ #include "game.h" #include "graphicalGame.h" -#define MAX_NUMBER_OF_WORDS 100 +#define MAX_NUMBER_OF_WORDS 15 #define SALAD_SIZE 20 #define WINDOW_WIDTH 800 @@ -25,13 +25,13 @@ int main(int argc, char *argv[]) { wordCount = readWords(file, words, MAX_NUMBER_OF_WORDS); fclose(file); placedWords = createWordSalad(wordSalad, SALAD_SIZE, (const char(*)[MAX_WORD_LEN])words, wordCount); - if (placedWords == wordCount) { + if (placedWords > 0) { printf("Info: %d Wörter geladen und platziert. Starte speil...\n", placedWords); showWordSalad(wordSalad, SALAD_SIZE); startGame(wordSalad, SALAD_SIZE, words, wordCount,WINDOW_WIDTH); printf("Spielbeendet.\n"); } else { - fprintf(stderr, "Fehler: Es konnten nur %d von %d Wörtern platziert werden.\n", placedWords, wordCount, wordCount); + fprintf(stderr, "Fehler: Es konnten nur %d von %d Wörtern platziert werden.\n", placedWords, wordCount); fprintf(stderr, "Das Spiel ist evtl. zu klein.\n"); exitCode = EXIT_FAILURE; } diff --git a/Start_Windows/words.txt b/Start_Windows/words.txt index 31ee099..f65067d 100644 --- a/Start_Windows/words.txt +++ b/Start_Windows/words.txt @@ -1,4 +1,4 @@ -Yeti,Nessie Werwolf; Vampir +Yeti,Nessie,Werwolf; Vampir Monster Hydra;Frankenstein Dracula;KingKong;Gremlin;Kobold,Hexe;Poltergeist