einfach nur kosmetische Änderungen

This commit is contained in:
Elena Riedmann 2026-03-30 18:42:57 +02:00
parent 42739dc5cc
commit 36c61ff8e7
2 changed files with 11 additions and 8 deletions

View File

@ -34,9 +34,9 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
char *word = readWord(file);
if(word != NULL)
{
strncpy(words[count], word, MAX_WORD_LEN - 1); // Wort in Array kopieren
words[count][MAX_WORD_LEN - 1] = '\0'; // Sicherstellen, dass String nullterminiert ist
free(word); // Dynamisch allokierten Speicher freigeben
strncpy(words[count], word, MAX_WORD_LEN - 1); // Wort in Array kopieren
words[count][MAX_WORD_LEN - 1] = '\0'; // Sicherstellen, dass String nullterminiert ist
free(word); // Dynamisch allokierten Speicher freigeben
count++;
}
}

View File

@ -31,10 +31,13 @@ int main(int argc, char *argv[])
// Read words from file and store in 'words' array
wordCount = readWords(file, words, MAX_NUMBER_OF_WORDS);
fclose(file); // TODO:
// Check if all words were successfully placed
// Start the game if successful
// error message if some words couldn't be placed
fclose(file);
// TODO:
// Check if all words were successfully placed
// Start the game if successful
// error message if some words couldn't be placed
// Create the word salad by placing words into grid
@ -42,7 +45,7 @@ int main(int argc, char *argv[])
if(placedWords==wordCount)
{
// Start the graphical game with the created word salad and the list of words
// Spiel starten, mit dem erstellten wordSalad, der Anzahl der Wörter und der Liste der Wörter
startGame(wordSalad, SALAD_SIZE, words, wordCount, 800);
}
else