Compare commits

..
Author SHA1 Message Date
David Anderson 5a2852755d Final build number for 1.0.4.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402537
2008-09-14 05:53:11 +00:00
David Anderson 946e4ab58a New version templates for buildbot.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402534
2008-09-14 05:13:21 +00:00
Matt Schubert 71e89f75ae Fixed amb1929 - Banning via console should now work properly
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402533
2008-09-12 20:36:53 +00:00
Matt Woodrow f0be909d31 Fixed amb1990 - Translator warnings not evaluating format params
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402531
2008-09-09 02:45:16 +00:00
David Anderson f31969dbc4 Fixed another sdktools team native crash, if m_szTeamName wasn't available (bug amb1779, r=pred).
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402529
2008-09-08 07:00:17 +00:00
David Anderson 94c4b4c691 Fixed the compiler eating too many characters in macro subsitutions (bug amb1938).
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402525
2008-09-08 02:13:10 +00:00
David Anderson 09a80ee8c1 Triggering another build.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402524
2008-09-07 22:27:34 +00:00
David Anderson 2cf9140ecf Fixed three bugs with team natives that appeared on INS: bounds checking had wrong binary shortcut order, bounds checking was off by one, error condition was not returned properly. Out-of-range team indexes no longer cause crashes now.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402522
2008-09-07 22:16:47 +00:00
David Anderson 3e8077d59c Fixed a nasty compiler bug where if the rhs of a ternary operator was larger than the lhs, the copy length emitted would only fit the lhs. The hier13() function now returns the larger of the lvalue sizes. (bug amb1853)
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402520
2008-09-07 09:50:50 +00:00
David Anderson 1c975da26f Fixed long strings with internal static copybacks causing buffer overflows (bug amb1986).
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402517
2008-09-07 03:24:41 +00:00
David Anderson fbc29dce23 Synced buildbot from trunk to branch.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402515
2008-09-06 23:57:23 +00:00
David Anderson cc0f68f94e Added master buildbot file for safekeeping.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402511
2008-09-06 15:26:30 +00:00
David Anderson 2d78224b91 Adding buildbot files back.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402510
2008-09-06 14:41:38 +00:00
David Anderson 0bd866d9b5 Removing files temporarily.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402509
2008-09-06 14:41:17 +00:00
David Anderson ed51e958e0 Dummy commit to try and get +x flag
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402508
2008-09-06 14:40:33 +00:00
David Anderson f74aed3db2 Merged buildbot changes from trunk.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402507
2008-09-06 14:36:18 +00:00
David Anderson 2e8282dab5 Reduced 1.0 branch query process delay to 50ms (amb 1916).
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402486
2008-09-02 06:08:38 +00:00
David Anderson 2ab49e966a Fixed amb1935 - When deleting a topmenu category, child objects were not removed from the name cache.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402484
2008-09-02 06:00:59 +00:00
David Anderson b364544776 Fixed amb1927 - client command case sensitivity did not match the server's logic.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402482
2008-09-02 03:58:23 +00:00
David Anderson c791f7f720 Fixed doc for HandleSys failure outparams.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402480
2008-08-28 17:20:17 +00:00
Scott Ehlert 18bec9f901 Improved bot detection slightly. This was meant to go along with the fix for amb1801.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402472
2008-08-24 04:32:06 +00:00
David Anderson 39c3ad0194 Fixed bug 1750 and bug 1801. Orange Box changes the command processing heuristics without telling anyone, it looks like executing commands during the command buffer processing causes insertion to the beginning of the stream rather than end. Moving our callbacks to occur in a new frame seems to alleviate this.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402471
2008-08-23 20:32:35 +00:00
Matt Woodrow d6cd6bd5a9 Fixed amb1899 - Duplicate maps in auto generated maplists
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402437
2008-08-07 23:31:53 +00:00
Matt Woodrow f2dd5f6914 Fixed amb1918 - Ban menu should compare userids, not client indexes
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402435
2008-08-07 23:16:06 +00:00
Matt Woodrow 3754c63e24 Fixed a few file handle leaks
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402433
2008-07-31 21:08:20 +00:00
Matt Woodrow 28c4f423b0 Fixed amb1891 : Basechat didn't check for blank message in private say's
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402430
2008-07-30 08:07:28 +00:00
David Anderson 82d949b34e Added more debug info to sm_dump_handles
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402424
2008-07-24 06:48:54 +00:00
Matt Woodrow 775d22a5ca Identities are now dropped before extensions unload.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402414
2008-07-13 05:36:39 +00:00
Scott Ehlert 8968f50577 Builds against latest OB SDK now
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402411
2008-07-12 09:05:36 +00:00
Matt Woodrow 7d42655e8f Fixed regression in ForwardSys with ET_LowEvent
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402389
2008-07-08 23:55:15 +00:00
Scott Ehlert e6a84801d2 Bumped IForwardSys
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402387
2008-07-08 21:16:31 +00:00
Scott Ehlert b58e7177ed Oops, forgot to commit this; fixed build
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402385
2008-07-08 09:15:15 +00:00
Scott Ehlert 6e0f4ee665 - Fixed amb1802: Crash when client was disconnected as a result of false being returned in OnClientConnect and a function that operated on this client was used. A client's connection state was not reset when this happened.
- Removed IForwardFilter due to overall horribleness (should be safe since no one seems to use it). Perhaps it might be back one day?
- Added ET_LowEvent forward exec type which is exactly the same as ET_Event, except that it returns the lowest value rather than the highest

--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402384
2008-07-08 08:55:50 +00:00
Matt Woodrow ab690bfdd9 Fixed amb1815 - Custom admin menu wasn't escaping input
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402379
2008-07-07 22:11:18 +00:00
David Anderson b21b24830e fixed amb1808 - KickClient() is delayed and does not crash -- KickClientEx() is the old functionality
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402362
2008-07-06 00:44:56 +00:00
David Anderson e6cec6528c fixed amb1763 - clear function call status on a new call
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402360
2008-07-06 00:01:40 +00:00
Borja Ferrer 1c08ddc939 fixed eyeangles helper not being freed
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402345
2008-07-05 00:15:18 +00:00
Borja Ferrer bc6b3495be fixed amb1801, IsFakeClient() wasn't working for TF2 causing false results and crashes
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402340
2008-07-04 19:04:17 +00:00
Matt Woodrow 83b59da392 Updated gamedata files now that dod:s is no longer in beta.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402333
2008-07-03 02:39:49 +00:00
David Anderson 53fc8657bf pulled changes back from branch-1.0.3
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402314
2008-07-01 02:40:46 +00:00
Matt Woodrow a4bf30ac1b Removed DEBUG from admin-sql-threaded.sp (amb1780)
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402311
2008-06-30 23:18:13 +00:00
Scott Ehlert 82cb558335 Updated DOD:S Beta offsets
Added FireOutput support for DOD:S (amb1749)

--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402308
2008-06-30 05:41:44 +00:00
Matt Woodrow 50327a252a Single most annoying and hard to find bug ive ever come across. I'd like to thank MSVC for not firing the one breakpoint I actually needed. Oh and a possible fix to sdktools.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402294
2008-06-29 05:04:32 +00:00
Matt Woodrow 954a130d07 Fixed an uninitialised string causing weird results.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402291
2008-06-29 03:26:52 +00:00
Matt Woodrow a17b0abfe4 Entity Outputs now fail silently if the mod is not supported.
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402281
2008-06-26 08:07:33 +00:00
David Anderson 93d0362a70 pulled amb1776 fixes from 1.0.3
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402278
2008-06-25 04:05:57 +00:00
David Anderson 7eafc21a47 bumped version
--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402270
2008-06-21 08:56:14 +00:00
96 changed files with 1531 additions and 644 deletions
-2
View File
@@ -162,8 +162,6 @@ private:
c -= (unsigned)'a';
assert(c >= 0 && c < 26);
if (!g_Admins.FindFlag(key, &g_FlagLetters[c]))
{
ParseError(states, "Unrecognized admin level \"%s\"", key);
+26 -1
View File
@@ -296,7 +296,32 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
ConCmdInfo *pInfo;
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
{
return;
/* 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;
}
}
/* This is a hack to prevent say triggers from firing on messages that were
+15 -7
View File
@@ -40,6 +40,7 @@
#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");
@@ -102,9 +103,11 @@ void CheckAndFinalizeConfigs()
if ((g_bServerExecd || g_ServerCfgFile == NULL)
&& g_bGotServerStart)
{
/* 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");
#if defined ORANGEBOX_BUILD
g_PendingInternalPush = true;
#else
SM_InternalCmdTrigger();
#endif
}
}
@@ -502,10 +505,6 @@ void SM_ExecuteAllConfigs()
}
iter->Release();
#if defined ORANGEBOX_BUILD
engine->ServerExecute();
#endif
g_bGotServerStart = true;
CheckAndFinalizeConfigs();
}
@@ -522,3 +521,12 @@ 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;
}
+2 -1
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -68,6 +68,7 @@ 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,6 +220,7 @@ 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')
+29 -1
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -511,3 +511,31 @@ 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);
}
}
+11 -1
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -79,6 +79,13 @@ struct CachedCommandInfo
#endif
};
struct DelayedKickInfo
{
int userid;
int client;
char buffer[384];
};
class CHalfLife2 :
public SMGlobalClass,
public IGameHelpers
@@ -110,6 +117,8 @@ 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
@@ -125,6 +134,7 @@ 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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+77 -59
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_Event, 3, p1);
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_LowEvent, 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 = GetPlayerByIndex(m_AuthQueue[i]);
pPlayer = &m_Players[m_AuthQueue[i]];
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
if (authstr && authstr[0] != '\0'
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
@@ -362,6 +362,7 @@ 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;
@@ -376,26 +377,29 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
cell_t res = 1;
m_Players[client].Initialize(pszName, pszAddress, pEntity);
pPlayer->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, NULL);
m_clconnect->Execute(&res);
if (res)
{
if (!m_Players[client].IsAuthorized())
if (!pPlayer->IsAuthorized())
{
m_AuthQueue[++m_AuthQueue[0]] = client;
}
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
}
else
{
RETURN_META_VALUE(MRES_SUPERCEDE, false);
if (!pPlayer->IsFakeClient())
{
RETURN_META_VALUE(MRES_SUPERCEDE, false);
}
}
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
return true;
}
@@ -403,7 +407,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 = GetPlayerByIndex(client);
CPlayer *pPlayer = &m_Players[client];
if (orig_value)
{
@@ -418,13 +422,17 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
break;
}
}
}
if (!pPlayer->IsFakeClient()
&& m_bIsListenServer
&& strncmp(pszAddress, "127.0.0.1", 9) == 0)
if (!pPlayer->IsFakeClient()
&& m_bIsListenServer
&& strncmp(pszAddress, "127.0.0.1", 9) == 0)
{
m_ListenClient = client;
}
}
else
{
m_ListenClient = client;
InvalidatePlayer(pPlayer);
}
return true;
@@ -434,8 +442,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())
{
@@ -443,6 +451,7 @@ 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 */
@@ -494,7 +503,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
}
}
m_Players[client].Connect();
pPlayer->Connect();
m_PlayerCount++;
List<IClientListener *>::iterator iter;
@@ -508,9 +517,9 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
m_clputinserver->PushCell(client);
m_clputinserver->Execute(&res, NULL);
if (m_Players[client].IsAuthorized())
if (pPlayer->IsAuthorized())
{
m_Players[client].DoPostConnectAuthorization();
pPlayer->DoPostConnectAuthorization();
}
}
@@ -531,8 +540,9 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
if (m_Players[client].IsConnected())
if (pPlayer->IsConnected())
{
m_cldisconnect->PushCell(client);
m_cldisconnect->Execute(&res, NULL);
@@ -543,7 +553,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
return;
}
if (m_Players[client].WasCountedAsInGame())
if (pPlayer->WasCountedAsInGame())
{
m_PlayerCount--;
}
@@ -556,29 +566,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
pListener->OnClientDisconnecting(client);
}
/**
* 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;
InvalidatePlayer(pPlayer);
if (m_ListenClient == client)
{
@@ -613,9 +601,9 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
#endif
int client = engine->IndexOfEdict(pEntity);
cell_t res = Pl_Continue;
CPlayer *pPlayer = &m_Players[client];
CPlayer *pPlayer = GetPlayerByIndex(client);
if (!pPlayer || !pPlayer->IsConnected())
if (!pPlayer->IsConnected())
{
return;
}
@@ -667,8 +655,9 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
if (!m_Players[client].IsConnected())
if (!pPlayer->IsConnected())
{
return;
}
@@ -676,42 +665,42 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
m_clinfochanged->PushCell(engine->IndexOfEdict(pEntity));
m_clinfochanged->Execute(&res, NULL);
IPlayerInfo *info = m_Players[client].GetPlayerInfo();
IPlayerInfo *info = pPlayer->GetPlayerInfo();
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
const char *old_name = m_Players[client].m_Name.c_str();
const char *old_name = pPlayer->m_Name.c_str();
if (strcmp(old_name, new_name) != 0)
{
AdminId id = g_Admins.FindAdminByIdentity("name", new_name);
if (id != INVALID_ADMIN_ID && m_Players[client].GetAdminId() != id)
if (id != INVALID_ADMIN_ID && pPlayer->GetAdminId() != id)
{
if (!CheckSetAdminName(client, &m_Players[client], id))
if (!CheckSetAdminName(client, pPlayer, id))
{
m_Players[client].Kick("Your name is reserved by SourceMod; set your password to use it.");
pPlayer->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 == m_Players[client].GetAdminId())
if (id == pPlayer->GetAdminId())
{
/* This player is changing their name; force them to drop admin privileges! */
m_Players[client].SetAdminId(INVALID_ADMIN_ID, false);
pPlayer->SetAdminId(INVALID_ADMIN_ID, false);
}
}
m_Players[client].SetName(new_name);
pPlayer->SetName(new_name);
}
if (m_PassInfoVar.size() > 0)
{
/* Try for a password change */
const char *old_pass = m_Players[client].m_LastPassword.c_str();
const char *old_pass = pPlayer->m_LastPassword.c_str();
const char *new_pass = engine->GetClientConVarValue(client, m_PassInfoVar.c_str());
if (strcmp(old_pass, new_pass) != 0)
{
m_Players[client].m_LastPassword.assign(new_pass);
if (m_Players[client].IsInGame() && m_Players[client].IsAuthorized())
pPlayer->m_LastPassword.assign(new_pass);
if (pPlayer->IsInGame() && pPlayer->IsAuthorized())
{
/* If there is already an admin id assigned, this will just bail out. */
m_Players[client].DoBasicAdminChecks();
pPlayer->DoBasicAdminChecks();
}
}
}
@@ -862,6 +851,33 @@ 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
@@ -1204,6 +1220,7 @@ 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)
@@ -1271,6 +1288,7 @@ void CPlayer::Disconnect()
m_bAdminCheckSignalled = false;
m_UserId = -1;
m_bIsInKickQueue = false;
m_bFakeClient = false;
}
void CPlayer::SetName(const char *name)
@@ -1335,7 +1353,7 @@ IPlayerInfo *CPlayer::GetPlayerInfo()
bool CPlayer::IsFakeClient()
{
return (strcmp(m_AuthID.c_str(), "BOT") == 0);
return m_bFakeClient;
}
void CPlayer::SetAdminId(AdminId id, bool temporary)
+2
View File
@@ -105,6 +105,7 @@ private:
int m_iIndex;
unsigned int m_LangId;
int m_UserId;
bool m_bFakeClient;
};
class PlayerManager :
@@ -173,6 +174,7 @@ 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", message);
g_Logger.LogError("[SM] %s", buffer);
}
void CPhraseFile::ReparseFile()
+10 -1
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -35,15 +35,24 @@
#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;
+3 -1
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -32,6 +32,8 @@
#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,6 +284,7 @@ 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/");
}
}
+4 -2
View File
@@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+4 -2
View File
@@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+3 -9
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -304,10 +304,7 @@ static cell_t sm_CallStartFunction(IPluginContext *pContext, const cell_t *param
HandleError err;
IPlugin *pPlugin;
if (s_CallStarted)
{
return pContext->ThrowNativeError("Cannot start a call while one is already in progress");
}
ResetCall();
hndl = static_cast<Handle_t>(params[1]);
@@ -343,10 +340,7 @@ static cell_t sm_CallStartForward(IPluginContext *pContext, const cell_t *params
HandleError err;
IForward *pForward;
if (s_CallStarted)
{
return pContext->ThrowNativeError("Cannot start a call while one is already in progress");
}
ResetCall();
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)
if ((ptr = strstr(buffer, ".bsp")) == NULL || ptr[4] != '\0')
{
pDir->NextEntry();
continue;
+56 -1
View File
@@ -1258,10 +1258,64 @@ 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())
@@ -1460,6 +1514,7 @@ REGISTER_NATIVES(playernatives)
{"ShowActivityEx", ShowActivityEx},
{"ShowActivity2", ShowActivity2},
{"KickClient", KickClient},
{"KickClientEx", KickClientEx},
{"RunAdminCacheChecks", RunAdminCacheChecks},
{"NotifyPostAdminCheck", NotifyPostAdminCheck},
{"IsClientInKickQueue", IsClientInKickQueue},
+40 -2
View File
@@ -192,7 +192,31 @@ 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;
@@ -200,6 +224,7 @@ 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);
@@ -217,12 +242,25 @@ static cell_t sm_format(IPluginContext *pCtx, const cell_t *params)
break;
}
}
buf = (copy) ? g_formatbuf : destbuf;
if (copy)
{
if (maxlen > sizeof(g_formatbuf))
{
__copy_buf = g_extrabuf.GetWithSize(maxlen);
}
else
{
__copy_buf = g_formatbuf;
}
}
buf = (copy) ? __copy_buf : destbuf;
res = atcprintf(buf, maxlen, fmt, pCtx, params, &arg);
if (copy)
{
memcpy(destbuf, g_formatbuf, res+1);
memcpy(destbuf, __copy_buf, res+1);
}
return static_cast<cell_t>(res);
+6 -3
View File
@@ -933,9 +933,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
}
}
/* Tell it to unload */
pAPI = pExt->GetAPI();
pAPI->OnExtensionUnload();
}
IdentityToken_t *pIdentity;
@@ -949,6 +946,12 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
}
}
/* Tell it to unload */
if (pExt->IsLoaded())
{
IExtensionInterface *pAPI = pExt->GetAPI();
pAPI->OnExtensionUnload();
}
pExt->Unload();
delete pExt;
+51 -37
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -283,15 +283,11 @@ 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;
@@ -311,12 +307,16 @@ 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,26 +325,30 @@ 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)
{
if (!filter || !filter->OnErrorReport(this, func, err))
{
g_DbgReporter.GenerateError(func->GetParentContext(),
func->GetFunctionID(),
err,
"Failed to push parameter while executing forward");
}
g_DbgReporter.GenerateError(func->GetParentContext(),
func->GetFunctionID(),
err,
"Failed to push parameter while executing forward");
continue;
}
}
@@ -352,12 +356,10 @@ 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)
{
@@ -381,14 +383,12 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
}
break;
}
case ET_Custom:
case ET_LowEvent:
{
if (filter)
/* 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->OnFunctionReturn(this, func, &cur_result) == Pl_Stop)
{
goto done;
}
low_result = cur_result;
}
break;
}
@@ -401,25 +401,39 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
}
done:
if (success)
{
if (m_ExecType == ET_Event || m_ExecType == ET_Hook)
switch (m_ExecType)
{
cur_result = high_result;
} else if (m_ExecType == ET_Ignore) {
cur_result = 0;
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;
}
}
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-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 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
+14 -3
View File
@@ -997,8 +997,9 @@ 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", "Handle", "Owner", "Type", "Memory");
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("--------------------------------------------------------------------------");
for (unsigned int i = 1; i <= m_HandleTail; i++)
{
@@ -1049,16 +1050,26 @@ 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", index, owner, type, "-1");
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s\t%-10.10s\t%-10.10s", index, owner, type, "-1", refcount, parent);
}
else
{
char buffer[32];
UTIL_Format(buffer, sizeof(buffer), "%d", size);
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, buffer);
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s\t%-10.10s\t%-10.10s", index, owner, type, buffer, refcount, parent);
total_size += size;
}
}
+1 -1
View File
@@ -34,7 +34,7 @@
#include "BaseWorker.h"
#define DEFAULT_THINK_TIME_MS 500
#define DEFAULT_THINK_TIME_MS 50
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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
#define _INCLUDE_BINTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_BINTOOLS_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
#define _INCLUDE_BINTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_GEOIP_VERSION_H_
#define _INCLUDE_GEOIP_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_GEOIP_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_GEOIP_VERSION_H_
#define _INCLUDE_GEOIP_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_MYSQLEXT_VERSION_H_
#define _INCLUDE_MYSQLEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_MYSQLEXT_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_MYSQLEXT_VERSION_H_
#define _INCLUDE_MYSQLEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_REGEXEXT_VERSION_H_
#define _INCLUDE_REGEXEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_REGEXEXT_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_REGEXEXT_VERSION_H_
#define _INCLUDE_REGEXEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
+4 -4
View File
@@ -82,6 +82,10 @@ 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);
@@ -96,10 +100,6 @@ 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);
+6 -2
View File
@@ -76,7 +76,12 @@ bool EntityOutputManager::IsEnabled()
bool EntityOutputManager::CreateFireEventDetour()
{
if (!g_pGameConf->GetMemSig("FireOutput", &info_address) || !info_address)
if (!g_pGameConf->GetMemSig("FireOutput", &info_address))
{
return false;
}
if (!info_address)
{
g_pSM->LogError(myself, "Could not locate FireOutput - Disabling Entity Outputs");
return false;
@@ -84,7 +89,6 @@ 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;
}
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+28 -10
View File
@@ -109,16 +109,34 @@ 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 (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
static int offset = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "m_szTeamname")->GetOffset();
char *name = (char *)((unsigned char *)g_Teams[teamindex].pEnt + offset);
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);
pContext->StringToLocalUTF8(params[2], params[3], name, NULL);
@@ -128,9 +146,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 (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
static int offset = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "m_iScore")->GetOffset();
@@ -141,9 +159,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 (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
static int offset = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "m_iScore")->GetOffset();
@@ -155,9 +173,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 (!g_Teams[teamindex].ClassName || (teamindex > (int)g_Teams.size()))
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{
pContext->ThrowNativeError("Team index %d is invalid", teamindex);
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
SendProp *pProp = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "\"player_array\"");
+1
View File
@@ -280,6 +280,7 @@ 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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+3
View File
@@ -55,7 +55,10 @@ 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)
{
snprintf(error, maxlength, "Cannot Load TF2 Extension on mods other than TF2");
UTIL_Format(error, maxlength, "Cannot Load TF2 Extension on mods other than TF2");
return false;
}
ServerClass *sc = UTIL_FindServerClass("CTFPlayer");
if (sc == NULL)
{
snprintf(error, maxlength, "Could not find CTFPlayer server class");
UTIL_Format(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))
{
snprintf(error, maxlength, "Could not find DT_TFPlayerShared data table");
UTIL_Format(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)
{
snprintf(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error);
UTIL_Format(error, maxlength, "Could not read sm-tf2.games.txt: %s", conf_error);
}
return false;
}
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_SDKTOOLS_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+1
View File
@@ -330,6 +330,7 @@ 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;
}
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
+4 -2
View File
@@ -36,7 +36,9 @@
#ifndef _INCLUDE_SQLITEEXT_VERSION_H_
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#endif //_INCLUDE_SQLITEEXT_VERSION_H_
+1 -2
View File
@@ -18,7 +18,7 @@
}
}
"dodsbeta"
"dod"
{
"Keys"
{
@@ -67,7 +67,6 @@
{
"game" "cstrike"
"game" "dod"
"game" "dodsbeta"
"game" "sourceforts"
"game" "insurgency"
"game" "Insurgency"
+23 -23
View File
@@ -31,7 +31,7 @@
{
"#supported"
{
"game" "dodsbeta"
"game" "dod"
"game" "tf"
}
@@ -79,7 +79,7 @@
{
"#supported"
{
"game" "dodsbeta"
"game" "dod"
"game" "tf"
}
@@ -105,7 +105,7 @@
{
"#supported"
{
"game" "dodsbeta"
"game" "dod"
"game" "tf"
}
@@ -146,7 +146,7 @@
{
"#supported"
{
"game" "dodsbeta"
"game" "dod"
"game" "tf"
}
@@ -224,7 +224,7 @@
{
"#supported"
{
"game" "dodsbeta"
"game" "dod"
"game" "tf"
}
"Signatures"
@@ -324,8 +324,8 @@
}
}
/* Day of Defeat: Source (Orange Box Beta) */
"dodsbeta"
/* Day of Defeat: Source */
"dod"
{
"Offsets"
{
@@ -336,23 +336,23 @@
}
"RemovePlayerItem"
{
"windows" "237"
"linux" "238"
"windows" "238"
"linux" "239"
}
"Weapon_GetSlot"
{
"windows" "235"
"linux" "236"
"windows" "236"
"linux" "237"
}
"Ignite"
{
"windows" "192"
"linux" "193"
"windows" "193"
"linux" "194"
}
"Extinguish"
{
"windows" "196"
"linux" "197"
"windows" "197"
"linux" "198"
}
"Teleport"
{
@@ -361,18 +361,18 @@
}
"CommitSuicide"
{
"windows" "386"
"linux" "386"
"windows" "388"
"linux" "388"
}
"GetVelocity"
{
"windows" "129"
"linux" "130"
"windows" "130"
"linux" "131"
}
"EyeAngles"
{
"windows" "121"
"linux" "122"
"windows" "122"
"linux" "123"
}
"AcceptInput"
{
@@ -401,8 +401,8 @@
}
"WeaponEquip"
{
"windows" "228"
"linux" "229"
"windows" "229"
"linux" "230"
}
"Activate"
{
+40 -132
View File
@@ -32,7 +32,6 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "hl2mp"
"game" "ship"
"game" "!Dystopia"
@@ -92,7 +91,6 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "garrysmod"
"game" "hl2mp"
"game" "ship"
@@ -145,7 +143,6 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "garrysmod"
"game" "hl2mp"
"game" "ship"
@@ -198,7 +195,6 @@
"#supported"
{
"game" "cstrike"
"game" "dod"
"game" "hl2mp"
"game" "!Insurgency"
"game" "pvkii"
@@ -248,6 +244,46 @@
}
}
}
/* 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"
@@ -345,94 +381,6 @@
}
}
/* 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"
{
@@ -1818,45 +1766,5 @@
}
}
}
/* 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"
}
}
}
}
+4 -2
View File
@@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "1.0.3.2276"
#define SVN_FILE_VERSION 1,0,3,2276
#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
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+4 -2
View File
@@ -40,7 +40,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$.$GLOBAL_BUILD$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
#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
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+1 -1
View File
@@ -1,7 +1,7 @@
[PRODUCT]
major = 1
minor = 0
revision = 3
revision = 4
[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()
{
+82 -7
View File
@@ -81,7 +81,7 @@ BuildDynamicMenu()
new Handle:kvMenu;
kvMenu = CreateKeyValues("Commands");
KvSetEscapeSequences(kvMenu, true);
KvSetEscapeSequences(kvMenu, true);
new String:file[256];
@@ -284,8 +284,7 @@ BuildDynamicMenu()
else
{
submenuInput[Submenu_method] = Name;
}
}
}
KvGetString(kvMenu, "title", inputBuffer, sizeof(inputBuffer));
@@ -586,13 +585,16 @@ 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, g_command[client]);
FakeClientCommand(client, unquotedCommand);
}
else // assume 'server' type execute option
{
InsertServerCommand(g_command[client]);
InsertServerCommand(unquotedCommand);
ServerExecute();
}
@@ -610,16 +612,20 @@ public Menu_Selection(Handle:menu, MenuAction:action, param1, param2)
if (action == MenuAction_Select)
{
new String:info[NAME_LENGTH];
new String:unquotedinfo[NAME_LENGTH];
/* Get item info */
new bool:found = GetMenuItem(menu, param2, info, sizeof(info));
new bool:found = GetMenuItem(menu, param2, unquotedinfo, sizeof(unquotedinfo));
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);
@@ -644,3 +650,72 @@ 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,6 +49,7 @@ 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"
+39 -20
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,9 +30,25 @@
*
* 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));
@@ -69,26 +85,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");
@@ -96,21 +112,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");
@@ -124,11 +140,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,
@@ -161,9 +177,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);
}
}
@@ -185,7 +201,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);
@@ -200,6 +216,7 @@ public MenuHandler_BanPlayerList(Handle:menu, MenuAction:action, param1, param2)
else
{
g_BanTarget[param1] = target;
g_BanTargetUserId[param1] = userid;
DisplayBanTimeMenu(param1);
}
}
@@ -221,10 +238,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);
}
}
@@ -237,12 +254,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);
@@ -264,6 +281,8 @@ 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)
if (target == -1 || len == -1)
return Plugin_Handled;
decl String:name2[64];
+23 -2
View File
@@ -634,7 +634,28 @@ native Float:GetClientAvgPackets(client, NetFlow:flow);
native GetClientOfUserId(userid);
/**
* Disconnects a client from the server.
* 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.
*
* 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
@@ -647,7 +668,7 @@ native GetClientOfUserId(userid);
* @noreturn
* @error Invalid client index, or client not connected.
*/
native KickClient(client, const String:format[]="", any:...);
native KickClientEx(client, const String:format[]="", any:...);
/**
* Changes a client's team through the mod's generic team changing function.
+9 -1
View File
@@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@@ -298,6 +298,8 @@ 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.
@@ -320,6 +322,10 @@ 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.
@@ -334,6 +340,8 @@ 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-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 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 3 /**< SourceMod Release version */
#define SOURCEMOD_V_RELEASE 4 /**< SourceMod Release version */
#define SOURCEMOD_VERSION "1.0.3" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "1.0.4" /**< 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$" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$" /**< SourceMod version string (major.minor.release.build) */
+1
View File
@@ -0,0 +1 @@
1.0.4
+5 -60
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2008 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 2
#define SMINTERFACE_FORWARDMANAGER_VERSION 3
/*
* There is some very important documentation at the bottom of this file.
@@ -79,66 +79,11 @@ 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_Custom = 4, /**< Ignored or handled by an IForwardFilter */
ET_LowEvent = 4, /**< Same as ET_Event except that it returns the lowest value */
};
class IForward;
/**
* @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)
{
}
};
class IForwardFilter;
/**
* @brief Unmanaged Forward, abstracts calling multiple functions as "forwards," or collections of functions.
@@ -180,7 +125,7 @@ namespace SourceMod
* @brief Executes the forward.
*
* @param result Optional pointer to store result in.
* @param filter Optional pointer to an IForwardFilter.
* @param filter Do not use.
* @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.
* @param err Optional pointer to store an error code on failure (undefined on success).
* @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.
* @param err Optional pointer to store an error code on failure (undefined on success).
* @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.
* @param err Optional pointer to store an error code on failure (undefined on success).
* @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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
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)/linux_sdk
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
+1
View File
@@ -0,0 +1 @@
2
-1
View File
@@ -1641,7 +1641,6 @@ 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,6 +1346,15 @@ 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)
+4 -2
View File
@@ -19,7 +19,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2269
#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
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+4 -2
View File
@@ -19,7 +19,9 @@
* @file Contains SourceMod version information.
*/
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$LOCAL_BUILD$
#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
#endif //_INCLUDE_SOURCEMOD_VERSION_H_
+4 -2
View File
@@ -16,7 +16,9 @@
#ifndef _INCLUDE_JIT_VERSION_H_
#define _INCLUDE_JIT_VERSION_H_
#define SVN_FULL_VERSION "1.0.3"
#define SVN_FILE_VERSION 1,0,3,2269
#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
#endif //_INCLUDE_JIT_VERSION_H_
+4 -2
View File
@@ -16,7 +16,9 @@
#ifndef _INCLUDE_JIT_VERSION_H_
#define _INCLUDE_JIT_VERSION_H_
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,$LOCAL_BUILD$
#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
#endif //_INCLUDE_JIT_VERSION_H_
+60
View File
@@ -0,0 +1,60 @@
#!/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
@@ -0,0 +1,126 @@
#!/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
@@ -0,0 +1,251 @@
# -*- 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
@@ -0,0 +1,78 @@
#!/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
@@ -0,0 +1,39 @@
#!/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
@@ -0,0 +1,44 @@
#!/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,7 +44,6 @@ 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);
+4 -1
View File
@@ -43,8 +43,11 @@ namespace builder
}
catch (System.Exception e)
{
Console.WriteLine("Build failed: " + e.Message);
Console.WriteLine("Build failed, exception: " + e.Message);
Environment.Exit(1);
}
Environment.Exit(0);
}
}
}
+169 -165
View File
@@ -1,165 +1,169 @@
#!/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;
}
#!/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;
}