Fix game_text and logic_format not functioning properly on Linux

This commit is contained in:
ALLEN-PC\acj30 2023-10-25 10:51:01 -05:00 committed by Blixibon
parent d981f6a005
commit ecb58e4246
2 changed files with 6 additions and 5 deletions

View File

@ -4059,7 +4059,7 @@ void CLogicFormat::FormatString(const char *szStringToFormat, char *szOutput, in
curparam = atoi(szToken); curparam = atoi(szToken);
if (curparam < MAX_LOGIC_FORMAT_PARAMETERS /*&& szParameters[curparam] != NULL*/) //if (curparam < MAX_FORMAT_PARAMETERS) if (curparam < MAX_LOGIC_FORMAT_PARAMETERS /*&& szParameters[curparam] != NULL*/) //if (curparam < MAX_FORMAT_PARAMETERS)
{ {
Q_snprintf(szFormatted, sizeof(szFormatted), "%s%s", szFormatted, szParameters[curparam]); Q_strncat(szFormatted, szParameters[curparam], sizeof(szFormatted));
} }
else else
{ {
@ -4068,8 +4068,8 @@ void CLogicFormat::FormatString(const char *szStringToFormat, char *szOutput, in
// This might not be the best way to do this, but // This might not be the best way to do this, but
// reaching it is supposed to be the result of a mistake anyway. // reaching it is supposed to be the result of a mistake anyway.
m_iszBackupParameter != NULL_STRING ? m_iszBackupParameter != NULL_STRING ?
Q_snprintf(szFormatted, sizeof(szFormatted), "%s%s", szFormatted, STRING(m_iszBackupParameter)) : Q_strncat( szFormatted, STRING(m_iszBackupParameter), sizeof( szFormatted ) ) :
Q_snprintf(szFormatted, sizeof(szFormatted), "%s<null>", szFormatted); Q_strncat( szFormatted, "<null>", sizeof( szFormatted ) );
} }
inparam = false; inparam = false;
@ -4077,7 +4077,7 @@ void CLogicFormat::FormatString(const char *szStringToFormat, char *szOutput, in
} }
else else
{ {
Q_snprintf(szFormatted, sizeof(szFormatted), "%s%s", szFormatted, szToken); Q_strncat( szFormatted, szToken, sizeof( szFormatted ) );
inparam = true; inparam = true;
szToken = strtok(NULL, "}"); szToken = strtok(NULL, "}");

View File

@ -447,7 +447,8 @@ void CGameText::SetText( const char* pszStr )
for (int i = 1; i < vecLines.Count(); i++) for (int i = 1; i < vecLines.Count(); i++)
{ {
Q_snprintf( szMsg, sizeof( szMsg ), "%s\n%s", szMsg, vecLines[i] ); Q_strncat( szMsg, "\n", sizeof( szMsg ) );
Q_strncat( szMsg, vecLines[i], sizeof( szMsg ) );
} }
m_iszMessage = AllocPooledString( szMsg ); m_iszMessage = AllocPooledString( szMsg );
} }