cleaning up the code. part 0.1

This commit is contained in:
jeefo 2016-08-27 23:37:27 +03:00
commit 0c8a246c48
7 changed files with 109 additions and 74 deletions

View file

@ -1481,7 +1481,6 @@ extern bool FindNearestPlayer (void **holder, edict_t *to, float searchDistance
extern void FreeLibraryMemory (void);
extern void RoundInit (void);
extern void CheckWelcomeMessage (void);
extern void AddLogEntry (bool outputToConsole, int logLevel, const char *format, ...);
extern void DisplayMenuToClient (edict_t *ent, MenuText *menu);
extern void DecalTrace (entvars_t *pev, TraceResult *trace, int logotypeIndex);

View file

@ -4018,3 +4018,9 @@ public:
// Squared Length
//
#define GET_SQUARE(in) (in * in)
//
// Wrapper for singleton access
//
#define SA(obj) obj::GetReference ()

View file

@ -17,7 +17,6 @@ extern bool g_waypointOn;
extern bool g_autoWaypoint;
extern bool g_botsCanPause;
extern bool g_editNoclip;
extern bool g_isCommencing;
extern float g_autoPathDistance;
extern float g_timeBombPlanted;
@ -74,3 +73,35 @@ static inline bool IsNullString (const char *input)
return *input == '\0';
}
//
// simple class to handle welcome messages
//
class WelcomeMessage : public Singleton <WelcomeMessage>
{
private:
bool m_gameCommenced;
bool m_msgReceived;
float m_receiveTimer;
public:
WelcomeMessage (void) : m_gameCommenced (false), m_msgReceived (false), m_receiveTimer (0.0f) { }
public:
void SetGameCommenceFlag (bool isCommenced);
void VerifyMessageSent (void);
};
]=.
inline void WelcomeMessage::SetGameCommenceFlag (bool isCommenced)
{
m_gameCommenced = isCommenced;
if (!isCommenced)
{
m_receiveTimer = 0.0f;
m_msgReceived = false;
}
}