don't exit if some words couldn't be placed
This commit is contained in:
parent
147fc502eb
commit
c95c264a3a
@ -37,17 +37,21 @@ int main(int argc, char *argv[])
|
|||||||
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||||
|
|
||||||
// Check if all words were successfully placed
|
// Check if all words were successfully placed
|
||||||
// Start the game if successful
|
|
||||||
// error message if some words couldn't be placed
|
// error message if some words couldn't be placed
|
||||||
|
|
||||||
if (placedWords < wordCount)
|
if (placedWords < wordCount)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "some words couldn't be placed\n");
|
int notPlacedNum = wordCount - placedWords;
|
||||||
exitCode = EXIT_FAILURE;
|
fprintf(stderr, "%d word(s) couldn't be placed\n", notPlacedNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// Start the game if successful
|
// correct parameters for startGame
|
||||||
|
|
||||||
|
// Start the game if at least 1 word has been successfully placed
|
||||||
|
else if (placedWords >= 1)
|
||||||
|
{
|
||||||
|
startGame(wordSalad, 80, words, placedWords, 800);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,17 +37,21 @@ int main(int argc, char *argv[])
|
|||||||
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||||
|
|
||||||
// Check if all words were successfully placed
|
// Check if all words were successfully placed
|
||||||
// Start the game if successful
|
|
||||||
// error message if some words couldn't be placed
|
// error message if some words couldn't be placed
|
||||||
|
|
||||||
if (placedWords < wordCount)
|
if (placedWords < wordCount)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "some words couldn't be placed\n");
|
int notPlacedNum = wordCount - placedWords;
|
||||||
exitCode = EXIT_FAILURE;
|
fprintf(stderr, "%d word(s) couldn't be placed\n", notPlacedNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// Start the game if successful
|
// correct parameters for startGame
|
||||||
|
|
||||||
|
// Start the game if at least 1 word has been successfully placed
|
||||||
|
else if (placedWords >= 1)
|
||||||
|
{
|
||||||
|
startGame(wordSalad, 80, words, placedWords, 800);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user