Merge branch 'desc-final-2' into 'master'

Fix Conditionset 15's description (resolves #1274)

Closes #1274

See merge request KartKrew/Kart!2288
This commit is contained in:
toaster 2024-04-14 23:04:50 +00:00
commit 76becc7579

View file

@ -2631,7 +2631,7 @@ static const char *M_GetConditionString(condition_t *cn)
case UC_PRISONEGGCD: case UC_PRISONEGGCD:
// :butterfly: "alternatively you could say 'grab a hot toooon' or 'smooth beeat'" // :butterfly: "alternatively you could say 'grab a hot toooon' or 'smooth beeat'"
return "GRAND PRIX: grab a certain prize from a Prison Egg"; return "GRAND PRIX: grab a certain prize from a random Prison Egg";
case UC_AND: case UC_AND:
return "&"; return "&";
@ -2979,7 +2979,7 @@ char *M_BuildConditionSetString(UINT16 unlockid)
static char message[1024] = ""; static char message[1024] = "";
const char *work = NULL; const char *work = NULL;
size_t i; size_t i;
boolean stopasap = false; UINT8 stopasap = 0;
message[0] = '\0'; message[0] = '\0';
@ -3006,14 +3006,16 @@ char *M_BuildConditionSetString(UINT16 unlockid)
{ {
cn = &c->condition[i]; cn = &c->condition[i];
if (i > 0 && (cn->type != UC_COMMA)) if (i > 0)
{ {
worklen = 0;
if (lastID != cn->id) if (lastID != cn->id)
{ {
stopasap = 0;
worklen = 6; worklen = 6;
strncat(message, " - OR ", len); strncat(message, " - OR ", len);
} }
else else if (stopasap == 0 && cn->type != UC_COMMA)
{ {
worklen = 1; worklen = 1;
strncat(message, " ", len); strncat(message, " ", len);
@ -3023,23 +3025,33 @@ char *M_BuildConditionSetString(UINT16 unlockid)
lastID = cn->id; lastID = cn->id;
if (stopasap == 1)
{
// Secret challenge -- show unrelated condition IDs
continue;
}
work = M_GetConditionString(cn); work = M_GetConditionString(cn);
if (work == NULL) if (work == NULL)
{ {
stopasap = true; stopasap = 1;
work = "(Find other secrets to learn about this...)"; if (message[0] && message[1])
work = "???";
else
work = "(Find other secrets to learn about this...)";
} }
else if (cn->type == UC_DESCRIPTIONOVERRIDE) else if (cn->type == UC_DESCRIPTIONOVERRIDE)
{ {
stopasap = true; stopasap = 2;
} }
worklen = strlen(work); worklen = strlen(work);
strncat(message, work, len); strncat(message, work, len);
len -= worklen; len -= worklen;
if (stopasap) if (stopasap == 2)
{ {
// Description override - hide all further ones
break; break;
} }
} }