condition_t: Make pendingstring into stringvar in anticipation of second, less angry application

This commit is contained in:
toaster 2023-03-06 20:11:45 +00:00
parent 1e67f75f14
commit a355445592
3 changed files with 15 additions and 14 deletions

View file

@ -2338,7 +2338,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
INT32 i;
char *params[4]; // condition, requirement, extra info, extra info
char *spos;
char *pendingstring = NULL;
char *stringvar = NULL;
conditiontype_t ty;
INT32 re = 0;
@ -2578,7 +2578,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
}
#else
{
pendingstring = Z_StrDup(params[1]);
stringvar = Z_StrDup(params[1]);
re = -1;
}
#endif
@ -2623,7 +2623,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
return;
}
M_AddRawCondition(set, (UINT8)id, ty, re, x1, x2, pendingstring);
M_AddRawCondition(set, (UINT8)id, ty, re, x1, x2, stringvar);
}
void readconditionset(MYFILE *f, UINT8 setnum)

View file

@ -485,7 +485,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
}
}
void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2, char *pendingstring)
void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2, char *stringvar)
{
condition_t *cond;
UINT32 num, wnum;
@ -504,7 +504,7 @@ void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1
cond[wnum].requirement = r;
cond[wnum].extrainfo1 = x1;
cond[wnum].extrainfo2 = x2;
cond[wnum].pendingstring = pendingstring;
cond[wnum].stringvar = stringvar;
}
void M_ClearConditionSet(UINT8 set)
@ -514,7 +514,7 @@ void M_ClearConditionSet(UINT8 set)
while (conditionSets[set].numconditions > 0)
{
--conditionSets[set].numconditions;
Z_Free(conditionSets[set].condition[conditionSets[set].numconditions].pendingstring);
Z_Free(conditionSets[set].condition[conditionSets[set].numconditions].stringvar);
}
Z_Free(conditionSets[set].condition);
@ -577,28 +577,29 @@ void M_UpdateConditionSetsPending(void)
for (j = 0; j < c->numconditions; ++j)
{
cn = &c->condition[j];
if (cn->pendingstring == NULL)
if (cn->stringvar == NULL)
continue;
switch (cn->type)
{
case UCRP_ISCHARACTER:
{
cn->requirement = R_SkinAvailable(cn->pendingstring);
cn->requirement = R_SkinAvailable(cn->stringvar);
if (cn->requirement < 0)
{
CONS_Alert(CONS_WARNING, "UCRP_ISCHARACTER: Invalid character %s for condition ID %d", cn->pendingstring, cn->id+1);
CONS_Alert(CONS_WARNING, "UCRP_ISCHARACTER: Invalid character %s for condition ID %d", cn->stringvar, cn->id+1);
return;
}
Z_Free(cn->stringvar);
cn->stringvar = NULL;
break;
}
default:
break;
}
Z_Free(cn->pendingstring);
cn->pendingstring = NULL;
}

View file

@ -88,7 +88,7 @@ struct condition_t
INT32 requirement; /// <- The requirement for this variable.
INT16 extrainfo1; /// <- Extra information for the condition when needed.
INT16 extrainfo2; /// <- Extra information for the condition when needed.
char *pendingstring; /// oooohhh my god i hate loading order for SOC VS skins
char *stringvar; /// <- Extra z-allocated string for the condition when needed
};
struct conditionset_t
{
@ -275,7 +275,7 @@ char *M_BuildConditionSetString(UINT8 unlockid);
#define DESCRIPTIONWIDTH 170
// Condition set setup
void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2, char *pendingstring);
void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2, char *stringvar);
void M_UpdateConditionSetsPending(void);
// Clearing secrets