Compare commits

..
Author SHA1 Message Date
David Anderson 5cb5a022b8 bumped version
--HG--
branch : sourcemod-1.0.3
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.3%402276
2008-06-25 02:59:37 +00:00
David Anderson d715e22162 patch for amb1776 regression
--HG--
branch : sourcemod-1.0.3
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.3%402274
2008-06-24 04:15:16 +00:00
David Anderson 0ffe92c346 patch for amb1765 - GivePlayerItem offsets for DoDS:Beta
--HG--
branch : sourcemod-1.0.3
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.3%402273
2008-06-24 04:13:55 +00:00
David Anderson b01b855992 bumped version
--HG--
branch : sourcemod-1.0.3
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.3%402269
2008-06-21 08:55:51 +00:00
David Anderson 91ea38fa54 temporarily branched 1.0.3 for tagging
--HG--
branch : sourcemod-1.0.3
2008-06-21 08:32:28 +00:00
96 changed files with 644 additions and 1531 deletions
+2
View File
@@ -162,6 +162,8 @@ private:
c -= (unsigned)'a';
assert(c >= 0 && c < 26);
if (!g_Admins.FindFlag(key, &g_FlagLetters[c]))
{
ParseError(states, "Unrecognized admin level \"%s\"", key);
+1 -26
View File
@@ -296,32 +296,7 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
ConCmdInfo *pInfo;
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
{
/* Unfortunately, we now have to do a slow lookup because Valve made client commands
* case-insensitive. We can't even use our sortedness.
*/
if (client == 0 && !engine->IsDedicatedServer())
{
return;
}
List<ConCmdInfo *>::iterator iter;
pInfo = NULL;
iter = m_CmdList.begin();
while (iter != m_CmdList.end())
{
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
{
pInfo = (*iter);
break;
}
iter++;
}
if (pInfo == NULL)
{
return;
}
return;
}
/* This is a hack to prevent say triggers from firing on messages that were
+7 -15
View File
@@ -40,7 +40,6 @@
#include "Logger.h"
#include "PluginSys.h"
#include "ForwardSys.h"
#include "frame_hooks.h"
#ifdef PLATFORM_WINDOWS
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
@@ -103,11 +102,9 @@ void CheckAndFinalizeConfigs()
if ((g_bServerExecd || g_ServerCfgFile == NULL)
&& g_bGotServerStart)
{
#if defined ORANGEBOX_BUILD
g_PendingInternalPush = true;
#else
SM_InternalCmdTrigger();
#endif
/* Order is important here. We need to buffer things before we send the command out. */
g_pOnAutoConfigsBuffered->Execute(NULL);
engine->ServerCommand("sm internal 1\n");
}
}
@@ -505,6 +502,10 @@ void SM_ExecuteAllConfigs()
}
iter->Release();
#if defined ORANGEBOX_BUILD
engine->ServerExecute();
#endif
g_bGotServerStart = true;
CheckAndFinalizeConfigs();
}
@@ -521,12 +522,3 @@ void SM_ConfigsExecuted_Global()
g_pOnServerCfg->Execute(NULL);
g_pOnConfigsExecuted->Execute(NULL);
}
void SM_InternalCmdTrigger()
{
/* Order is important here. We need to buffer things before we send the command out. */
g_pOnAutoConfigsBuffered->Execute(NULL);
engine->ServerCommand("sm internal 1\n");
g_PendingInternalPush = false;
}
+1 -2
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -68,7 +68,6 @@ extern void SM_ExecuteAllConfigs();
extern void SM_ExecuteForPlugin(IPluginContext *ctx);
extern void SM_ConfigsExecuted_Global();
extern void SM_ConfigsExecuted_Plugin(unsigned int serial);
extern void SM_InternalCmdTrigger();
extern CoreConfig g_CoreConfig;
-1
View File
@@ -220,7 +220,6 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
s_ServerBinCRC = UTIL_CRC32(buffer, size);
free(buffer);
s_ServerBinCRC_Ok = true;
fclose(fp);
}
}
if (error[0] != '\0')
+1 -29
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -511,31 +511,3 @@ const char *CHalfLife2::CurrentCommandName()
return m_CommandStack.front().cmd;
#endif
}
void CHalfLife2::AddDelayedKick(int client, int userid, const char *msg)
{
DelayedKickInfo kick;
kick.client = client;
kick.userid = userid;
UTIL_Format(kick.buffer, sizeof(kick.buffer), "%s", msg);
m_DelayedKicks.push(kick);
}
void CHalfLife2::ProcessDelayedKicks()
{
while (!m_DelayedKicks.empty())
{
DelayedKickInfo info = m_DelayedKicks.first();
m_DelayedKicks.pop();
CPlayer *player = g_Players.GetPlayerByIndex(info.client);
if (player == NULL || player->GetUserId() != info.userid)
{
continue;
}
player->Kick(info.buffer);
}
}
+1 -11
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -79,13 +79,6 @@ struct CachedCommandInfo
#endif
};
struct DelayedKickInfo
{
int userid;
int client;
char buffer[384];
};
class CHalfLife2 :
public SMGlobalClass,
public IGameHelpers
@@ -117,8 +110,6 @@ public:
void PopCommandStack();
const CCommand *PeekCommandStack();
const char *CurrentCommandName();
void AddDelayedKick(int client, int userid, const char *msg);
void ProcessDelayedKicks();
#if !defined METAMOD_PLAPI_VERSION
bool IsOriginalEngine();
#endif
@@ -134,7 +125,6 @@ private:
Queue<DelayedFakeCliCmd *> m_CmdQueue;
CStack<DelayedFakeCliCmd *> m_FreeCmds;
CStack<CachedCommandInfo> m_CommandStack;
Queue<DelayedKickInfo> m_DelayedKicks;
};
extern CHalfLife2 g_HL2;
+1 -1
View File
@@ -59,7 +59,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+59 -77
View File
@@ -121,7 +121,7 @@ void PlayerManager::OnSourceModAllInitialized()
ParamType p1[] = {Param_Cell, Param_String, Param_Cell};
ParamType p2[] = {Param_Cell};
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_LowEvent, 3, p1);
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_Event, 3, p1);
m_clputinserver = g_Forwards.CreateForward("OnClientPutInServer", ET_Ignore, 1, p2);
m_cldisconnect = g_Forwards.CreateForward("OnClientDisconnect", ET_Ignore, 1, p2);
m_cldisconnect_post = g_Forwards.CreateForward("OnClientDisconnect_Post", ET_Ignore, 1, p2);
@@ -288,7 +288,7 @@ void PlayerManager::RunAuthChecks()
unsigned int removed = 0;
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
{
pPlayer = &m_Players[m_AuthQueue[i]];
pPlayer = GetPlayerByIndex(m_AuthQueue[i]);
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
if (authstr && authstr[0] != '\0'
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
@@ -362,7 +362,6 @@ void PlayerManager::RunAuthChecks()
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{
int client = engine->IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
@@ -377,29 +376,26 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
cell_t res = 1;
pPlayer->Initialize(pszName, pszAddress, pEntity);
m_Players[client].Initialize(pszName, pszAddress, pEntity);
m_clconnect->PushCell(client);
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8, SM_PARAM_COPYBACK);
m_clconnect->PushCell(maxrejectlen);
m_clconnect->Execute(&res);
m_clconnect->Execute(&res, NULL);
if (res)
{
if (!pPlayer->IsAuthorized())
if (!m_Players[client].IsAuthorized())
{
m_AuthQueue[++m_AuthQueue[0]] = client;
}
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
}
else
{
if (!pPlayer->IsFakeClient())
{
RETURN_META_VALUE(MRES_SUPERCEDE, false);
}
RETURN_META_VALUE(MRES_SUPERCEDE, false);
}
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
return true;
}
@@ -407,7 +403,7 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
{
int client = engine->IndexOfEdict(pEntity);
bool orig_value = META_RESULT_ORIG_RET(bool);
CPlayer *pPlayer = &m_Players[client];
CPlayer *pPlayer = GetPlayerByIndex(client);
if (orig_value)
{
@@ -422,17 +418,13 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
break;
}
}
if (!pPlayer->IsFakeClient()
&& m_bIsListenServer
&& strncmp(pszAddress, "127.0.0.1", 9) == 0)
{
m_ListenClient = client;
}
}
else
if (!pPlayer->IsFakeClient()
&& m_bIsListenServer
&& strncmp(pszAddress, "127.0.0.1", 9) == 0)
{
InvalidatePlayer(pPlayer);
m_ListenClient = client;
}
return true;
@@ -442,8 +434,8 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
CPlayer *pPlayer = GetPlayerByIndex(client);
/* If they're not connected, they're a bot */
if (!pPlayer->IsConnected())
{
@@ -451,7 +443,6 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
char error[255];
const char *authid = engine->GetPlayerNetworkIDString(pEntity);
pPlayer->Authorize(authid);
pPlayer->m_bFakeClient = true;
if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
{
/* :TODO: kick the bot if it's rejected */
@@ -503,7 +494,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
}
}
pPlayer->Connect();
m_Players[client].Connect();
m_PlayerCount++;
List<IClientListener *>::iterator iter;
@@ -517,9 +508,9 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
m_clputinserver->PushCell(client);
m_clputinserver->Execute(&res, NULL);
if (pPlayer->IsAuthorized())
if (m_Players[client].IsAuthorized())
{
pPlayer->DoPostConnectAuthorization();
m_Players[client].DoPostConnectAuthorization();
}
}
@@ -540,9 +531,8 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
if (pPlayer->IsConnected())
if (m_Players[client].IsConnected())
{
m_cldisconnect->PushCell(client);
m_cldisconnect->Execute(&res, NULL);
@@ -553,7 +543,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
return;
}
if (pPlayer->WasCountedAsInGame())
if (m_Players[client].WasCountedAsInGame())
{
m_PlayerCount--;
}
@@ -566,7 +556,29 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
pListener->OnClientDisconnecting(client);
}
InvalidatePlayer(pPlayer);
/**
* Remove client from auth queue if necessary
*/
if (!m_Players[client].IsAuthorized())
{
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
{
if (m_AuthQueue[i] == (unsigned)client)
{
/* Move everything ahead of us back by one */
for (unsigned int j=i+1; j<=m_AuthQueue[0]; j++)
{
m_AuthQueue[j-1] = m_AuthQueue[j];
}
/* Remove us and break */
m_AuthQueue[0]--;
break;
}
}
}
m_Players[client].Disconnect();
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = 0;
if (m_ListenClient == client)
{
@@ -601,9 +613,9 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
#endif
int client = engine->IndexOfEdict(pEntity);
cell_t res = Pl_Continue;
CPlayer *pPlayer = &m_Players[client];
if (!pPlayer->IsConnected())
CPlayer *pPlayer = GetPlayerByIndex(client);
if (!pPlayer || !pPlayer->IsConnected())
{
return;
}
@@ -655,9 +667,8 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
if (!pPlayer->IsConnected())
if (!m_Players[client].IsConnected())
{
return;
}
@@ -665,42 +676,42 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
m_clinfochanged->PushCell(engine->IndexOfEdict(pEntity));
m_clinfochanged->Execute(&res, NULL);
IPlayerInfo *info = pPlayer->GetPlayerInfo();
IPlayerInfo *info = m_Players[client].GetPlayerInfo();
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
const char *old_name = pPlayer->m_Name.c_str();
const char *old_name = m_Players[client].m_Name.c_str();
if (strcmp(old_name, new_name) != 0)
{
AdminId id = g_Admins.FindAdminByIdentity("name", new_name);
if (id != INVALID_ADMIN_ID && pPlayer->GetAdminId() != id)
if (id != INVALID_ADMIN_ID && m_Players[client].GetAdminId() != id)
{
if (!CheckSetAdminName(client, pPlayer, id))
if (!CheckSetAdminName(client, &m_Players[client], id))
{
pPlayer->Kick("Your name is reserved by SourceMod; set your password to use it.");
m_Players[client].Kick("Your name is reserved by SourceMod; set your password to use it.");
RETURN_META(MRES_IGNORED);
}
} else if ((id = g_Admins.FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
if (id == pPlayer->GetAdminId())
if (id == m_Players[client].GetAdminId())
{
/* This player is changing their name; force them to drop admin privileges! */
pPlayer->SetAdminId(INVALID_ADMIN_ID, false);
m_Players[client].SetAdminId(INVALID_ADMIN_ID, false);
}
}
pPlayer->SetName(new_name);
m_Players[client].SetName(new_name);
}
if (m_PassInfoVar.size() > 0)
{
/* Try for a password change */
const char *old_pass = pPlayer->m_LastPassword.c_str();
const char *old_pass = m_Players[client].m_LastPassword.c_str();
const char *new_pass = engine->GetClientConVarValue(client, m_PassInfoVar.c_str());
if (strcmp(old_pass, new_pass) != 0)
{
pPlayer->m_LastPassword.assign(new_pass);
if (pPlayer->IsInGame() && pPlayer->IsAuthorized())
m_Players[client].m_LastPassword.assign(new_pass);
if (m_Players[client].IsInGame() && m_Players[client].IsAuthorized())
{
/* If there is already an admin id assigned, this will just bail out. */
pPlayer->DoBasicAdminChecks();
m_Players[client].DoBasicAdminChecks();
}
}
}
@@ -851,33 +862,6 @@ void PlayerManager::UnregisterCommandTargetProcessor(ICommandTargetProcessor *pH
target_processors.remove(pHandler);
}
void PlayerManager::InvalidatePlayer(CPlayer *pPlayer)
{
/**
* Remove client from auth queue if necessary
*/
if (!pPlayer->IsAuthorized())
{
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
{
if (m_AuthQueue[i] == (unsigned)pPlayer->m_iIndex)
{
/* Move everything ahead of us back by one */
for (unsigned int j=i+1; j<=m_AuthQueue[0]; j++)
{
m_AuthQueue[j-1] = m_AuthQueue[j];
}
/* Remove us and break */
m_AuthQueue[0]--;
break;
}
}
}
m_UserIdLookUp[engine->GetPlayerUserId(pPlayer->m_pEdict)] = 0;
pPlayer->Disconnect();
}
int PlayerManager::InternalFilterCommandTarget(CPlayer *pAdmin, CPlayer *pTarget, int flags)
{
if ((flags & COMMAND_FILTER_CONNECTED) == COMMAND_FILTER_CONNECTED
@@ -1220,7 +1204,6 @@ CPlayer::CPlayer()
m_bIsInKickQueue = false;
m_LastPassword.clear();
m_LangId = LANGUAGE_ENGLISH;
m_bFakeClient = false;
}
void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
@@ -1288,7 +1271,6 @@ void CPlayer::Disconnect()
m_bAdminCheckSignalled = false;
m_UserId = -1;
m_bIsInKickQueue = false;
m_bFakeClient = false;
}
void CPlayer::SetName(const char *name)
@@ -1353,7 +1335,7 @@ IPlayerInfo *CPlayer::GetPlayerInfo()
bool CPlayer::IsFakeClient()
{
return m_bFakeClient;
return (strcmp(m_AuthID.c_str(), "BOT") == 0);
}
void CPlayer::SetAdminId(AdminId id, bool temporary)
-2
View File
@@ -105,7 +105,6 @@ private:
int m_iIndex;
unsigned int m_LangId;
int m_UserId;
bool m_bFakeClient;
};
class PlayerManager :
@@ -174,7 +173,6 @@ public:
unsigned int SetReplyTo(unsigned int reply);
private:
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
void InvalidatePlayer(CPlayer *pPlayer);
private:
List<IClientListener *> m_hooks;
IForward *m_clconnect;
+1 -1
View File
@@ -101,7 +101,7 @@ void CPhraseFile::ParseWarning(const char *message, ...)
m_FileLogged = true;
}
g_Logger.LogError("[SM] %s", buffer);
g_Logger.LogError("[SM] %s", message);
}
void CPhraseFile::ReparseFile()
+1 -10
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -35,24 +35,15 @@
#include "MenuStyle_Valve.h"
#include "MenuStyle_Radio.h"
#include "PlayerManager.h"
#include "CoreConfig.h"
float g_LastMenuTime = 0.0f;
float g_LastAuthCheck = 0.0f;
bool g_PendingInternalPush = false;
void RunFrameHooks(bool simulating)
{
/* Frame based hooks */
g_DBMan.RunFrame();
g_HL2.ProcessFakeCliCmdQueue();
g_HL2.ProcessDelayedKicks();
if (g_PendingInternalPush)
{
SM_InternalCmdTrigger();
}
g_SourceMod.ProcessGameFrameHooks(simulating);
float curtime = *g_pUniversalTime;
+1 -3
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -32,8 +32,6 @@
#ifndef _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
#define _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
extern bool g_PendingInternalPush;
void RunFrameHooks(bool simulating);
#endif //_INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
-1
View File
@@ -284,7 +284,6 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
ConsolePrint(" JIT Version: %s, %s", g_pVM->GetVMName(), g_pVM->GetVersionString());
ConsolePrint(" JIT Settings: %s", g_pVM->GetCPUOptimizations());
ConsolePrint(" Compiled on: %s %s", __DATE__, __TIME__);
ConsolePrint(" Build ID: %s", SM_BUILD_UNIQUEID);
ConsolePrint(" http://www.sourcemod.net/");
}
}
+2 -4
View File
@@ -40,9 +40,7 @@
* @file Contains SourceMod version information.
*/
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+2 -4
View File
@@ -40,9 +40,7 @@
* @file Contains SourceMod version information.
*/
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+9 -3
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -304,7 +304,10 @@ static cell_t sm_CallStartFunction(IPluginContext *pContext, const cell_t *param
HandleError err;
IPlugin *pPlugin;
ResetCall();
if (s_CallStarted)
{
return pContext->ThrowNativeError("Cannot start a call while one is already in progress");
}
hndl = static_cast<Handle_t>(params[1]);
@@ -340,7 +343,10 @@ static cell_t sm_CallStartForward(IPluginContext *pContext, const cell_t *params
HandleError err;
IForward *pForward;
ResetCall();
if (s_CallStarted)
{
return pContext->ThrowNativeError("Cannot start a call while one is already in progress");
}
hndl = static_cast<Handle_t>(params[1]);
+1 -1
View File
@@ -387,7 +387,7 @@ public:
continue;
}
strncopy(buffer, pDir->GetEntryName(), sizeof(buffer));
if ((ptr = strstr(buffer, ".bsp")) == NULL || ptr[4] != '\0')
if ((ptr = strstr(buffer, ".bsp")) == NULL)
{
pDir->NextEntry();
continue;
+1 -56
View File
@@ -1258,64 +1258,10 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsConnected())
{
} else if (!pPlayer->IsConnected()) {
return pContext->ThrowNativeError("Client %d is not connected", client);
}
/* Ignore duplicate kicks */
if (pPlayer->IsInKickQueue())
{
return 1;
}
pPlayer->MarkAsBeingKicked();
if (pPlayer->IsFakeClient())
{
char kickcmd[40];
UTIL_Format(kickcmd, sizeof(kickcmd), "kick %s\n", pPlayer->GetName());
engine->ServerCommand(kickcmd);
return 1;
}
g_SourceMod.SetGlobalTarget(client);
char buffer[256];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
if (pContext->GetContext()->n_err != SP_ERROR_NONE)
{
return 0;
}
g_HL2.AddDelayedKick(client, pPlayer->GetUserId(), buffer);
return 1;
}
static cell_t KickClientEx(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not connected", client);
}
/* Ignore duplicate kicks */
if (pPlayer->IsInKickQueue())
{
return 1;
}
pPlayer->MarkAsBeingKicked();
if (pPlayer->IsFakeClient())
@@ -1514,7 +1460,6 @@ REGISTER_NATIVES(playernatives)
{"ShowActivityEx", ShowActivityEx},
{"ShowActivity2", ShowActivity2},
{"KickClient", KickClient},
{"KickClientEx", KickClientEx},
{"RunAdminCacheChecks", RunAdminCacheChecks},
{"NotifyPostAdminCheck", NotifyPostAdminCheck},
{"IsClientInKickQueue", IsClientInKickQueue},
+2 -40
View File
@@ -192,31 +192,7 @@ static cell_t sm_formatex(IPluginContext *pCtx, const cell_t *params)
return static_cast<cell_t>(res);
}
class StaticCharBuf
{
char *buffer;
size_t max_size;
public:
StaticCharBuf() : buffer(NULL), max_size(0)
{
}
~StaticCharBuf()
{
delete [] buffer;
}
char* GetWithSize(size_t len)
{
if (len > max_size)
{
buffer = (char *)realloc(buffer, len);
max_size = len;
}
return buffer;
}
};
static char g_formatbuf[2048];
static StaticCharBuf g_extrabuf;
static cell_t sm_format(IPluginContext *pCtx, const cell_t *params)
{
char *buf, *fmt, *destbuf;
@@ -224,7 +200,6 @@ static cell_t sm_format(IPluginContext *pCtx, const cell_t *params)
size_t res, maxlen;
int arg = 4;
bool copy = false;
char *__copy_buf;
pCtx->LocalToString(params[1], &destbuf);
pCtx->LocalToString(params[3], &fmt);
@@ -242,25 +217,12 @@ static cell_t sm_format(IPluginContext *pCtx, const cell_t *params)
break;
}
}
if (copy)
{
if (maxlen > sizeof(g_formatbuf))
{
__copy_buf = g_extrabuf.GetWithSize(maxlen);
}
else
{
__copy_buf = g_formatbuf;
}
}
buf = (copy) ? __copy_buf : destbuf;
buf = (copy) ? g_formatbuf : destbuf;
res = atcprintf(buf, maxlen, fmt, pCtx, params, &arg);
if (copy)
{
memcpy(destbuf, __copy_buf, res+1);
memcpy(destbuf, g_formatbuf, res+1);
}
return static_cast<cell_t>(res);
+3 -6
View File
@@ -933,6 +933,9 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
}
}
/* Tell it to unload */
pAPI = pExt->GetAPI();
pAPI->OnExtensionUnload();
}
IdentityToken_t *pIdentity;
@@ -946,12 +949,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
}
}
/* Tell it to unload */
if (pExt->IsLoaded())
{
IExtensionInterface *pAPI = pExt->GetAPI();
pAPI->OnExtensionUnload();
}
pExt->Unload();
delete pExt;
+37 -51
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -283,11 +283,15 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
return err;
}
if (filter)
{
filter->OnExecuteBegin();
}
FuncIter iter = m_functions.begin();
IPluginFunction *func;
cell_t cur_result = 0;
cell_t high_result = 0;
cell_t low_result = 0;
int err;
unsigned int failed=0, success=0;
unsigned int num_params = m_curparam;
@@ -307,16 +311,12 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
{
int err = SP_ERROR_PARAM;
param = &temp_info[i];
if (i >= m_numparams || m_types[i] == Param_Any)
{
type = param->pushedas;
}
else
{
} else {
type = m_types[i];
}
if ((i >= m_numparams) || (type & SP_PARAMFLAG_BYREF))
{
/* If we're byref or we're vararg, we always push everything by ref.
@@ -325,30 +325,26 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
if (type == Param_String)
{
err = func->PushStringEx((char *)param->byref.orig_addr, param->byref.cells, param->byref.sz_flags, param->byref.flags);
}
else if (type == Param_Float || type == Param_Cell)
{
} else if (type == Param_Float || type == Param_Cell) {
err = func->PushCellByRef(&param->val);
}
else
{
} else {
err = func->PushArray(param->byref.orig_addr, param->byref.cells, param->byref.flags);
assert(type == Param_Array || type == Param_FloatByRef || type == Param_CellByRef);
}
}
else
{
} else {
/* If we're not byref or not vararg, our job is a bit easier. */
assert(type == Param_Cell || type == Param_Float);
err = func->PushCell(param->val);
}
if (err != SP_ERROR_NONE)
{
g_DbgReporter.GenerateError(func->GetParentContext(),
func->GetFunctionID(),
err,
"Failed to push parameter while executing forward");
if (!filter || !filter->OnErrorReport(this, func, err))
{
g_DbgReporter.GenerateError(func->GetParentContext(),
func->GetFunctionID(),
err,
"Failed to push parameter while executing forward");
}
continue;
}
}
@@ -356,10 +352,12 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
/* Call the function and deal with the return value. */
if ((err=func->Execute(&cur_result)) != SP_ERROR_NONE)
{
if (filter)
{
filter->OnErrorReport(this, func, err);
}
failed++;
}
else
{
} else {
success++;
switch (m_ExecType)
{
@@ -383,12 +381,14 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
}
break;
}
case ET_LowEvent:
case ET_Custom:
{
/* Check if the current result is the lowest so far (or if it's the first result) */
if (cur_result < low_result || success == 1)
if (filter)
{
low_result = cur_result;
if (filter->OnFunctionReturn(this, func, &cur_result) == Pl_Stop)
{
goto done;
}
}
break;
}
@@ -401,39 +401,25 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
}
done:
if (success)
{
switch (m_ExecType)
if (m_ExecType == ET_Event || m_ExecType == ET_Hook)
{
case ET_Ignore:
{
cur_result = 0;
break;
}
case ET_Event:
case ET_Hook:
{
cur_result = high_result;
break;
}
case ET_LowEvent:
{
cur_result = low_result;
break;
}
default:
{
break;
}
cur_result = high_result;
} else if (m_ExecType == ET_Ignore) {
cur_result = 0;
}
if (result)
{
*result = cur_result;
}
}
if (filter)
{
filter->OnExecuteEnd(&cur_result, success, failed);
}
return SP_ERROR_NONE;
}
+2 -2
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -43,7 +43,7 @@ using namespace SourceHook;
typedef List<IPluginFunction *>::iterator FuncIter;
/* :TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX */
//:TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX
#define FORWARDS_NAME_MAX 64
struct ByrefInfo
+3 -14
View File
@@ -997,9 +997,8 @@ bool HandleSystem::TryAndFreeSomeHandles()
void HandleSystem::Dump(HANDLE_REPORTER rep)
{
char refcount[20], parent[20];
unsigned int total_size = 0;
rep("%-10.10s\t%-20.20s\t%-20.20s\t%-10.10s\t%-10.10s\t%-10.10s", "Handle", "Owner", "Type", "Memory", "Refcount", "Parent");
rep("%-10.10s\t%-20.20s\t%-20.20s\t%-10.10s", "Handle", "Owner", "Type", "Memory");
rep("--------------------------------------------------------------------------");
for (unsigned int i = 1; i <= m_HandleTail; i++)
{
@@ -1050,26 +1049,16 @@ void HandleSystem::Dump(HANDLE_REPORTER rep)
{
type = m_strtab->GetString(pType->nameIdx);
}
if (m_Handles[i].clone == 0)
{
UTIL_Format(refcount, sizeof(refcount), "%d", m_Handles[i].refcount);
UTIL_Format(parent, sizeof(parent), "NULL");
}
else
{
UTIL_Format(refcount, sizeof(refcount), "%d", m_Handles[m_Handles[i].clone].refcount);
UTIL_Format(parent, sizeof(parent), "%d", m_Handles[i].clone);
}
if (pType->dispatch->GetDispatchVersion() < HANDLESYS_MEMUSAGE_MIN_VERSION
|| !pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size))
{
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s\t%-10.10s\t%-10.10s", index, owner, type, "-1", refcount, parent);
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, "-1");
}
else
{
char buffer[32];
UTIL_Format(buffer, sizeof(buffer), "%d", size);
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s\t%-10.10s\t%-10.10s", index, owner, type, buffer, refcount, parent);
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, buffer);
total_size += size;
}
}
+1 -1
View File
@@ -34,7 +34,7 @@
#include "BaseWorker.h"
#define DEFAULT_THINK_TIME_MS 50
#define DEFAULT_THINK_TIME_MS 500
class ThreadWorker : public BaseWorker, public IThread
{
+1 -1
View File
@@ -42,7 +42,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
#define _INCLUDE_BINTOOLS_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_BINTOOLS_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
#define _INCLUDE_BINTOOLS_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_BINTOOLS_VERSION_H_
+1 -1
View File
@@ -42,7 +42,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+1 -1
View File
@@ -42,7 +42,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_GEOIP_VERSION_H_
#define _INCLUDE_GEOIP_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_GEOIP_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_GEOIP_VERSION_H_
#define _INCLUDE_GEOIP_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_GEOIP_VERSION_H_
+1 -1
View File
@@ -46,7 +46,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_MYSQLEXT_VERSION_H_
#define _INCLUDE_MYSQLEXT_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_MYSQLEXT_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_MYSQLEXT_VERSION_H_
#define _INCLUDE_MYSQLEXT_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_MYSQLEXT_VERSION_H_
+1 -1
View File
@@ -42,7 +42,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_REGEXEXT_VERSION_H_
#define _INCLUDE_REGEXEXT_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_REGEXEXT_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_REGEXEXT_VERSION_H_
#define _INCLUDE_REGEXEXT_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_REGEXEXT_VERSION_H_
+1 -1
View File
@@ -45,7 +45,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
+4 -4
View File
@@ -82,10 +82,6 @@ extern sp_nativeinfo_t g_TeamNatives[];
bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
if (!gameconfs->LoadGameConfigFile(SDKTOOLS_GAME_FILE, &g_pGameConf, error, maxlength))
{
return false;
}
sharesys->AddDependency(myself, "bintools.ext", true, true);
sharesys->AddNatives(myself, g_CallNatives);
sharesys->AddNatives(myself, g_Natives);
@@ -100,6 +96,10 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
SM_GET_IFACE(GAMEHELPERS, g_pGameHelpers);
if (!gameconfs->LoadGameConfigFile(SDKTOOLS_GAME_FILE, &g_pGameConf, error, maxlength))
{
return false;
}
playerhelpers->AddClientListener(&g_SdkTools);
g_CallHandle = handlesys->CreateType("ValveCall", this, 0, NULL, NULL, myself->GetIdentity(), NULL);
+2 -6
View File
@@ -76,12 +76,7 @@ bool EntityOutputManager::IsEnabled()
bool EntityOutputManager::CreateFireEventDetour()
{
if (!g_pGameConf->GetMemSig("FireOutput", &info_address))
{
return false;
}
if (!info_address)
if (!g_pGameConf->GetMemSig("FireOutput", &info_address) || !info_address)
{
g_pSM->LogError(myself, "Could not locate FireOutput - Disabling Entity Outputs");
return false;
@@ -89,6 +84,7 @@ bool EntityOutputManager::CreateFireEventDetour()
if (!g_pGameConf->GetOffset("FireOutputBackup", (int *)&(info_restore.bytes)))
{
g_pSM->LogError(myself, "Could not locate FireOutputBackup - Disabling Entity Outputs");
return false;
}
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+10 -28
View File
@@ -109,34 +109,16 @@ static cell_t GetTeamCount(IPluginContext *pContext, const cell_t *params)
return g_Teams.size();
}
static int g_teamname_offset = -1;
static cell_t GetTeamName(IPluginContext *pContext, const cell_t *params)
{
int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
{
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
if (g_teamname_offset == 0)
{
return pContext->ThrowNativeError("Team names are not available on this game.");
}
if (g_teamname_offset == -1)
{
SendProp *prop = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "m_szTeamname");
if (prop == NULL)
{
g_teamname_offset = 0;
return pContext->ThrowNativeError("Team names are not available on this game.");
}
g_teamname_offset = prop->GetOffset();
}
char *name = (char *)((unsigned char *)g_Teams[teamindex].pEnt + g_teamname_offset);
static int offset = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "m_szTeamname")->GetOffset();
char *name = (char *)((unsigned char *)g_Teams[teamindex].pEnt + offset);
pContext->StringToLocalUTF8(params[2], params[3], name, NULL);
@@ -146,9 +128,9 @@ static cell_t GetTeamName(IPluginContext *pContext, const cell_t *params)
static cell_t GetTeamScore(IPluginContext *pContext, const cell_t *params)
{
int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
{
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
static int offset = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "m_iScore")->GetOffset();
@@ -159,9 +141,9 @@ static cell_t GetTeamScore(IPluginContext *pContext, const cell_t *params)
static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params)
{
int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
{
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
static int offset = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "m_iScore")->GetOffset();
@@ -173,9 +155,9 @@ static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params)
static cell_t GetTeamClientCount(IPluginContext *pContext, const cell_t *params)
{
int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
if (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
{
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
SendProp *pProp = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "\"player_array\"");
-1
View File
@@ -280,7 +280,6 @@ void ShutdownHelpers()
{
s_Teleport.Shutdown();
s_GetVelocity.Shutdown();
s_EyeAngles.Shutdown();
}
const char *GetDTTypeName(int type)
+1 -1
View File
@@ -62,7 +62,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
+1 -1
View File
@@ -43,7 +43,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
-3
View File
@@ -55,10 +55,7 @@ public:
~CriticalHitManager()
{
if (forward != NULL)
{
forwards->ReleaseForward(forward);
}
DeleteCriticalDetour();
}
+5 -5
View File
@@ -65,14 +65,14 @@ bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
if (strcmp(g_pSM->GetGameFolderName(), "tf") != 0)
{
UTIL_Format(error, maxlength, "Cannot Load TF2 Extension on mods other than TF2");
snprintf(error, maxlength, "Cannot Load TF2 Extension on mods other than TF2");
return false;
}
ServerClass *sc = UTIL_FindServerClass("CTFPlayer");
if (sc == NULL)
{
UTIL_Format(error, maxlength, "Could not find CTFPlayer server class");
snprintf(error, maxlength, "Could not find CTFPlayer server class");
return false;
}
@@ -80,18 +80,18 @@ bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
if (!UTIL_FindDataTable(sc->m_pTable, "DT_TFPlayerShared", playerSharedOffset, 0))
{
UTIL_Format(error, maxlength, "Could not find DT_TFPlayerShared data table");
snprintf(error, maxlength, "Could not find DT_TFPlayerShared data table");
return false;
}
sharesys->AddDependency(myself, "bintools.ext", true, true);
char conf_error[255] = "";
char conf_error[255];
if (!gameconfs->LoadGameConfigFile("sm-tf2.games", &g_pGameConf, conf_error, sizeof(conf_error)))
{
if (conf_error)
{
UTIL_Format(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error);
snprintf(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error);
}
return false;
}
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+1 -1
View File
@@ -43,7 +43,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
-1
View File
@@ -330,7 +330,6 @@ void TopMenu::RemoveFromMenu(unsigned int object_id)
topmenu_category_t *cat = m_Categories[i];
for (size_t j = 0; j < m_Categories[i]->obj_list.size(); j++)
{
m_ObjLookup.remove(cat->obj_list[j]->name);
cat->obj_list[j]->callbacks->OnTopMenuObjectRemoved(this, cat->obj_list[j]->object_id);
cat->obj_list[j]->is_free = true;
}
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
+2 -4
View File
@@ -36,9 +36,7 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
+2 -1
View File
@@ -18,7 +18,7 @@
}
}
"dod"
"dodsbeta"
{
"Keys"
{
@@ -67,6 +67,7 @@
{
"game" "cstrike"
"game" "dod"
"game" "dodsbeta"
"game" "sourceforts"
"game" "insurgency"
"game" "Insurgency"
+23 -23
View File
@@ -31,7 +31,7 @@
{
"#supported"
{
"game" "dod"
"game" "dodsbeta"
"game" "tf"
}
@@ -79,7 +79,7 @@
{
"#supported"
{
"game" "dod"
"game" "dodsbeta"
"game" "tf"
}
@@ -105,7 +105,7 @@
{
"#supported"
{
"game" "dod"
"game" "dodsbeta"
"game" "tf"
}
@@ -146,7 +146,7 @@
{
"#supported"
{
"game" "dod"
"game" "dodsbeta"
"game" "tf"
}
@@ -224,7 +224,7 @@
{
"#supported"
{
"game" "dod"
"game" "dodsbeta"
"game" "tf"
}
"Signatures"
@@ -324,8 +324,8 @@
}
}
/* Day of Defeat: Source */
"dod"
/* Day of Defeat: Source (Orange Box Beta) */
"dodsbeta"
{
"Offsets"
{
@@ -336,23 +336,23 @@
}
"RemovePlayerItem"
{
"windows" "238"
"linux" "239"
"windows" "237"
"linux" "238"
}
"Weapon_GetSlot"
{
"windows" "236"
"linux" "237"
"windows" "235"
"linux" "236"
}
"Ignite"
{
"windows" "193"
"linux" "194"
"windows" "192"
"linux" "193"
}
"Extinguish"
{
"windows" "197"
"linux" "198"
"windows" "196"
"linux" "197"
}
"Teleport"
{
@@ -361,18 +361,18 @@
}
"CommitSuicide"
{
"windows" "388"
"linux" "388"
"windows" "386"
"linux" "386"
}
"GetVelocity"
{
"windows" "130"
"linux" "131"
"windows" "129"
"linux" "130"
}
"EyeAngles"
{
"windows" "122"
"linux" "123"
"windows" "121"
"linux" "122"
}
"AcceptInput"
{
@@ -401,8 +401,8 @@
}
"WeaponEquip"
{
"windows" "229"
"linux" "230"
"windows" "228"
"linux" "229"
}
"Activate"
{
+132 -40
View File
@@ -32,6 +32,7 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "hl2mp"
"game" "ship"
"game" "!Dystopia"
@@ -91,6 +92,7 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "garrysmod"
"game" "hl2mp"
"game" "ship"
@@ -143,6 +145,7 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "garrysmod"
"game" "hl2mp"
"game" "ship"
@@ -195,6 +198,7 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "hl2mp"
"game" "!Insurgency"
"game" "pvkii"
@@ -244,46 +248,6 @@
}
}
}
/* EntityFactoryDictionary function */
"#default"
{
"Signatures"
{
"EntityFactory"
{
"library" "server"
"windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3"
"linux" "@_Z23EntityFactoryDictionaryv"
}
}
}
/* CBaseEntityOutput::FireOutput */
"#default"
{
"#supported"
{
"game" "cstrike"
"game" "hl2mp"
}
"Signatures"
{
"FireOutput"
{
"library" "server"
"windows" "\x81\xEC\x1C\x03\x00\x00\x53\x55\x56\x8B\x71\x14"
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
}
}
"Offsets"
{
"FireOutputBackup"
{
"windows" "6"
"linux" "6"
}
}
}
/* Counter-Strike: Source */
"cstrike"
@@ -381,6 +345,94 @@
}
}
/* Day of Defeat */
"dod"
{
"Offsets"
{
"GiveNamedItem"
{
"windows" "328"
"linux" "329"
}
"RemovePlayerItem"
{
"windows" "226"
"linux" "227"
}
"Weapon_GetSlot"
{
"windows" "224"
"linux" "225"
}
"Ignite"
{
"windows" "188"
"linux" "189"
}
"Extinguish"
{
"windows" "189"
"linux" "190"
}
"Teleport"
{
"windows" "98"
"linux" "99"
}
"CommitSuicide"
{
"windows" "356"
"linux" "357"
}
"GetVelocity"
{
"windows" "126"
"linux" "127"
}
"EyeAngles"
{
"windows" "118"
"linux" "119"
}
"AcceptInput"
{
"windows" "35"
"linux" "36"
}
"DispatchKeyValue"
{
"windows" "31"
"linux" "30"
}
"DispatchKeyValueFloat"
{
"windows" "30"
"linux" "31"
}
"DispatchKeyValueVector"
{
"windows" "29"
"linux" "32"
}
"SetEntityModel"
{
"windows" "25"
"linux" "26"
}
"WeaponEquip"
{
"windows" "217"
"linux" "218"
}
"Activate"
{
"windows" "32"
"linux" "33"
}
}
}
/* Half-Life 2: Deathmatch */
"hl2mp"
{
@@ -1766,5 +1818,45 @@
}
}
}
/* EntityFactoryDictionary function */
"#default"
{
"Signatures"
{
"EntityFactory"
{
"library" "server"
"windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3"
"linux" "@_Z23EntityFactoryDictionaryv"
}
}
}
/* CBaseEntityOutput::FireOutput */
"#default"
{
"#supported"
{
"game" "cstrike"
"game" "hl2mp"
}
"Signatures"
{
"FireOutput"
{
"library" "server"
"windows" "\x81\xEC\x1C\x03\x00\x00\x53\x55\x56\x8B\x71\x14"
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
}
}
"Offsets"
{
"FireOutputBackup"
{
"windows" "6"
"linux" "6"
}
}
}
}
+2 -4
View File
@@ -40,9 +40,7 @@
* @file Contains SourceMod version information.
*/
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3.2276"
#define SVN_FILE_VERSION 1,0,3,2276
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+2 -4
View File
@@ -40,9 +40,7 @@
* @file Contains SourceMod version information.
*/
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$.$GLOBAL_BUILD$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+1 -1
View File
@@ -1,7 +1,7 @@
[PRODUCT]
major = 1
minor = 0
revision = 4
revision = 3
[core]
folder = core
+1 -1
View File
@@ -74,7 +74,7 @@ new RebuildCachePart[3] = {0}; /** Cache part sequence numbers */
new PlayerSeq[MAXPLAYERS+1]; /** Player-specific sequence numbers */
new bool:PlayerAuth[MAXPLAYERS+1]; /** Whether a player has been "pre-authed" */
//#define _DEBUG
#define _DEBUG
public OnMapEnd()
{
+7 -82
View File
@@ -81,7 +81,7 @@ BuildDynamicMenu()
new Handle:kvMenu;
kvMenu = CreateKeyValues("Commands");
KvSetEscapeSequences(kvMenu, true);
KvSetEscapeSequences(kvMenu, true);
new String:file[256];
@@ -284,7 +284,8 @@ BuildDynamicMenu()
else
{
submenuInput[Submenu_method] = Name;
}
}
}
KvGetString(kvMenu, "title", inputBuffer, sizeof(inputBuffer));
@@ -585,16 +586,13 @@ public ParamCheck(client)
DisplayTopMenu(hAdminMenu, client, TopMenuPosition_LastCategory);
decl String:unquotedCommand[CMD_LENGTH];
UnQuoteString(g_command[client], unquotedCommand, sizeof(unquotedCommand), "#@");
if (outputItem[Item_execute] == Execute_Player) // assume 'player' type execute option
{
FakeClientCommand(client, unquotedCommand);
FakeClientCommand(client, g_command[client]);
}
else // assume 'server' type execute option
{
InsertServerCommand(unquotedCommand);
InsertServerCommand(g_command[client]);
ServerExecute();
}
@@ -612,20 +610,16 @@ public Menu_Selection(Handle:menu, MenuAction:action, param1, param2)
if (action == MenuAction_Select)
{
new String:unquotedinfo[NAME_LENGTH];
new String:info[NAME_LENGTH];
/* Get item info */
new bool:found = GetMenuItem(menu, param2, unquotedinfo, sizeof(unquotedinfo));
new bool:found = GetMenuItem(menu, param2, info, sizeof(info));
if (!found)
{
return;
}
new String:info[NAME_LENGTH*2+1];
QuoteString(unquotedinfo, info, sizeof(info), "#@");
new String:buffer[6];
new String:infobuffer[NAME_LENGTH+2];
Format(infobuffer, sizeof(infobuffer), "\"%s\"", info);
@@ -650,72 +644,3 @@ public Menu_Selection(Handle:menu, MenuAction:action, param1, param2)
DisplayTopMenu(hAdminMenu, param1, TopMenuPosition_LastCategory);
}
}
stock bool:QuoteString(String:input[], String:output[], maxlen, String:quotechars[])
{
new count = 0;
new len = strlen(input);
for (new i=0; i<len; i++)
{
output[count] = input[i];
count++;
if (count >= maxlen)
{
/* Null terminate for safety */
output[maxlen-1] = 0;
return false;
}
if (FindCharInString(quotechars, input[i]) != -1 || input[i] == '\\')
{
/* This char needs escaping */
output[count] = '\\';
count++;
if (count >= maxlen)
{
/* Null terminate for safety */
output[maxlen-1] = 0;
return false;
}
}
}
output[count] = 0;
return true;
}
stock bool:UnQuoteString(String:input[], String:output[], maxlen, String:quotechars[])
{
new count = 1;
new len = strlen(input);
output[0] = input[0];
for (new i=1; i<len; i++)
{
output[count] = input[i];
count++;
if (input[i+1] == '\\' && (input[i] == '\\' || FindCharInString(quotechars, input[i]) != -1))
{
/* valid quotechar followed by a backslash - Skip */
i++;
}
if (count >= maxlen)
{
/* Null terminate for safety */
output[maxlen-1] = 0;
return false;
}
}
output[count] = 0;
return true;
}
-1
View File
@@ -49,7 +49,6 @@ public Plugin:myinfo =
new Handle:hTopMenu = INVALID_HANDLE;
new g_BanTarget[MAXPLAYERS+1];
new g_BanTargetUserId[MAXPLAYERS+1];
new g_BanTime[MAXPLAYERS+1];
#include "basebans/ban.sp"
+20 -39
View File
@@ -10,7 +10,7 @@
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
@@ -30,25 +30,9 @@
*
* Version: $Id$
*/
PrepareBan(client, target, time, const String:reason[])
{
new originalTarget = GetClientOfUserId(g_BanTargetUserId[client]);
if (originalTarget != target)
{
if (!client)
{
PrintToServer("[SM] %t", "Player no longer available");
}
else
{
PrintToChat(client, "[SM] %t", "Player no longer available");
}
return;
}
decl String:authid[64], String:name[32];
GetClientAuthString(target, authid, sizeof(authid));
GetClientName(target, name, sizeof(name));
@@ -85,26 +69,26 @@ PrepareBan(client, target, time, const String:reason[])
DisplayBanTargetMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_BanPlayerList);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
AddTargetsToMenu2(menu, client, COMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED);
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
DisplayBanTimeMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_BanTimeList);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
AddMenuItem(menu, "0", "Permanent");
AddMenuItem(menu, "10", "10 Minutes");
AddMenuItem(menu, "30", "30 Minutes");
@@ -112,21 +96,21 @@ DisplayBanTimeMenu(client)
AddMenuItem(menu, "240", "4 Hours");
AddMenuItem(menu, "1440", "1 Day");
AddMenuItem(menu, "10080", "1 Week");
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
DisplayBanReasonMenu(client)
{
new Handle:menu = CreateMenu(MenuHandler_BanReasonList);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban reason", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
/* :TODO: we should either remove this or make it configurable */
AddMenuItem(menu, "Abusive", "Abusive");
AddMenuItem(menu, "Racism", "Racism");
AddMenuItem(menu, "General cheating/exploits", "General cheating/exploits");
@@ -140,11 +124,11 @@ DisplayBanReasonMenu(client)
AddMenuItem(menu, "Unacceptable Spray", "Unacceptable Spray");
AddMenuItem(menu, "Breaking Server Rules", "Breaking Server Rules");
AddMenuItem(menu, "Other", "Other");
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}
public AdminMenu_Ban(Handle:topmenu,
public AdminMenu_Ban(Handle:topmenu,
TopMenuAction:action,
TopMenuObject:object_id,
param,
@@ -177,9 +161,9 @@ public MenuHandler_BanReasonList(Handle:menu, MenuAction:action, param1, param2)
else if (action == MenuAction_Select)
{
decl String:info[64];
GetMenuItem(menu, param2, info, sizeof(info));
PrepareBan(param1, g_BanTarget[param1], g_BanTime[param1], info);
}
}
@@ -201,7 +185,7 @@ public MenuHandler_BanPlayerList(Handle:menu, MenuAction:action, param1, param2)
{
decl String:info[32], String:name[32];
new userid, target;
GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
userid = StringToInt(info);
@@ -216,7 +200,6 @@ public MenuHandler_BanPlayerList(Handle:menu, MenuAction:action, param1, param2)
else
{
g_BanTarget[param1] = target;
g_BanTargetUserId[param1] = userid;
DisplayBanTimeMenu(param1);
}
}
@@ -238,10 +221,10 @@ public MenuHandler_BanTimeList(Handle:menu, MenuAction:action, param1, param2)
else if (action == MenuAction_Select)
{
decl String:info[32];
GetMenuItem(menu, param2, info, sizeof(info));
g_BanTime[param1] = StringToInt(info);
DisplayBanReasonMenu(param1);
}
}
@@ -254,12 +237,12 @@ public Action:Command_Ban(client, args)
ReplyToCommand(client, "[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]");
return Plugin_Handled;
}
decl len, next_len;
decl String:Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));
decl String:arg[65];
decl String:arg[65];
len = BreakString(Arguments, arg, sizeof(arg));
new target = FindTarget(client, arg, true);
@@ -281,8 +264,6 @@ public Action:Command_Ban(client, args)
new time = StringToInt(s_time);
g_BanTargetUserId[client] = GetClientUserId(target);
PrepareBan(client, target, time, Arguments[len]);
return Plugin_Handled;
+1 -1
View File
@@ -129,7 +129,7 @@ public Action:Command_SayChat(client, args)
new len = BreakString(message, arg, sizeof(arg));
new target = FindTarget(client, arg, true, false);
if (target == -1 || len == -1)
if (target == -1)
return Plugin_Handled;
decl String:name2[64];
+2 -23
View File
@@ -634,28 +634,7 @@ native Float:GetClientAvgPackets(client, NetFlow:flow);
native GetClientOfUserId(userid);
/**
* Disconnects a client from the server as soon as the next frame starts.
*
* Note: Originally, KickClient() was immediate. The delay was introduced
* because despite warnings, plugins were using it in ways that would crash.
* The new safe version can break cases that rely on immediate disconnects,
* but ensures that plugins do not accidentally cause crashes.
*
* If you need immediate disconnects, use KickClientEx().
*
* Note: IsClientInKickQueue() will return true before the kick occurs.
*
* @param client Client index.
* @param format Optional formatting rules for disconnect reason.
* Note that a period is automatically appended to the string by the engine.
* @param ... Variable number of format parameters.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native KickClient(client, const String:format[]="", any:...);
/**
* Immediately disconnects a client from the server.
* Disconnects a client from the server.
*
* Kicking clients from certain events or callbacks may cause crashes. If in
* doubt, create a short (0.1 second) timer to kick the client in the next
@@ -668,7 +647,7 @@ native KickClient(client, const String:format[]="", any:...);
* @noreturn
* @error Invalid client index, or client not connected.
*/
native KickClientEx(client, const String:format[]="", any:...);
native KickClient(client, const String:format[]="", any:...);
/**
* Changes a client's team through the mod's generic team changing function.
+1 -9
View File
@@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@@ -298,8 +298,6 @@ functag SrvCmd Action:public(args);
/**
* Creates a server-only console command, or hooks an already existing one.
*
* Server commands are case sensitive.
*
* @param cmd Name of the command to hook or create.
* @param callback A function to use as a callback for when the command is invoked.
* @param description Optional description to use for command creation.
@@ -322,10 +320,6 @@ functag ConCmd Action:public(client, args);
/**
* Creates a console command, or hooks an already existing one.
*
* Console commands are case sensitive. However, if the command already exists in the game,
* the a client may enter the command in any case. SourceMod corrects for this automatically,
* and you should only hook the "real" version of the command.
*
* @param cmd Name of the command to hook or create.
* @param callback A function to use as a callback for when the command is invoked.
* @param description Optional description to use for command creation.
@@ -340,8 +334,6 @@ native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:descripti
* it is created. When this command is invoked, the access rights of the player are
* automatically checked before allowing it to continue.
*
* Admin commands are case sensitive from both the client and server.
*
* @param cmd String containing command to register.
* @param callback A function to use as a callback for when the command is invoked.
* @param adminflags Administrative flags (bitstring) to use for permissions.
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
+2 -2
View File
@@ -37,6 +37,6 @@
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
#define SOURCEMOD_V_MINOR 0 /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE 4 /**< SourceMod Release version */
#define SOURCEMOD_V_RELEASE 3 /**< SourceMod Release version */
#define SOURCEMOD_VERSION "1.0.4" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "1.0.3" /**< SourceMod version string (major.minor.release.build) */
+1 -1
View File
@@ -39,4 +39,4 @@
#define SOURCEMOD_V_MINOR $PMINOR$ /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE $PREVISION$ /**< SourceMod Release version */
#define SOURCEMOD_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" /**< SourceMod version string (major.minor.release.build) */
-1
View File
@@ -1 +0,0 @@
1.0.4
+60 -5
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -50,7 +50,7 @@
using namespace SourcePawn;
#define SMINTERFACE_FORWARDMANAGER_NAME "IForwardManager"
#define SMINTERFACE_FORWARDMANAGER_VERSION 3
#define SMINTERFACE_FORWARDMANAGER_VERSION 2
/*
* There is some very important documentation at the bottom of this file.
@@ -79,11 +79,66 @@ namespace SourceMod
ET_Single = 1, /**< Only return the last exec, ignore all others */
ET_Event = 2, /**< Acts as an event with the ResultTypes above, no mid-Stops allowed, returns highest */
ET_Hook = 3, /**< Acts as a hook with the ResultTypes above, mid-Stops allowed, returns highest */
ET_LowEvent = 4, /**< Same as ET_Event except that it returns the lowest value */
ET_Custom = 4, /**< Ignored or handled by an IForwardFilter */
};
class IForward;
class IForwardFilter;
/**
* @brief Allows interception of how the Forward System executes functions.
*/
class IForwardFilter
{
public:
/**
* @brief Called when an error occurs executing a plugin.
*
* @param fwd IForward pointer.
* @param func IPluginFunction pointer to the failed function.
* @param err Error code.
* @return True to handle, false to pass to global error reporter.
*/
virtual bool OnErrorReport(IForward *fwd,
IPluginFunction *func,
int err)
{
return false;
}
/**
* @brief Called after each function return during execution.
* NOTE: Only used for ET_Custom.
*
* @param fwd IForward pointer.
* @param func IPluginFunction pointer to the executed function.
* @param retval Pointer to current return value (can be modified).
* @return ResultType denoting the next action to take.
*/
virtual ResultType OnFunctionReturn(IForward *fwd,
IPluginFunction *func,
cell_t *retval)
{
return Pl_Continue;
}
/**
* @brief Called when execution begins.
*/
virtual void OnExecuteBegin()
{
};
/**
* @brief Called when execution ends.
*
* @param final_ret Final return value (modifiable).
* @param success Number of successful execs.
* @param failed Number of failed execs.
*/
virtual void OnExecuteEnd(cell_t *final_ret, unsigned int success, unsigned int failed)
{
}
};
/**
* @brief Unmanaged Forward, abstracts calling multiple functions as "forwards," or collections of functions.
@@ -125,7 +180,7 @@ namespace SourceMod
* @brief Executes the forward.
*
* @param result Optional pointer to store result in.
* @param filter Do not use.
* @param filter Optional pointer to an IForwardFilter.
* @return Error code, if any.
*/
virtual int Execute(cell_t *result, IForwardFilter *filter=NULL) =0;
+3 -3
View File
@@ -246,7 +246,7 @@ namespace SourceMod
* permissions.
* @param ident Security token for any permissions. If typeAccess is NULL, this
* becomes the owning identity.
* @param err Optional pointer to store an error code on failure (undefined on success).
* @param err Optional pointer to store an error code.
* @return A new HandleType_t unique ID, or 0 on failure.
*/
virtual HandleType_t CreateType(const char *name,
@@ -283,7 +283,7 @@ namespace SourceMod
* @param object Object to bind to the handle.
* @param owner Owner of the new Handle (may be NULL).
* @param ident Identity for type access if needed (may be NULL).
* @param err Optional pointer to store an error code on failure (undefined on success).
* @param err Optional pointer to store an error code.
* @return A new Handle_t, or 0 on failure.
*/
virtual Handle_t CreateHandle(HandleType_t type,
@@ -349,7 +349,7 @@ namespace SourceMod
* @param pSec Security pointer; pOwner is written as the owner,
* pIdent is used as the parent identity for authorization.
* @param pAccess Access right descriptor for the Handle; NULL for type defaults.
* @param err Optional pointer to store an error code on failure (undefined on success).
* @param err Optional pointer to store an error code.
* @return A new Handle_t, or 0 on failure.
*/
virtual Handle_t CreateHandleEx(HandleType_t type,
+1 -1
View File
@@ -39,7 +39,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+1 -1
View File
@@ -42,7 +42,7 @@ endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
HL2LIB = $(HL2SDK_OB)/linux_sdk
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
-1
View File
@@ -1 +0,0 @@
2
+1
View File
@@ -1641,6 +1641,7 @@ static int substpattern(unsigned char *line,size_t buffersize,char *pattern,char
if (args[arg]!=NULL) {
strins((char*)s,(char*)args[arg],strlen((char*)args[arg]));
s+=strlen((char*)args[arg]);
e++;
} else {
error(236); /* parameter does not exist, incorrect #define pattern */
strins((char*)s,(char*)e,2);
-9
View File
@@ -1346,15 +1346,6 @@ static int hier13(value *lval)
if ((array1 && array2) && (total1 && total2)) {
markheap(MEMUSE_DYNAMIC, 0);
}
/* If both sides are arrays, we should return the maximal as the lvalue.
* Otherwise we could buffer overflow and the compiler is too stupid.
* Literal strings have a constval == -(num_cells) so the cmp is flipped.
*/
if (lval->ident==iARRAY && lval2.ident==iARRAY
&& lval->constval < 0
&& lval->constval > lval2.constval) {
*lval = lval2;
}
if (lval->ident==iARRAY)
lval->ident=iREFARRAY; /* iARRAY becomes iREFARRAY */
else if (lval->ident!=iREFARRAY)
+2 -4
View File
@@ -19,9 +19,7 @@
* @file Contains SourceMod version information.
*/
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2269
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+2 -4
View File
@@ -19,9 +19,7 @@
* @file Contains SourceMod version information.
*/
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$LOCAL_BUILD$
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+2 -4
View File
@@ -16,9 +16,7 @@
#ifndef _INCLUDE_JIT_VERSION_H_
#define _INCLUDE_JIT_VERSION_H_
#define SM_BUILD_STRING ""
#define SM_BUILD_UNIQUEID "2537" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.0.4" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,0,4,0
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2269
#endif //_INCLUDE_JIT_VERSION_H_
+2 -4
View File
@@ -16,9 +16,7 @@
#ifndef _INCLUDE_JIT_VERSION_H_
#define _INCLUDE_JIT_VERSION_H_
#define SM_BUILD_STRING "$BUILD_STRING$"
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$LOCAL_BUILD$
#endif //_INCLUDE_JIT_VERSION_H_
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/perl
use strict;
use Cwd;
use File::Basename;
my ($myself, $path) = fileparse($0);
chdir($path);
require 'helpers.pm';
chdir(Build::PathFormat('../builder'));
if ($^O eq "linux")
{
Build::Command('make clean');
Build::Command('make');
}
else
{
Build::Command('"' . $ENV{'MSVC7'} . '" /Rebuild Release builder.csproj');
Build::Command('move ' . Build::PathFormat('bin/Release/builder.exe') . ' .');
}
die "Unable to build builder tool!\n" unless -e 'builder.exe';
#Go back to main source dir.
chdir(Build::PathFormat('../..'));
#Get the source path.
my ($root) = getcwd();
#Create output folder if it doesn't exist.
if (!(-d 'OUTPUT')) {
mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
}
#Write the configuration file.
open(CONF, '>build.cfg') or die("Failed to write build.cfg: $!\n");
print CONF "OutputBase = " . Build::PathFormat($root . '/OUTPUT') . "\n";
print CONF "SourceBase = $root\n";
if ($^O eq "linux")
{
print CONF "BuilderPath = /usr/bin/make\n";
}
else
{
print CONF "BuilderPath = " . $ENV{'MSVC8'} . "\n";
print CONF "PDBLog = $root\\OUTPUT\\pdblog.txt\n";
}
close(CONF);
#Do the annoying revision bumping.
#Linux needs some help here.
if ($^O eq "linux")
{
Build::Command("flip -u modules.versions");
Build::Command("flip -u tools/versionchanger.pl");
Build::Command("chmod +x tools/versionchanger.pl");
}
Build::Command(Build::PathFormat('tools/versionchanger.pl') . ' --buildstring="-dev"');
-126
View File
@@ -1,126 +0,0 @@
#!/usr/bin/perl
use strict;
use Cwd;
package Build;
our $SVN = "/usr/bin/svn";
our $SVN_USER = 'dvander';
our $SVN_ARGS = '';
sub Revision
{
my ($str)=(@_);
my $data = Command('svnversion -c ' . $str);
if ($data =~ /(\d+):(\d+)/)
{
return $2;
} elsif ($data =~ /(\d+)/) {
return $1;
} else {
return 0;
}
}
sub ProductVersion
{
my ($file) = (@_);
my ($version);
open(FILE, $file) or die "Could not open $file: $!\n";
$version = <FILE>;
close(FILE);
chomp $version;
return $version;
}
sub Delete
{
my ($str)=(@_);
if ($^O =~ /MSWin/)
{
Command("del /S /F /Q \"$str\"");
Command("rmdir /S /Q \"$str\"");
} else {
Command("rm -rf $str");
}
return !(-e $str);
}
sub Copy
{
my ($src,$dest)=(@_);
if ($^O =~ /MSWin/)
{
Command("copy \"$src\" \"$dest\" /y");
} else {
Command("cp \"$src\" \"$dest\"");
}
return (-e $dest);
}
sub Move
{
my ($src,$dest)=(@_);
if ($^O =~ /MSWin/)
{
Command("move \"$src\" \"$dest\"");
} else {
Command("mv \"$src\" \"$dest\"");
}
return (-e $dest);
}
sub Command
{
my($cmd)=(@_);
print "$cmd\n";
return `$cmd`;
}
sub PathFormat
{
my ($str)=(@_);
if ($^O =~ /MSWin/)
{
$str =~ s#/#\\#g;
} else {
$str =~ s#\\#/#g;
}
return $str;
}
sub SVN_Remove
{
my ($file)=(@_);
my ($path, $name);
if ($^O =~ /MSWin/)
{
($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
} else {
($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
}
my $dir = Cwd::cwd();
chdir($path);
Command($SVN . ' ' . $SVN_ARGS . ' delete ' . $name);
chdir($dir);
}
sub SVN_Add
{
my ($file)=(@_);
my ($path, $name);
if ($^O =~ /MSWin/)
{
($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
} else {
($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
}
my $dir = Cwd::cwd();
chdir($path);
Command($SVN . ' ' . $SVN_ARGS . ' add ' . $name);
chdir($dir);
}
return 1;
-251
View File
@@ -1,251 +0,0 @@
# -*- python -*-
# ex: set syntax=python:
# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory (although the filename
# can be changed with the --basedir option to 'mktap buildbot master').
# It has one job: define a dictionary named BuildmasterConfig. This
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}
####### BUILDSLAVES
# the 'slaves' list defines the set of allowable buildslaves. Each element is
# a tuple of bot-name and bot-password. These correspond to values given to
# the buildslave's mktap invocation.
from buildbot.buildslave import BuildSlave
c['slaves'] = [
BuildSlave("linux", "***********"),
BuildSlave("win32", "***********")
]
# to limit to two concurrent builds on a slave, use
# c['slaves'] = [BuildSlave("bot1name", "bot1passwd", max_builds=2)]
# 'slavePortnum' defines the TCP port to listen on. This must match the value
# configured into the buildslaves (with their --master option)
c['slavePortnum'] = 0000
####### CHANGESOURCES
# the 'change_source' setting tells the buildmaster how it should find out
# about source code changes. Any class which implements IChangeSource can be
# put here: there are several in buildbot/changes/*.py to choose from.
from buildbot.changes.pb import PBChangeSource
c['change_source'] = PBChangeSource()
# For example, if you had CVSToys installed on your repository, and your
# CVSROOT/freshcfg file had an entry like this:
#pb = ConfigurationSet([
# (None, None, None, PBService(userpass=('foo', 'bar'), port=4519)),
# ])
# then you could use the following buildmaster Change Source to subscribe to
# the FreshCVS daemon and be notified on every commit:
#
#from buildbot.changes.freshcvs import FreshCVSSource
#fc_source = FreshCVSSource("cvs.example.com", 4519, "foo", "bar")
#c['change_source'] = fc_source
# or, use a PBChangeSource, and then have your repository's commit script run
# 'buildbot sendchange', or use contrib/svn_buildbot.py, or
# contrib/arch_buildbot.py :
#
#from buildbot.changes.pb import PBChangeSource
#c['change_source'] = PBChangeSource()
####### SCHEDULERS
## configure the Schedulers
from buildbot.scheduler import Scheduler
schedTrunk = Scheduler(
name = "1.1-trunk",
branch = "trunk",
treeStableTimer = 1*60,
builderNames = ["linux-trunk", "win32-trunk"]
)
schedStable = Scheduler(
name = "1.0-stable",
branch = "branches/sourcemod-1.0.x",
treeStableTimer = 1*60,
builderNames = ["linux-stable", "win32-stable"]
)
c['schedulers'] = [schedStable, schedTrunk]
####### BUILDERS
# the 'builders' list defines the Builders. Each one is configured with a
# dictionary, using the following keys:
# name (required): the name used to describe this bilder
# slavename (required): which slave to use, must appear in c['bots']
# builddir (required): which subdirectory to run the builder in
# factory (required): a BuildFactory to define how the build is run
# periodicBuildTime (optional): if set, force a build every N seconds
# buildbot/process/factory.py provides several BuildFactory classes you can
# start with, which implement build processes for common targets (GNU
# autoconf projects, CPAN perl modules, etc). The factory.BuildFactory is the
# base class, and is configured with a series of BuildSteps. When the build
# is run, the appropriate buildslave is told to execute each Step in turn.
# the first BuildStep is typically responsible for obtaining a copy of the
# sources. There are source-obtaining Steps in buildbot/steps/source.py for
# CVS, SVN, and others.
from buildbot.process import factory
from buildbot.steps.shell import Compile
from buildbot.steps.shell import ShellCommand
from buildbot.steps.transfer import FileDownload
from buildbot.steps.source import SVN
from buildbot.process.properties import WithProperties
from buildbot.steps.python_twisted import Trial
from buildbot import locks
pdb_lock = locks.MasterLock("symbolstore")
def create_factory(sep, os):
f1 = factory.BuildFactory()
f1.addStep(SVN(baseURL = "svn://svn.alliedmods.net/am/sourcemod/",
mode = "copy"
)
)
f1.addStep(ShellCommand(
haltOnFailure = 1,
name = "bootstrap",
command = ["tools" + sep + "buildbot" + sep + "bootstrap.pl"],
description = "bootstrapping",
descriptionDone = "bootstrapped"
))
f1.addStep(ShellCommand(
haltOnFailure = 1,
name = "build",
command = ["tools" + sep + "buildbot" + sep + "startbuild.pl"],
description = "compiling",
descriptionDone = "compiled"
))
f1.addStep(ShellCommand(
haltOnFailure = 1,
name = "upload",
command = ["tools" + sep + "buildbot" + sep + "package.pl",
".." + sep + ".." + sep + "smdrop_info"
],
description = "packaging",
descriptionDone = "uploaded"
))
if os == "win32":
f1.addStep(ShellCommand(
haltOnFailure = 1,
locks = [pdb_lock],
name = "symstore",
command = ["tools" + sep + "buildbot" + sep + "symstore.pl"],
description = "symstore",
descriptionDone = "symstore"
))
return f1
facWin = create_factory("\\", "win32")
facLinux = create_factory("/", "linux")
buildLinuxStable = {
'name': 'linux-stable',
'slavename': 'linux',
'builddir': 'linux-stable',
'factory': facLinux
}
buildLinuxTrunk = {
'name': "linux-trunk",
'slavename': "linux",
'builddir': "linux-trunk",
'factory': facLinux
}
buildWindowsStable = {
'name': 'win32-stable',
'slavename': 'win32',
'builddir': 'win32-stable',
'factory': facWin
}
buildWindowsTrunk = {
'name': "win32-trunk",
'slavename': "win32",
'builddir': "win32-trunk",
'factory': facWin
}
c['builders'] = [buildLinuxTrunk, buildWindowsTrunk, buildLinuxStable, buildWindowsStable]
####### STATUS TARGETS
# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.
c['status'] = []
from buildbot.status import html
c['status'].append(html.WebStatus(http_port=8010))
# from buildbot.status import mail
# c['status'].append(mail.MailNotifier(fromaddr="buildbot@localhost",
# extraRecipients=["[email protected]"],
# sendToInterestedUsers=False))
#
# from buildbot.status import words
# c['status'].append(words.IRC(host="irc.example.com", nick="bb",
# channels=["#example"]))
#
# from buildbot.status import client
# c['status'].append(client.PBListener(9988))
####### DEBUGGING OPTIONS
# if you set 'debugPassword', then you can connect to the buildmaster with
# the diagnostic tool in contrib/debugclient.py . From this tool, you can
# manually force builds and inject changes, which may be useful for testing
# your buildmaster without actually commiting changes to your repository (or
# before you have a functioning 'sources' set up). The debug tool uses the
# same port number as the slaves do: 'slavePortnum'.
#c['debugPassword'] = "debugpassword"
# if you set 'manhole', you can ssh into the buildmaster and get an
# interactive python shell, which may be useful for debugging buildbot
# internals. It is probably only useful for buildbot developers. You can also
# use an authorized_keys file, or plain telnet.
#from buildbot import manhole
#c['manhole'] = manhole.PasswordManhole("tcp:9999:interface=127.0.0.1",
# "admin", "password")
####### PROJECT IDENTITY
# the 'projectName' string will be used to describe the project that this
# buildbot is working on. For example, it is used as the title of the
# waterfall HTML page. The 'projectURL' string will be used to provide a link
# from buildbot HTML pages to your project's home page.
c['projectName'] = "SourceMod"
c['projectURL'] = "http://www.sourcemod.net/"
# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server (usually the html.Waterfall page) is visible. This
# typically uses the port number set in the Waterfall 'status' entry, but
# with an externally-visible host name which the buildbot cannot figure out
# without some help.
c['buildbotURL'] = "http://localhost:8010/"
-78
View File
@@ -1,78 +0,0 @@
#!/usr/bin/perl
use strict;
use Cwd;
use File::Basename;
use Net::FTP;
my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path);
$ftp_file = shift;
open(FTP, $ftp_file) or die "Unable to read FTP config file $ftp_file: $!\n";
$ftp_host = <FTP>;
$ftp_user = <FTP>;
$ftp_pass = <FTP>;
$ftp_path = <FTP>;
close(FTP);
chomp $ftp_host;
chomp $ftp_user;
chomp $ftp_pass;
chomp $ftp_path;
my ($myself, $path) = fileparse($0);
chdir($path);
require 'helpers.pm';
#Switch to the output folder.
chdir(Build::PathFormat('../../OUTPUT/base'));
my ($version);
$version = Build::ProductVersion(Build::PathFormat('../../product.version'));
$version .= '.' . Build::Revision('../..');
my ($filename);
$filename = 'sourcemod-' . $version;
if ($^O eq "linux")
{
$filename .= '.tar.gz';
print "tar zcvf $filename addons cfg\n";
system("tar zcvf $filename addons cfg");
}
else
{
$filename .= '.zip';
print "zip -r $filename addons cfg\n";
system("zip -r $filename addons cfg");
}
my ($major,$minor) = ($version =~ /^(\d+)\.(\d+)/);
$ftp_path .= "/$major.$minor";
my ($ftp);
$ftp = Net::FTP->new($ftp_host, Debug => 0)
or die "Cannot connect to host $ftp_host: $@";
$ftp->login($ftp_user, $ftp_pass)
or die "Cannot connect to host $ftp_host as $ftp_user: " . $ftp->message . "\n";
if ($ftp_path ne '')
{
$ftp->cwd($ftp_path)
or die "Cannot change to folder $ftp_path: " . $ftp->message . "\n";
}
$ftp->binary();
$ftp->put($filename)
or die "Cannot drop file $filename ($ftp_path): " . $ftp->message . "\n";
$ftp->close();
print "File sent to drop site as $filename -- build succeeded.\n";
exit(0);
-39
View File
@@ -1,39 +0,0 @@
#!/usr/bin/perl
use File::Basename;
my ($myself, $path) = fileparse($0);
chdir($path);
require 'helpers.pm';
chdir('..');
chdir('..');
my ($cmd, $output);
$cmd = Build::PathFormat('tools/builder/builder.exe') . ' build.cfg 2>&1';
if ($^O eq "linux")
{
$cmd = 'mono ' . $cmd;
}
system($cmd);
if ($? == -1)
{
die "Build failed: $!\n";
}
elsif ($^O eq "linux" and $? & 127)
{
die "Build died :(\n";
}
elsif ($? >> 8 != 0)
{
die "Build failed with exit code: " . ($? >> 8) . "\n";
}
else
{
exit(0);
}
-44
View File
@@ -1,44 +0,0 @@
#!/usr/bin/perl
use File::Basename;
my ($myself, $path) = fileparse($0);
chdir($path);
require 'helpers.pm';
chdir('..');
chdir('..');
our $SSH = 'ssh -i ../../smpvkey';
open(PDBLOG, 'OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n";
#Sync us up with the main symbol store
rsync('[email protected]:~/public_html/symbols/', '..\\..\\symstore');
#Get version info
my ($version);
$version = Build::ProductVersion(Build::PathFormat('product.version'));
$version .= '.' . Build::Revision('.');
my ($line);
while (<PDBLOG>)
{
$line = $_;
$line =~ s/\.pdb/\*/;
chomp $line;
Build::Command("symstore add /r /f \"$line\" /s ..\\..\\symstore /t \"SourceMod\" /v \"$version\" /c \"buildbot\"");
}
close(PDBLOG);
#Now that we're done, rsync back.
rsync('../../symstore/', '[email protected]:~/public_html/symbols');
sub rsync
{
my ($from, $to) = (@_);
Build::Command('rsync -av --delete -e="' . $SSH . '" ' . $from . ' ' . $to);
}
+1
View File
@@ -44,6 +44,7 @@ namespace builder
p.WaitForExit();
p.Close();
Console.WriteLine("Debug: wd = " + info.WorkingDirectory + " fn = " + info.FileName + " arg = " + info.Arguments);
Console.WriteLine(output);
string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
+1 -4
View File
@@ -43,11 +43,8 @@ namespace builder
}
catch (System.Exception e)
{
Console.WriteLine("Build failed, exception: " + e.Message);
Environment.Exit(1);
Console.WriteLine("Build failed: " + e.Message);
}
Environment.Exit(0);
}
}
}
+165 -169
View File
@@ -1,169 +1,165 @@
#!/usr/bin/perl
our %arguments =
(
'config' => 'modules.versions',
'major' => '1',
'minor' => '0',
'revision' => '0',
'build' => undef,
'svnrev' => 'global',
'path' => '',
'buildstring' => '',
);
my $arg;
foreach $arg (@ARGV)
{
$arg =~ s/--//;
@arg = split(/=/, $arg);
$arguments{$arg[0]} = $arg[1];
}
#Set up path info
if ($arguments{'path'} ne "")
{
if (!(-d $arguments{'path'}))
{
die "Unable to find path: " . $arguments{'path'} ."\n";
}
chdir($arguments{'path'});
}
if (!open(CONFIG, $arguments{'config'}))
{
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
}
our %modules;
my $cur_module = undef;
my $line;
while (<CONFIG>)
{
chomp;
$line = $_;
if ($line =~ /^\[([^\]]+)\]$/)
{
$cur_module = $1;
next;
}
if (!$cur_module)
{
next;
}
if ($line =~ /^([^=]+) = (.+)$/)
{
$modules{$cur_module}{$1} = $2;
}
}
close(CONFIG);
#Copy global configuration options...
if (exists($modules{'PRODUCT'}))
{
if (exists($modules{'PRODUCT'}{'major'}))
{
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
}
if (exists($modules{'PRODUCT'}{'minor'}))
{
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
}
if (exists($modules{'PRODUCT'}{'revision'}))
{
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
}
if (exists($modules{'PRODUCT'}{'svnrev'}))
{
$arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
}
}
#Get the global SVN revision if we have none
my $rev;
if ($arguments{'build'} == undef)
{
$rev = GetRevision(undef);
} else {
$rev = int($arguments{'build'});
}
my $major = $arguments{'major'};
my $minor = $arguments{'minor'};
my $revision = $arguments{'revision'};
my $svnrev = $arguments{'svnrev'};
my $buildstr = $arguments{'buildstring'};
#Go through everything now
my $mod_i;
while ( ($cur_module, $mod_i) = each(%modules) )
{
#Skip the magic one
if ($cur_module eq "PRODUCT")
{
next;
}
#Prepare path
my %mod = %{$mod_i};
my $infile = $mod{'in'};
my $outfile = $mod{'out'};
if ($mod{'folder'})
{
if (!(-d $mod{'folder'}))
{
die "Folder " . $mod{'folder'} . " not found.\n";
}
$infile = $mod{'folder'} . '/' . $infile;
$outfile = $mod{'folder'} . '/' . $outfile;
}
if (!(-f $infile))
{
die "File $infile is not a file.\n";
}
my $global_rev = $rev;
my $local_rev = GetRevision($mod{'folder'});
if ($arguments{'svnrev'} eq 'local')
{
$global_rev = $local_rev;
}
#Start rewriting
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
while (<INFILE>)
{
s/\$PMAJOR\$/$major/g;
s/\$PMINOR\$/$minor/g;
s/\$PREVISION\$/$revision/g;
s/\$GLOBAL_BUILD\$/$rev/g;
s/\$LOCAL_BUILD\$/$local_rev/g;
s/\$BUILD_ID\$/$rev/g;
s/\$BUILD_STRING\$/$buildstr/g;
print OUTFILE $_;
}
close(OUTFILE);
close(INFILE);
}
sub GetRevision
{
my ($path)=(@_);
my $rev;
if (!$path)
{
$rev = `svnversion --committed`;
} else {
$rev = `svnversion --committed $path`;
}
if ($rev =~ /exported/)
{
die "Path specified is not a working copy\n";
} elsif ($rev =~ /(\d+):(\d+)/) {
$rev = int($2);
} elsif ($rev =~ /(\d+)/) {
$rev = int($1);
} else {
die "Unknown svnversion response: $rev\n";
}
return $rev;
}
#!/usr/bin/perl
our %arguments =
(
'config' => 'modules.versions',
'major' => '1',
'minor' => '0',
'revision' => '0',
'build' => undef,
'svnrev' => 'global',
'path' => '',
);
my $arg;
foreach $arg (@ARGV)
{
$arg =~ s/--//;
@arg = split(/=/, $arg);
$arguments{$arg[0]} = $arg[1];
}
#Set up path info
if ($arguments{'path'} ne "")
{
if (!(-d $arguments{'path'}))
{
die "Unable to find path: " . $arguments{'path'} ."\n";
}
chdir($arguments{'path'});
}
if (!open(CONFIG, $arguments{'config'}))
{
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
}
our %modules;
my $cur_module = undef;
my $line;
while (<CONFIG>)
{
chomp;
$line = $_;
if ($line =~ /^\[([^\]]+)\]$/)
{
$cur_module = $1;
next;
}
if (!$cur_module)
{
next;
}
if ($line =~ /^([^=]+) = (.+)$/)
{
$modules{$cur_module}{$1} = $2;
}
}
close(CONFIG);
#Copy global configuration options...
if (exists($modules{'PRODUCT'}))
{
if (exists($modules{'PRODUCT'}{'major'}))
{
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
}
if (exists($modules{'PRODUCT'}{'minor'}))
{
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
}
if (exists($modules{'PRODUCT'}{'revision'}))
{
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
}
if (exists($modules{'PRODUCT'}{'svnrev'}))
{
$arguments{'svnrev'} = $modules{'PRODUCT'}{'svnrev'};
}
}
#Get the global SVN revision if we have none
my $rev;
if ($arguments{'build'} == undef)
{
$rev = GetRevision(undef);
} else {
$rev = int($arguments{'build'});
}
my $major = $arguments{'major'};
my $minor = $arguments{'minor'};
my $revision = $arguments{'revision'};
my $svnrev = $arguments{'svnrev'};
#Go through everything now
my $mod_i;
while ( ($cur_module, $mod_i) = each(%modules) )
{
#Skip the magic one
if ($cur_module eq "PRODUCT")
{
next;
}
#Prepare path
my %mod = %{$mod_i};
my $infile = $mod{'in'};
my $outfile = $mod{'out'};
if ($mod{'folder'})
{
if (!(-d $mod{'folder'}))
{
die "Folder " . $mod{'folder'} . " not found.\n";
}
$infile = $mod{'folder'} . '/' . $infile;
$outfile = $mod{'folder'} . '/' . $outfile;
}
if (!(-f $infile))
{
die "File $infile is not a file.\n";
}
my $global_rev = $rev;
my $local_rev = GetRevision($mod{'folder'});
if ($arguments{'svnrev'} eq 'local')
{
$global_rev = $local_rev;
}
#Start rewriting
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
while (<INFILE>)
{
s/\$PMAJOR\$/$major/g;
s/\$PMINOR\$/$minor/g;
s/\$PREVISION\$/$revision/g;
s/\$GLOBAL_BUILD\$/$rev/g;
s/\$LOCAL_BUILD\$/$local_rev/g;
print OUTFILE $_;
}
close(OUTFILE);
close(INFILE);
}
sub GetRevision
{
my ($path)=(@_);
my $rev;
if (!$path)
{
$rev = `svnversion --committed`;
} else {
$rev = `svnversion --committed $path`;
}
if ($rev =~ /exported/)
{
die "Path specified is not a working copy\n";
} elsif ($rev =~ /(\d+):(\d+)/) {
$rev = int($2);
} elsif ($rev =~ /(\d+)/) {
$rev = int($1);
} else {
die "Unknown svnversion response: $rev\n";
}
return $rev;
}