fixed bugs occurring with the macro function in game

This commit is contained in:
Tobias Grampp 2025-10-30 16:47:40 +01:00
parent e135756db5
commit 34e5f347ef
2 changed files with 4 additions and 3 deletions

View File

@ -7,7 +7,7 @@
#define MAX_RAND_TRIES_PER_WORD 10
#define EMPTY_CHAR 0
#define RANDOMNUMBER(minimum, maximum) rand() % (maximum minimum + 1) + minimum //Macro to generate a Number between minimum and maximum (both are possibly rolled)
#define RANDOMNUMBER(minimum, maximum) ((rand() % ((maximum)-(minimum)+1))+cd minimum) //Macro to generate a Number between minimum and maximum (both are possibly rolled)
//TODO: Spiellogik implementieren:
/* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren --> Vorher eingabe festlegen!
@ -34,11 +34,13 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
{
for(int j = 0; j < searchFieldLen; j++)
{
if((salad[i][j] == 63)//checks if there is already a letter of a word placed in here
if((salad[i][j] == 63))//checks if there is already a letter of a word placed in here
{
salad[i][j] = RANDOMNUMBER(65, 90);//fills "empty" chars in word salad with a random upper case letter
}
}
}
}
// Prints the word salad to console
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)

View File

@ -8,5 +8,4 @@
// Read words from file and store in 'words' array
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
}