Host say format and localize bug fix

This commit is contained in:
WPMGPRoSToTeMa 2015-05-08 18:50:38 +03:00
parent 73b9448c0c
commit 5e05220444
2 changed files with 16 additions and 0 deletions

View File

@ -2550,7 +2550,12 @@ void Host_Say(qboolean teamonly)
p[Q_strlen(p) - 1] = 0;
}
#ifdef REHLDS_FIXES
// I think '\x01' don't need in TextMsg
Q_snprintf(text, sizeof(text), "<%s> ", Cvar_VariableString("hostname"));
#else // REHLDS_FIXES
Q_snprintf(text, sizeof(text), "%c<%s> ", 1, Cvar_VariableString("hostname"));
#endif // REHLDS_FIXES
if (Q_strlen(p) > 63)
p[63] = 0;
@ -2569,10 +2574,19 @@ void Host_Say(qboolean teamonly)
host_client = client;
#ifdef REHLDS_FIXES
// Text can be unsafe (format %, localize #) therefore need to send text as argument. TextMsg is used here instead of SayText, because SayText in Half-Life doesn't support arguments.
PF_MessageBegin_I(MSG_ONE, RegUserMsg("TextMsg", -1), NULL, &g_psv.edicts[j + 1]);
PF_WriteByte_I(HUD_PRINTTALK);
PF_WriteString_I("%s");
PF_WriteString_I(text);
PF_MessageEnd_I();
#else // REHLDS_FIXES
PF_MessageBegin_I(MSG_ONE, RegUserMsg("SayText", -1), NULL, &g_psv.edicts[j + 1]);
PF_WriteByte_I(0);
PF_WriteString_I(text);
PF_MessageEnd_I();
#endif // REHLDS_FIXES
}
host_client = save;

View File

@ -49,3 +49,5 @@
#include "rehlds_api_impl.h"
#include "FlightRecorderImpl.h"
#include "flight_recorder.h"
#include "dlls/cdll_dll.h"