X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Fobjectives.cpp;h=00283449c926400df65e042855e03c547de8a8fe;hb=e8df970596378106996620354631f1dc474c328c;hp=7d78fbc17f9f8ee44722cc41df56aa3ab4659617;hpb=a882955f339b23b5e61f92ef7cb5aae76405d95b;p=quix0rs-blobwars.git diff --git a/src/objectives.cpp b/src/objectives.cpp index 7d78fbc..0028344 100644 --- a/src/objectives.cpp +++ b/src/objectives.cpp @@ -241,7 +241,7 @@ void checkObjectives(const char *name, bool alwaysInform) { Objective *objective = (Objective*)map.objectiveList.getHead(); - char message[100]; + char message[256]; int requiredValue; @@ -269,24 +269,26 @@ void checkObjectives(const char *name, bool alwaysInform) { if (!map.isBossMission) { - sprintf(message, _("%s - Objective Completed - Check Point Reached!"), _(objective->description)); + snprintf(message, sizeof message, _("%s - Objective Completed - Check Point Reached!"), _(objective->description)); game.setObjectiveCheckPoint(); } else { - sprintf(message, _("%s - Objective Completed"), _(objective->description)); + snprintf(message, sizeof message, _("%s - Objective Completed"), _(objective->description)); } if (strcmp(objective->description, "Get the Aqua Lung") == 0) { - sprintf(message, "Got the Aqua Lung! You can now swim forever!"); + snprintf(message, sizeof message, "Got the Aqua Lung! You can now swim forever!"); game.hasAquaLung = true; + presentPlayerMedal("Aqua_Lung"); } if (strcmp(objective->description, "Get the Jetpack") == 0) { - sprintf(message, "Got the Jetpack! Press SPACE to Activate!"); + snprintf(message, sizeof message, "Got the Jetpack! Press SPACE to Activate!"); game.hasJetPack = true; + presentPlayerMedal("Jetpack"); } engine.setInfoMessage(message, 9, INFO_OBJECTIVE); @@ -301,13 +303,13 @@ void checkObjectives(const char *name, bool alwaysInform) switch (Math::prand() % 3) { case 0: - sprintf(message, _("%s - %d more to go..."), _(objective->description), requiredValue); + snprintf(message, sizeof message, _("%s - %d more to go..."), _(objective->description), requiredValue); break; case 1: - sprintf(message, _("%s - need %d more"), _(objective->description), requiredValue); + snprintf(message, sizeof message, _("%s - need %d more"), _(objective->description), requiredValue); break; case 2: - sprintf(message, _("%s - %d of %d"), _(objective->description), objective->currentValue, objective->targetValue); + snprintf(message, sizeof message, _("%s - %d of %d"), _(objective->description), objective->currentValue, objective->targetValue); break; }