mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 23:25:41 +03:00
Enhanced qstring.h
This commit is contained in:
parent
3be0b51ec9
commit
60ad9e2df8
@ -36,9 +36,9 @@ void CItemAirBox::Spawn()
|
||||
|
||||
pev->movetype = MOVETYPE_NOCLIP;
|
||||
|
||||
if (!FStringNull(m_iszSpriteName))
|
||||
if (!m_iszSpriteName.IsEmpty())
|
||||
{
|
||||
m_pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteName), pev->origin, FALSE);
|
||||
m_pSprite = CSprite::SpriteCreate(m_iszSpriteName, pev->origin, FALSE);
|
||||
m_pSprite->SetTransparency(m_rendermode, m_rendercolor.x, m_rendercolor.y, m_rendercolor.z, m_renderamt, m_renderfx);
|
||||
m_pSprite->SetScale(m_scale);
|
||||
m_pSprite->SetAttachment(edict(), pev->body);
|
||||
@ -75,8 +75,8 @@ void CItemAirBox::Precache()
|
||||
{
|
||||
CArmoury::Precache();
|
||||
|
||||
if (!FStringNull(m_iszSpriteName)) {
|
||||
PRECACHE_MODEL(STRING(m_iszSpriteName));
|
||||
if (!m_iszSpriteName.IsEmpty()) {
|
||||
PRECACHE_MODEL(m_iszSpriteName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5761,7 +5761,7 @@ CBaseEntity *CBasePlayer::GiveNamedItemEx(const char *pszName)
|
||||
|
||||
if (FNullEnt(pent))
|
||||
{
|
||||
ALERT(at_console, "NULL Ent in GiveNamedItemEx!\n");
|
||||
ALERT(at_console, "NULL Ent in GiveNamedItemEx classname `%s`!\n", pszName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -30,14 +30,17 @@
|
||||
|
||||
#define QSTRING_DEFINE
|
||||
|
||||
constexpr auto iStringNull = 0u;
|
||||
|
||||
// Quake string (helper class)
|
||||
template <typename T = unsigned int>
|
||||
class QString final
|
||||
{
|
||||
public:
|
||||
QString(): m_string(0) {};
|
||||
QString(): m_string(iStringNull) {};
|
||||
QString(T string): m_string(string) {};
|
||||
|
||||
bool IsEmpty() const;
|
||||
bool operator==(T string) const;
|
||||
bool operator==(const QString<T> &s) const;
|
||||
bool operator==(const char *pszString) const;
|
||||
@ -65,6 +68,12 @@ extern globalvars_t *gpGlobals;
|
||||
#define MAKE_STRING(str) ((unsigned int)(str) - (unsigned int)(STRING(0)))
|
||||
|
||||
// Inlines
|
||||
template <typename T>
|
||||
inline bool QString<T>::IsEmpty() const
|
||||
{
|
||||
return m_string == iStringNull;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool QString<T>::operator==(T string) const
|
||||
{
|
||||
|
@ -1578,7 +1578,7 @@ void UTIL_PrecacheOther(const char *szClassname)
|
||||
edict_t *pent = CREATE_NAMED_ENTITY(MAKE_STRING(szClassname));
|
||||
if (FNullEnt(pent))
|
||||
{
|
||||
ALERT(at_console, "NULL Ent in UTIL_PrecacheOther\n");
|
||||
ALERT(at_console, "NULL Ent in UTIL_PrecacheOther classname `%s`\n", szClassname);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1594,7 +1594,7 @@ void UTIL_PrecacheOther(const char *szClassname)
|
||||
void UTIL_RestartOther(const char *szClassname)
|
||||
{
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, szClassname)) != nullptr)
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, szClassname)))
|
||||
{
|
||||
pEntity->Restart();
|
||||
}
|
||||
|
@ -104,7 +104,6 @@
|
||||
}
|
||||
|
||||
const EOFFSET eoNullEntity = (EOFFSET)0; // Testing the three types of "entity" for nullity
|
||||
const string_t iStringNull = (string_t)0; // Testing strings for nullity
|
||||
|
||||
class UTIL_GroupTrace
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user