Skip to content

Commit

Permalink
Fix game_text and logic_format not functioning properly on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Blixibon committed Oct 25, 2023
1 parent 8194d80 commit b978a4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions sp/src/game/server/logicentities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4059,7 +4059,7 @@ void CLogicFormat::FormatString(const char *szStringToFormat, char *szOutput, in
curparam = atoi(szToken);
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
{
Expand All @@ -4068,16 +4068,16 @@ void CLogicFormat::FormatString(const char *szStringToFormat, char *szOutput, in
// This might not be the best way to do this, but
// reaching it is supposed to be the result of a mistake anyway.
m_iszBackupParameter != NULL_STRING ?
Q_snprintf(szFormatted, sizeof(szFormatted), "%s%s", szFormatted, STRING(m_iszBackupParameter)) :
Q_snprintf(szFormatted, sizeof(szFormatted), "%s<null>", szFormatted);
Q_strncat( szFormatted, STRING(m_iszBackupParameter), sizeof( szFormatted ) ) :
Q_strncat( szFormatted, "<null>", sizeof( szFormatted ) );
}

inparam = false;
szToken = strtok(NULL, "{");
}
else
{
Q_snprintf(szFormatted, sizeof(szFormatted), "%s%s", szFormatted, szToken);
Q_strncat( szFormatted, szToken, sizeof( szFormatted ) );

inparam = true;
szToken = strtok(NULL, "}");
Expand Down
3 changes: 2 additions & 1 deletion sp/src/game/server/maprules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ void CGameText::SetText( const char* pszStr )

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 );
}
Expand Down

0 comments on commit b978a4b

Please sign in to comment.