added GetGlobalTarget/SetGlobalTarget to g_pSM

const'd some things

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401696
This commit is contained in:
David Anderson 2007-11-17 05:33:47 +00:00
parent a79a169384
commit f950225229
8 changed files with 33 additions and 9 deletions

View File

@ -46,7 +46,7 @@ public: //IRecipientFilter
int GetRecipientCount() const;
int GetRecipientIndex(int slot) const;
public:
void Initialize(cell_t *ptr, size_t count);
void Initialize(const cell_t *ptr, size_t count);
void SetToReliable(bool isreliable);
void SetToInit(bool isinitmsg);
void Reset();
@ -98,7 +98,7 @@ inline void CellRecipientFilter::SetToReliable(bool isreliable)
m_IsReliable = isreliable;
}
inline void CellRecipientFilter::Initialize(cell_t *ptr, size_t count)
inline void CellRecipientFilter::Initialize(const cell_t *ptr, size_t count)
{
memcpy(m_Players, ptr, count * sizeof(cell_t));
m_Size = count;

View File

@ -35,6 +35,7 @@
#include "UserMessages.h"
#include "PlayerManager.h"
#include "sm_stringutil.h"
#include "GameConfigs.h"
#include <compat_wrappers.h>
CHalfLife2 g_HL2;
@ -308,7 +309,11 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
return false;
}
const char *pre_byte = g_pGameConf->GetKeyValue("HintTextPreByte");
if (pre_byte != NULL && strcmp(pre_byte, "yes") == 0)
{
pBitBuf->WriteByte(1);
}
pBitBuf->WriteString(msg);
g_UserMsgs.EndMessage();

View File

@ -135,7 +135,7 @@ bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) con
return false;
}
bf_write *UserMessages::StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags)
bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags)
{
bf_write *buffer;

View File

@ -69,7 +69,7 @@ public: //IUserMessages
bool GetMessageName(int msgid, char *buffer, size_t maxlength) const;
bool HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
bf_write *StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags);
bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
bool EndMessage();
public:
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type);

View File

@ -586,9 +586,11 @@ const char *SourceModBase::GetGamePath() const
return g_BaseDir.c_str();
}
void SourceModBase::SetGlobalTarget(unsigned int index)
unsigned int SourceModBase::SetGlobalTarget(unsigned int index)
{
unsigned int old = m_target;
m_target = index;
return old;
}
unsigned int SourceModBase::GetGlobalTarget() const

View File

@ -83,7 +83,7 @@ public:
/**
* @brief Stores the global target index.
*/
void SetGlobalTarget(unsigned int index);
unsigned int SetGlobalTarget(unsigned int index);
/**
* @brief Returns the global target index.

View File

@ -43,7 +43,7 @@
#include <time.h>
#define SMINTERFACE_SOURCEMOD_NAME "ISourceMod"
#define SMINTERFACE_SOURCEMOD_VERSION 3
#define SMINTERFACE_SOURCEMOD_VERSION 4
/**
* @brief Forward declaration of the KeyValues class.
@ -199,6 +199,23 @@ namespace SourceMod
* @return Adjusted server time.
*/
virtual time_t GetAdjustedTime() =0;
/**
* @brief Sets the global client SourceMod will use for assisted
* translations (that is, %t).
*
* @param index Client index.
* @return Old global client value.
*/
virtual unsigned int SetGlobalTarget(unsigned int index) =0;
/**
* @brief Returns the global client SourceMod is currently using
* for assisted translations (that is, %t).
*
* @return Global client value.
*/
virtual unsigned int GetGlobalTarget() const =0;
};
}

View File

@ -144,7 +144,7 @@ namespace SourceMod
* @param flags Flags to use for sending the message.
* @return bf_write structure to write message with, or NULL on failure.
*/
virtual bf_write *StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags) =0;
virtual bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags) =0;
/**
* @brief Wrapper around UserMessageEnd for use with StartMessage().