Add format specifier "%E" (#2099) (#2330)

* Add format specifier "%E" (#2099)

* style: Remove extra blank lines
This commit is contained in:
F1F88
2025-11-08 17:09:57 +00:00
committed by GitHub
parent 1fc841713e
commit bc8d02c998
+17
View File
@@ -31,6 +31,7 @@
#include <am-float.h>
#include <am-string.h>
#include <IDBDriver.h>
#include <IGameHelpers.h>
#include <ITranslator.h>
#include <bridge/include/IScriptManager.h>
#include <bridge/include/CoreProvider.h>
@@ -1226,6 +1227,22 @@ reswitch:
arg++;
break;
}
case 'E':
{
CHECK_ARGS(0);
cell_t *value;
pCtx->LocalToPhysAddr(params[arg], &value);
CBaseEntity *entity = gamehelpers->ReferenceToEntity(*value);
if (!entity)
return pCtx->ThrowNativeError("Entity index %d is invalid (arg %d)", *value, arg);
const char *classname = gamehelpers->GetEntityClassname(entity);
if (!AddString(&buf_p, llen, classname, width, prec, flags))
return pCtx->ThrowNativeError("Escaped string would be truncated (arg %d)", arg);
arg++;
break;
}
case 's':
{
CHECK_ARGS(0);