diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 340855f..95e958a 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -30,6 +30,11 @@ void readWordsFromLine(char buffer[], int* wordCount, char words[][MAX_WORD_LEN] // Read words from file and store in 'words' array int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { + for (int i = 0; i < maxWordCount; i++) { + for (int j = 0; j < MAX_WORD_LEN; j++) { + words[i][j] = '\0'; + } + } char buffer[MAX_LINE_LEN]; // prepares a large enough buffer to read one line from the .txt-file int readwords = 0; int *wordCount = &readwords; diff --git a/Start_Windows/main.c b/Start_Windows/main.c index e0255b2..82eee79 100644 --- a/Start_Windows/main.c +++ b/Start_Windows/main.c @@ -35,12 +35,15 @@ int main(int argc, char *argv[]) // Create the word salad by placing words into grid placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount); + printf("Checkpoint1"); // TODO: // Check if all words were successfully placed // Start the game if successful // error message if some words couldn't be placed + int windowWidth = 720; //Fensterbreite outputfenster if (placedWords == wordCount && placedWords <= MAX_NUMBER_OF_WORDS) { + startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, wordCount, windowWidth); exitCode = EXIT_SUCCESS; //Start the game if placed words is equal to words in textfile } else {