Merge branch 'master' of https://github.com/alliedmodders/sourcemod into mapchooser-updates
This commit is contained in:
commit
a9961d3bb4
@ -195,15 +195,20 @@ IPluginRuntime *CPlugin::GetRuntime()
|
|||||||
|
|
||||||
void CPlugin::SetErrorState(PluginStatus status, const char *error_fmt, ...)
|
void CPlugin::SetErrorState(PluginStatus status, const char *error_fmt, ...)
|
||||||
{
|
{
|
||||||
PluginStatus old_status = m_status;
|
if (m_status == Plugin_Running)
|
||||||
m_status = status;
|
|
||||||
|
|
||||||
if (old_status == Plugin_Running)
|
|
||||||
{
|
{
|
||||||
/* Tell everyone we're now paused */
|
/* Tell everyone we're now paused */
|
||||||
g_PluginSys._SetPauseState(this, true);
|
SetPauseState(true);
|
||||||
|
/* If we won't recover from this error, drop everything and pause dependent plugins too! */
|
||||||
|
if (status == Plugin_Failed)
|
||||||
|
{
|
||||||
|
DropEverything();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* SetPauseState sets the status to Plugin_Paused, but we might want to see some other status set. */
|
||||||
|
m_status = status;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, error_fmt);
|
va_start(ap, error_fmt);
|
||||||
smcore.FormatArgs(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
|
smcore.FormatArgs(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
|
||||||
@ -531,7 +536,8 @@ bool CPlugin::SetPauseState(bool paused)
|
|||||||
if (paused && GetStatus() != Plugin_Running)
|
if (paused && GetStatus() != Plugin_Running)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
} else if (!paused && GetStatus() != Plugin_Paused) {
|
}
|
||||||
|
else if (!paused && GetStatus() != Plugin_Paused && GetStatus() != Plugin_Error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,6 +545,12 @@ bool CPlugin::SetPauseState(bool paused)
|
|||||||
{
|
{
|
||||||
LibraryActions(LibraryAction_Removed);
|
LibraryActions(LibraryAction_Removed);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set to running again BEFORE trying to call OnPluginPauseChange ;)
|
||||||
|
m_status = Plugin_Running;
|
||||||
|
m_pRuntime->SetPauseState(false);
|
||||||
|
}
|
||||||
|
|
||||||
IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("OnPluginPauseChange");
|
IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("OnPluginPauseChange");
|
||||||
if (pFunction)
|
if (pFunction)
|
||||||
@ -552,9 +564,6 @@ bool CPlugin::SetPauseState(bool paused)
|
|||||||
{
|
{
|
||||||
m_status = Plugin_Paused;
|
m_status = Plugin_Paused;
|
||||||
m_pRuntime->SetPauseState(true);
|
m_pRuntime->SetPauseState(true);
|
||||||
} else {
|
|
||||||
m_status = Plugin_Running;
|
|
||||||
m_pRuntime->SetPauseState(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_PluginSys._SetPauseState(this, paused);
|
g_PluginSys._SetPauseState(this, paused);
|
||||||
@ -1138,7 +1147,7 @@ void CPluginManager::LoadAll_SecondPass()
|
|||||||
if (!RunSecondPass(pPlugin, error, sizeof(error)))
|
if (!RunSecondPass(pPlugin, error, sizeof(error)))
|
||||||
{
|
{
|
||||||
g_Logger.LogError("[SM] Unable to load plugin \"%s\": %s", pPlugin->GetFilename(), error);
|
g_Logger.LogError("[SM] Unable to load plugin \"%s\": %s", pPlugin->GetFilename(), error);
|
||||||
pPlugin->SetErrorState(Plugin_Failed, "%s", error);
|
pPlugin->SetErrorState(Plugin_BadLoad, "%s", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1496,11 +1505,9 @@ void CPluginManager::TryRefreshDependencies(CPlugin *pPlugin)
|
|||||||
if (pPlugin->GetStatus() == Plugin_Error)
|
if (pPlugin->GetStatus() == Plugin_Error)
|
||||||
{
|
{
|
||||||
/* If we got here, all natives are okay again! */
|
/* If we got here, all natives are okay again! */
|
||||||
pPlugin->m_status = Plugin_Running;
|
|
||||||
if (pPlugin->m_pRuntime->IsPaused())
|
if (pPlugin->m_pRuntime->IsPaused())
|
||||||
{
|
{
|
||||||
pPlugin->m_pRuntime->SetPauseState(false);
|
pPlugin->SetPauseState(false);
|
||||||
_SetPauseState(pPlugin, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2217,7 +2224,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
|||||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||||
|
|
||||||
rootmenu->ConsolePrint(" Filename: %s", pl->GetFilename());
|
rootmenu->ConsolePrint(" Filename: %s", pl->GetFilename());
|
||||||
if (pl->GetStatus() <= Plugin_Error)
|
if (pl->GetStatus() <= Plugin_Error || pl->GetStatus() == Plugin_Failed)
|
||||||
{
|
{
|
||||||
if (IS_STR_FILLED(info->name))
|
if (IS_STR_FILLED(info->name))
|
||||||
{
|
{
|
||||||
@ -2240,7 +2247,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
|||||||
{
|
{
|
||||||
rootmenu->ConsolePrint(" URL: %s", info->url);
|
rootmenu->ConsolePrint(" URL: %s", info->url);
|
||||||
}
|
}
|
||||||
if (pl->GetStatus() == Plugin_Error)
|
if (pl->GetStatus() == Plugin_Error || pl->GetStatus() == Plugin_Failed)
|
||||||
{
|
{
|
||||||
rootmenu->ConsolePrint(" Error: %s", pl->m_errormsg);
|
rootmenu->ConsolePrint(" Error: %s", pl->m_errormsg);
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ REGISTER_NATIVES(cellArrayNatives)
|
|||||||
{"ArrayList.Set", SetArrayCell},
|
{"ArrayList.Set", SetArrayCell},
|
||||||
{"ArrayList.SetString", SetArrayString},
|
{"ArrayList.SetString", SetArrayString},
|
||||||
{"ArrayList.SetArray", SetArrayArray},
|
{"ArrayList.SetArray", SetArrayArray},
|
||||||
{"ArrayList.Erease", RemoveFromArray},
|
{"ArrayList.Erase", RemoveFromArray},
|
||||||
{"ArrayList.ShiftUp", ShiftArrayUp},
|
{"ArrayList.ShiftUp", ShiftArrayUp},
|
||||||
{"ArrayList.SwapAt", SwapArrayItems},
|
{"ArrayList.SwapAt", SwapArrayItems},
|
||||||
{"ArrayList.Clone", CloneArray},
|
{"ArrayList.Clone", CloneArray},
|
||||||
|
@ -380,7 +380,7 @@ static cell_t SetFailState(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
if (params[0] == 1)
|
if (params[0] == 1)
|
||||||
{
|
{
|
||||||
pPlugin->SetErrorState(Plugin_Error, "%s", str);
|
pPlugin->SetErrorState(Plugin_Failed, "%s", str);
|
||||||
|
|
||||||
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", str);
|
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", str);
|
||||||
}
|
}
|
||||||
@ -391,12 +391,12 @@ static cell_t SetFailState(IPluginContext *pContext, const cell_t *params)
|
|||||||
g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 1);
|
g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 1);
|
||||||
if (pContext->GetLastNativeError() != SP_ERROR_NONE)
|
if (pContext->GetLastNativeError() != SP_ERROR_NONE)
|
||||||
{
|
{
|
||||||
pPlugin->SetErrorState(Plugin_Error, "%s", str);
|
pPlugin->SetErrorState(Plugin_Failed, "%s", str);
|
||||||
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "Formatting error (%s)", str);
|
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "Formatting error (%s)", str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pPlugin->SetErrorState(Plugin_Error, "%s", buffer);
|
pPlugin->SetErrorState(Plugin_Failed, "%s", buffer);
|
||||||
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", buffer);
|
return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -774,4 +774,4 @@ REGISTER_NATIVES(coreNatives)
|
|||||||
{"LoadFromAddress", LoadFromAddress},
|
{"LoadFromAddress", LoadFromAddress},
|
||||||
{"StoreToAddress", StoreToAddress},
|
{"StoreToAddress", StoreToAddress},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -572,6 +572,47 @@ static cell_t ReferenceToBCompatRef(IPluginContext *pContext, const cell_t *para
|
|||||||
return g_HL2.ReferenceToBCompatRef(params[1]);
|
return g_HL2.ReferenceToBCompatRef(params[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Must match ClientRangeType enum in halflife.inc
|
||||||
|
enum class ClientRangeType : cell_t
|
||||||
|
{
|
||||||
|
Visibility = 0,
|
||||||
|
Audibility,
|
||||||
|
};
|
||||||
|
|
||||||
|
static cell_t GetClientsInRange(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
cell_t *origin;
|
||||||
|
pContext->LocalToPhysAddr(params[1], &origin);
|
||||||
|
|
||||||
|
Vector vOrigin(sp_ctof(origin[0]), sp_ctof(origin[1]), sp_ctof(origin[2]));
|
||||||
|
|
||||||
|
ClientRangeType rangeType = (ClientRangeType) params[2];
|
||||||
|
|
||||||
|
CBitVec<ABSOLUTE_PLAYER_LIMIT> players;
|
||||||
|
engine->Message_DetermineMulticastRecipients(rangeType == ClientRangeType::Audibility, vOrigin, players);
|
||||||
|
|
||||||
|
cell_t *outPlayers;
|
||||||
|
pContext->LocalToPhysAddr(params[3], &outPlayers);
|
||||||
|
|
||||||
|
int maxPlayers = params[4];
|
||||||
|
int curPlayers = 0;
|
||||||
|
|
||||||
|
int index = players.FindNextSetBit(0);
|
||||||
|
while (index > -1 && curPlayers < maxPlayers)
|
||||||
|
{
|
||||||
|
int entidx = index + 1;
|
||||||
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(entidx);
|
||||||
|
if (pPlayer && pPlayer->IsInGame())
|
||||||
|
{
|
||||||
|
outPlayers[curPlayers++] = entidx;
|
||||||
|
}
|
||||||
|
|
||||||
|
index = players.FindNextSetBit(index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return curPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(halflifeNatives)
|
REGISTER_NATIVES(halflifeNatives)
|
||||||
{
|
{
|
||||||
{"CreateFakeClient", CreateFakeClient},
|
{"CreateFakeClient", CreateFakeClient},
|
||||||
@ -607,5 +648,6 @@ REGISTER_NATIVES(halflifeNatives)
|
|||||||
{"EntIndexToEntRef", IndexToReference},
|
{"EntIndexToEntRef", IndexToReference},
|
||||||
{"EntRefToEntIndex", ReferenceToIndex},
|
{"EntRefToEntIndex", ReferenceToIndex},
|
||||||
{"MakeCompatEntRef", ReferenceToBCompatRef},
|
{"MakeCompatEntRef", ReferenceToBCompatRef},
|
||||||
|
{"GetClientsInRange", GetClientsInRange},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,9 @@ IPlayerInfoManager *playerinfo = NULL;
|
|||||||
IBaseFileSystem *basefilesystem = NULL;
|
IBaseFileSystem *basefilesystem = NULL;
|
||||||
IFileSystem *filesystem = NULL;
|
IFileSystem *filesystem = NULL;
|
||||||
IEngineSound *enginesound = NULL;
|
IEngineSound *enginesound = NULL;
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
IServerTools *servertools = NULL;
|
IServerTools *servertools = NULL;
|
||||||
|
#endif
|
||||||
IServerPluginHelpers *serverpluginhelpers = NULL;
|
IServerPluginHelpers *serverpluginhelpers = NULL;
|
||||||
IServerPluginCallbacks *vsp_interface = NULL;
|
IServerPluginCallbacks *vsp_interface = NULL;
|
||||||
int vsp_version = 0;
|
int vsp_version = 0;
|
||||||
@ -70,7 +72,9 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
|||||||
GET_V_IFACE_CURRENT(GetFileSystemFactory, basefilesystem, IBaseFileSystem, BASEFILESYSTEM_INTERFACE_VERSION);
|
GET_V_IFACE_CURRENT(GetFileSystemFactory, basefilesystem, IBaseFileSystem, BASEFILESYSTEM_INTERFACE_VERSION);
|
||||||
GET_V_IFACE_CURRENT(GetFileSystemFactory, filesystem, IFileSystem, FILESYSTEM_INTERFACE_VERSION);
|
GET_V_IFACE_CURRENT(GetFileSystemFactory, filesystem, IFileSystem, FILESYSTEM_INTERFACE_VERSION);
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
GET_V_IFACE_CURRENT(GetEngineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
GET_V_IFACE_CURRENT(GetServerFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION);
|
GET_V_IFACE_CURRENT(GetServerFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION);
|
||||||
|
#endif
|
||||||
#if SOURCE_ENGINE != SE_DOTA
|
#if SOURCE_ENGINE != SE_DOTA
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
GET_V_IFACE_CURRENT(GetEngineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
||||||
#endif
|
#endif
|
||||||
|
@ -102,7 +102,9 @@ extern IPlayerInfoManager *playerinfo;
|
|||||||
extern IBaseFileSystem *basefilesystem;
|
extern IBaseFileSystem *basefilesystem;
|
||||||
extern IFileSystem *filesystem;
|
extern IFileSystem *filesystem;
|
||||||
extern IEngineSound *enginesound;
|
extern IEngineSound *enginesound;
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
extern IServerTools *servertools;
|
extern IServerTools *servertools;
|
||||||
|
#endif
|
||||||
extern IServerPluginHelpers *serverpluginhelpers;
|
extern IServerPluginHelpers *serverpluginhelpers;
|
||||||
extern IServerPluginCallbacks *vsp_interface;
|
extern IServerPluginCallbacks *vsp_interface;
|
||||||
extern int vsp_version;
|
extern int vsp_version;
|
||||||
|
@ -219,6 +219,26 @@ bool SDKHooks::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buffer[0] = '\0';
|
||||||
|
if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf, buffer, sizeof(buffer)))
|
||||||
|
{
|
||||||
|
if (buffer[0])
|
||||||
|
{
|
||||||
|
g_pSM->Format(error, maxlength, "Could not read sdkhooks.games gamedata: %s", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CUtlVector<IEntityListener *> *entListeners = EntListeners();
|
||||||
|
if (!entListeners)
|
||||||
|
{
|
||||||
|
g_pSM->Format(error, maxlength, "Failed to setup entity listeners");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
entListeners->AddToTail(this);
|
||||||
|
|
||||||
sharesys->AddDependency(myself, "bintools.ext", true, true);
|
sharesys->AddDependency(myself, "bintools.ext", true, true);
|
||||||
sharesys->AddNatives(myself, g_Natives);
|
sharesys->AddNatives(myself, g_Natives);
|
||||||
sharesys->RegisterLibrary(myself, "sdkhooks");
|
sharesys->RegisterLibrary(myself, "sdkhooks");
|
||||||
@ -237,26 +257,6 @@ bool SDKHooks::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
#endif
|
#endif
|
||||||
g_pOnLevelInit = forwards->CreateForward("OnLevelInit", ET_Hook, 2, NULL, Param_String, Param_String);
|
g_pOnLevelInit = forwards->CreateForward("OnLevelInit", ET_Hook, 2, NULL, Param_String, Param_String);
|
||||||
|
|
||||||
buffer[0] = '\0';
|
|
||||||
if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf, buffer, sizeof(buffer)))
|
|
||||||
{
|
|
||||||
if (buffer[0])
|
|
||||||
{
|
|
||||||
g_pSM->Format(error, maxlength, "Could not read sdkhooks.games gamedata: %s", buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CUtlVector<IEntityListener *> *entListeners = EntListeners();
|
|
||||||
if (!entListeners)
|
|
||||||
{
|
|
||||||
g_pSM->Format(error, maxlength, "Failed to setup entity listeners");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
entListeners->AddToTail(this);
|
|
||||||
|
|
||||||
SetupHooks();
|
SetupHooks();
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
@ -822,11 +822,11 @@ void UTIL_DrawDataTable(FILE *fp, datamap_t *pMap, int level)
|
|||||||
|
|
||||||
if (externalname == NULL)
|
if (externalname == NULL)
|
||||||
{
|
{
|
||||||
fprintf(fp,"%s- %s (%s)(%i Bytes)\n", spaces, pMap->dataDesc[i].fieldName, flags, pMap->dataDesc[i].fieldSizeInBytes);
|
fprintf(fp, "%s- %s (Offset %d) (%s)(%i Bytes)\n", spaces, pMap->dataDesc[i].fieldName, GetTypeDescOffs(&pMap->dataDesc[i]), flags, pMap->dataDesc[i].fieldSizeInBytes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(fp,"%s- %s (%s)(%i Bytes) - %s\n", spaces, pMap->dataDesc[i].fieldName, flags, pMap->dataDesc[i].fieldSizeInBytes, externalname);
|
fprintf(fp, "%s- %s (Offset %d) (%s)(%i Bytes) - %s\n", spaces, pMap->dataDesc[i].fieldName, GetTypeDescOffs(&pMap->dataDesc[i]), flags, pMap->dataDesc[i].fieldSizeInBytes, externalname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,6 @@
|
|||||||
"windows" "11"
|
"windows" "11"
|
||||||
"linux" "13"
|
"linux" "13"
|
||||||
}
|
}
|
||||||
|
|
||||||
"EntInfo"
|
|
||||||
{
|
|
||||||
"windows" "4"
|
|
||||||
"linux" "4"
|
|
||||||
"mac" "4"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"Signatures"
|
"Signatures"
|
||||||
@ -54,24 +47,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CGlobalEntityList */
|
|
||||||
"#default"
|
"#default"
|
||||||
{
|
{
|
||||||
/* These games do have symbols in the linux binaries */
|
"Keys"
|
||||||
"#supported"
|
|
||||||
{
|
{
|
||||||
"game" "fof"
|
"UseInvalidUniverseInSteam2IDs" "1"
|
||||||
"game" "nmrih"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"Offsets"
|
"Offsets"
|
||||||
{
|
{
|
||||||
/* Offset into LevelShutdown */
|
|
||||||
"gEntList"
|
|
||||||
{
|
|
||||||
"windows" "11"
|
|
||||||
}
|
|
||||||
|
|
||||||
"EntInfo"
|
"EntInfo"
|
||||||
{
|
{
|
||||||
"windows" "4"
|
"windows" "4"
|
||||||
@ -79,28 +63,5 @@
|
|||||||
"mac" "4"
|
"mac" "4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"Signatures"
|
|
||||||
{
|
|
||||||
"LevelShutdown"
|
|
||||||
{
|
|
||||||
"library" "server"
|
|
||||||
"windows" "\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8"
|
|
||||||
}
|
|
||||||
"gEntList"
|
|
||||||
{
|
|
||||||
"library" "server"
|
|
||||||
"linux" "@gEntList"
|
|
||||||
"mac" "@gEntList"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"#default"
|
|
||||||
{
|
|
||||||
"Keys"
|
|
||||||
{
|
|
||||||
"UseInvalidUniverseInSteam2IDs" "1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public OnPluginStart()
|
|||||||
LoadTranslations("common.phrases");
|
LoadTranslations("common.phrases");
|
||||||
LoadTranslations("basetriggers.phrases");
|
LoadTranslations("basetriggers.phrases");
|
||||||
|
|
||||||
g_Cvar_TriggerShow = CreateConVar("sm_trigger_show", "1", "Display triggers message to all players? (0 off, 1 on, def. 1)", 0, true, 0.0, true, 1.0);
|
g_Cvar_TriggerShow = CreateConVar("sm_trigger_show", "0", "Display triggers message to all players? (0 off, 1 on, def. 0)", 0, true, 0.0, true, 1.0);
|
||||||
g_Cvar_TimeleftInterval = CreateConVar("sm_timeleft_interval", "0.0", "Display timeleft every x seconds. Default 0.", 0, true, 0.0, true, 1800.0);
|
g_Cvar_TimeleftInterval = CreateConVar("sm_timeleft_interval", "0.0", "Display timeleft every x seconds. Default 0.", 0, true, 0.0, true, 1800.0);
|
||||||
g_Cvar_FriendlyFire = FindConVar("mp_friendlyfire");
|
g_Cvar_FriendlyFire = FindConVar("mp_friendlyfire");
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ methodmap ArrayList < Handle {
|
|||||||
public native ArrayList(int blocksize=1, int startsize=0);
|
public native ArrayList(int blocksize=1, int startsize=0);
|
||||||
|
|
||||||
// Clears an array of all entries. This is the same as Resize(0).
|
// Clears an array of all entries. This is the same as Resize(0).
|
||||||
public native void ClearArray();
|
public native void Clear();
|
||||||
|
|
||||||
// Clones an array, returning a new handle with the same size and data.
|
// Clones an array, returning a new handle with the same size and data.
|
||||||
// This should NOT be confused with CloneHandle. This is a completely new
|
// This should NOT be confused with CloneHandle. This is a completely new
|
||||||
|
@ -477,13 +477,13 @@ stock Database SQLite_UseDatabase(const char[] database,
|
|||||||
char[] error,
|
char[] error,
|
||||||
maxlength)
|
maxlength)
|
||||||
{
|
{
|
||||||
new Handle kv, Handle db;
|
Handle kv, db;
|
||||||
|
|
||||||
kv = CreateKeyValues("");
|
kv = CreateKeyValues("");
|
||||||
KvSetString(kv, "driver", "sqlite");
|
KvSetString(kv, "driver", "sqlite");
|
||||||
KvSetString(kv, "database", database);
|
KvSetString(kv, "database", database);
|
||||||
|
|
||||||
db = SQL_ConnectCustom(kv, error, int maxlength, false);
|
db = SQL_ConnectCustom(kv, error, maxlength, false);
|
||||||
|
|
||||||
CloseHandle(kv);
|
CloseHandle(kv);
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ stock bool SQL_QuoteString(Handle database,
|
|||||||
maxlength,
|
maxlength,
|
||||||
&written=0)
|
&written=0)
|
||||||
{
|
{
|
||||||
return SQL_EscapeString(database, string, buffer, int maxlength, written);
|
return SQL_EscapeString(database, string, buffer, maxlength, written);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -624,3 +624,21 @@ native EntRefToEntIndex(ref);
|
|||||||
*/
|
*/
|
||||||
native MakeCompatEntRef(ref);
|
native MakeCompatEntRef(ref);
|
||||||
|
|
||||||
|
|
||||||
|
enum ClientRangeType
|
||||||
|
{
|
||||||
|
RangeType_Visibility = 0,
|
||||||
|
RangeType_Audibility,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find clients that are potentially in range of a position.
|
||||||
|
*
|
||||||
|
* @param origin Coordinates from which to test range.
|
||||||
|
* @param rangeType Range type to use for filtering clients.
|
||||||
|
* @param clients Array to which found client indexes will be written.
|
||||||
|
* @param size Maximum size of clients array.
|
||||||
|
* @return Number of client indexes written to clients array.
|
||||||
|
*/
|
||||||
|
native int GetClientsInRange(float origin[3], ClientRangeType rangeType, int[] clients, int size);
|
||||||
|
|
||||||
|
@ -264,7 +264,9 @@ typeset SDKHookCB
|
|||||||
// OnTakeDamagePost
|
// OnTakeDamagePost
|
||||||
// OnTakeDamageAlivePost
|
// OnTakeDamageAlivePost
|
||||||
function void (int victim, int attacker, int inflictor, float damage, int damagetype);
|
function void (int victim, int attacker, int inflictor, float damage, int damagetype);
|
||||||
function void (int victim, int attacker, int inflictor, float damage, int damagetype, const float damageForce[3], const float damagePosition[3]);
|
function void (int victim, int attacker, int inflictor, float damage, int damagetype, int weapon, const float damageForce[3], const float damagePosition[3]);
|
||||||
|
function void (int victim, int attacker, int inflictor, float damage, int damagetype, int weapon,
|
||||||
|
const float damageForce[3], const float damagePosition[3], int damagecustom);
|
||||||
|
|
||||||
// FireBulletsPost
|
// FireBulletsPost
|
||||||
function void (int client, int shots, const char[] weaponname);
|
function void (int client, int shots, const char[] weaponname);
|
||||||
|
@ -487,7 +487,6 @@ enum TokenKind {
|
|||||||
tpDEFINE,
|
tpDEFINE,
|
||||||
tpELSE, /* #else */
|
tpELSE, /* #else */
|
||||||
tpELSEIF, /* #elseif */
|
tpELSEIF, /* #elseif */
|
||||||
tpEMIT,
|
|
||||||
tpENDIF,
|
tpENDIF,
|
||||||
tpENDINPUT,
|
tpENDINPUT,
|
||||||
tpENDSCRPT,
|
tpENDSCRPT,
|
||||||
|
@ -1445,12 +1445,25 @@ static void dodecl(const token_t *tok)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fpublic = (tok->id == tPUBLIC);
|
int fpublic = FALSE, fstock = FALSE, fstatic = FALSE, fconst = FALSE;
|
||||||
int fstock = (tok->id == tSTOCK);
|
switch (tok->id) {
|
||||||
int fstatic = (tok->id == tSTATIC);
|
case tPUBLIC:
|
||||||
|
fpublic = TRUE;
|
||||||
|
break;
|
||||||
|
case tSTOCK:
|
||||||
|
fstock = TRUE;
|
||||||
|
if (matchtoken(tSTATIC))
|
||||||
|
fstatic = TRUE;
|
||||||
|
break;
|
||||||
|
case tSTATIC:
|
||||||
|
fstatic = TRUE;
|
||||||
|
|
||||||
if (fstatic && matchtoken(tSTOCK))
|
// For compatibility, we must include this case. Though "stock" should
|
||||||
fstock = TRUE;
|
// come first.
|
||||||
|
if (matchtoken(tSTOCK))
|
||||||
|
fstock = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
int flags = DECLFLAG_MAYBE_FUNCTION | DECLFLAG_VARIABLE | DECLFLAG_ENUMROOT;
|
int flags = DECLFLAG_MAYBE_FUNCTION | DECLFLAG_VARIABLE | DECLFLAG_ENUMROOT;
|
||||||
if (tok->id == tNEW)
|
if (tok->id == tNEW)
|
||||||
@ -1462,7 +1475,13 @@ static void dodecl(const token_t *tok)
|
|||||||
decl.type.tag = 0;
|
decl.type.tag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!decl.opertok && (tok->id == tNEW || decl.type.has_postdims || !lexpeek('('))) {
|
// Hacky bag o' hints as to whether this is a variable decl.
|
||||||
|
bool probablyVariable = tok->id == tNEW ||
|
||||||
|
decl.type.has_postdims ||
|
||||||
|
!lexpeek('(') ||
|
||||||
|
((decl.type.usage & uCONST) == uCONST);
|
||||||
|
|
||||||
|
if (!decl.opertok && probablyVariable) {
|
||||||
if (tok->id == tNEW && decl.type.is_new)
|
if (tok->id == tNEW && decl.type.is_new)
|
||||||
error(143);
|
error(143);
|
||||||
if (decl.type.tag & STRUCTTAG) {
|
if (decl.type.tag & STRUCTTAG) {
|
||||||
@ -4628,9 +4647,9 @@ static void decl_enum(int vclass)
|
|||||||
char *str;
|
char *str;
|
||||||
int tag,explicittag;
|
int tag,explicittag;
|
||||||
cell increment,multiplier;
|
cell increment,multiplier;
|
||||||
constvalue *enumroot;
|
|
||||||
LayoutSpec spec;
|
LayoutSpec spec;
|
||||||
symbol *enumsym = nullptr;
|
symbol *enumsym = nullptr;
|
||||||
|
constvalue *enumroot = nullptr;
|
||||||
|
|
||||||
/* get an explicit tag, if any (we need to remember whether an explicit
|
/* get an explicit tag, if any (we need to remember whether an explicit
|
||||||
* tag was passed, even if that explicit tag was "_:", so we cannot call
|
* tag was passed, even if that explicit tag was "_:", so we cannot call
|
||||||
|
@ -1036,10 +1036,6 @@ static int command(void)
|
|||||||
} /* if */
|
} /* if */
|
||||||
if (!cp_set(name))
|
if (!cp_set(name))
|
||||||
error(FATAL_ERROR_NO_CODEPAGE);
|
error(FATAL_ERROR_NO_CODEPAGE);
|
||||||
} else if (strcmp(str,"compress")==0) {
|
|
||||||
cell val;
|
|
||||||
preproc_expr(&val,NULL);
|
|
||||||
sc_compress=(int)val; /* switch code packing on/off */
|
|
||||||
} else if (strcmp(str,"ctrlchar")==0) {
|
} else if (strcmp(str,"ctrlchar")==0) {
|
||||||
while (*lptr<=' ' && *lptr!='\0')
|
while (*lptr<=' ' && *lptr!='\0')
|
||||||
lptr++;
|
lptr++;
|
||||||
@ -1059,70 +1055,6 @@ static int command(void)
|
|||||||
lptr=(unsigned char*)strchr((char*)lptr,'\0'); /* skip to end (ignore "extra characters on line") */
|
lptr=(unsigned char*)strchr((char*)lptr,'\0'); /* skip to end (ignore "extra characters on line") */
|
||||||
} else if (strcmp(str,"dynamic")==0) {
|
} else if (strcmp(str,"dynamic")==0) {
|
||||||
preproc_expr(&pc_stksize,NULL);
|
preproc_expr(&pc_stksize,NULL);
|
||||||
} else if (!strcmp(str,"library")
|
|
||||||
||!strcmp(str,"reqclass")
|
|
||||||
||!strcmp(str,"loadlib")
|
|
||||||
||!strcmp(str,"explib")
|
|
||||||
||!strcmp(str,"expclass")
|
|
||||||
||!strcmp(str,"defclasslib")) {
|
|
||||||
char name[sNAMEMAX+1],sname[sNAMEMAX+1];
|
|
||||||
const char *prefix="";
|
|
||||||
sname[0]='\0';
|
|
||||||
sname[1]='\0';
|
|
||||||
if (!strcmp(str,"library"))
|
|
||||||
prefix="??li_";
|
|
||||||
else if (!strcmp(str,"reqclass"))
|
|
||||||
prefix="??rc_";
|
|
||||||
else if (!strcmp(str,"loadlib"))
|
|
||||||
prefix="??f_";
|
|
||||||
else if (!strcmp(str,"explib"))
|
|
||||||
prefix="??el_";
|
|
||||||
else if (!strcmp(str,"expclass"))
|
|
||||||
prefix="??ec_";
|
|
||||||
else if (!strcmp(str,"defclasslib"))
|
|
||||||
prefix="??d_";
|
|
||||||
while (*lptr<=' ' && *lptr!='\0')
|
|
||||||
lptr++;
|
|
||||||
if (*lptr=='"') {
|
|
||||||
lptr=getstring((unsigned char*)name,sizeof name,lptr);
|
|
||||||
} else {
|
|
||||||
int i;
|
|
||||||
for (i=0; i<sizeof name && (alphanum(*lptr) || *lptr=='-'); i++,lptr++)
|
|
||||||
name[i]=*lptr;
|
|
||||||
name[i]='\0';
|
|
||||||
if (!strncmp(str,"exp",3) || !strncmp(str,"def",3)) {
|
|
||||||
while (*lptr && isspace(*lptr))
|
|
||||||
lptr++;
|
|
||||||
for (i=1; i<sizeof sname && alphanum(*lptr); i++,lptr++)
|
|
||||||
sname[i]=*lptr;
|
|
||||||
sname[i]='\0';
|
|
||||||
if (!sname[1]) {
|
|
||||||
error(45);
|
|
||||||
} else {
|
|
||||||
sname[0]='_';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* if */
|
|
||||||
if (strlen(name)==0) {
|
|
||||||
curlibrary=NULL;
|
|
||||||
} else if (strcmp(name,"-")==0) {
|
|
||||||
pc_addlibtable=FALSE;
|
|
||||||
} else {
|
|
||||||
/* add the name if it does not yet exist in the table */
|
|
||||||
char newname[sNAMEMAX+1];
|
|
||||||
if (strlen(name)+strlen(prefix)+strlen(sname)<=sNAMEMAX) {
|
|
||||||
strcpy(newname,prefix);
|
|
||||||
strcat(newname,name);
|
|
||||||
strcat(newname,sname);
|
|
||||||
if (find_constval(&libname_tab,newname,0)==NULL) {
|
|
||||||
if (!strcmp(str,"library") || !strcmp(str,"reqclass")) {
|
|
||||||
curlibrary=append_constval(&libname_tab,newname,1,0);
|
|
||||||
} else {
|
|
||||||
append_constval(&libname_tab,newname,1,0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* if */
|
|
||||||
} else if (strcmp(str,"rational")==0) {
|
} else if (strcmp(str,"rational")==0) {
|
||||||
char name[sNAMEMAX+1];
|
char name[sNAMEMAX+1];
|
||||||
cell digits=0;
|
cell digits=0;
|
||||||
@ -1222,62 +1154,6 @@ static int command(void)
|
|||||||
inpf=NULL;
|
inpf=NULL;
|
||||||
} /* if */
|
} /* if */
|
||||||
break;
|
break;
|
||||||
#if !defined NOEMIT
|
|
||||||
case tpEMIT: {
|
|
||||||
/* write opcode to output file */
|
|
||||||
char name[40];
|
|
||||||
int i;
|
|
||||||
while (*lptr<=' ' && *lptr!='\0')
|
|
||||||
lptr++;
|
|
||||||
for (i=0; i<40 && (isalpha(*lptr) || *lptr=='.'); i++,lptr++)
|
|
||||||
name[i]=(char)tolower(*lptr);
|
|
||||||
name[i]='\0';
|
|
||||||
stgwrite("\t");
|
|
||||||
stgwrite(name);
|
|
||||||
stgwrite(" ");
|
|
||||||
code_idx+=opcodes(1);
|
|
||||||
/* write parameter (if any) */
|
|
||||||
while (*lptr<=' ' && *lptr!='\0')
|
|
||||||
lptr++;
|
|
||||||
if (*lptr!='\0') {
|
|
||||||
symbol *sym;
|
|
||||||
tok=lex(&val,&str);
|
|
||||||
switch (tok) {
|
|
||||||
case tNUMBER:
|
|
||||||
case tRATIONAL:
|
|
||||||
outval(val,FALSE);
|
|
||||||
code_idx+=opargs(1);
|
|
||||||
break;
|
|
||||||
case tSYMBOL:
|
|
||||||
sym=findloc(str);
|
|
||||||
if (sym==NULL)
|
|
||||||
sym=findglb(str,sSTATEVAR);
|
|
||||||
if (sym==NULL || (sym->ident!=iFUNCTN && sym->ident!=iREFFUNC && (sym->usage & uDEFINE)==0)) {
|
|
||||||
error(17,str); /* undefined symbol */
|
|
||||||
} else {
|
|
||||||
outval(sym->addr,FALSE);
|
|
||||||
/* mark symbol as "used", unknown whether for read or write */
|
|
||||||
markusage(sym,uREAD | uWRITTEN);
|
|
||||||
code_idx+=opargs(1);
|
|
||||||
} /* if */
|
|
||||||
break;
|
|
||||||
default: {
|
|
||||||
char s2[20];
|
|
||||||
extern const char *sc_tokens[];/* forward declaration */
|
|
||||||
if (tok<256)
|
|
||||||
sprintf(s2,"%c",(char)tok);
|
|
||||||
else
|
|
||||||
strcpy(s2,sc_tokens[tok-tFIRST]);
|
|
||||||
error(1,sc_tokens[tSYMBOL-tFIRST],s2);
|
|
||||||
break;
|
|
||||||
} /* case */
|
|
||||||
} /* switch */
|
|
||||||
} /* if */
|
|
||||||
stgwrite("\n");
|
|
||||||
check_empty(lptr);
|
|
||||||
break;
|
|
||||||
} /* case */
|
|
||||||
#endif
|
|
||||||
#if !defined NO_DEFINE
|
#if !defined NO_DEFINE
|
||||||
case tpDEFINE: {
|
case tpDEFINE: {
|
||||||
ret=CMD_DEFINE;
|
ret=CMD_DEFINE;
|
||||||
@ -2047,7 +1923,7 @@ const char *sc_tokens[] = {
|
|||||||
"volatile",
|
"volatile",
|
||||||
"while",
|
"while",
|
||||||
"with",
|
"with",
|
||||||
"#assert", "#define", "#else", "#elseif", "#emit", "#endif", "#endinput",
|
"#assert", "#define", "#else", "#elseif", "#endif", "#endinput",
|
||||||
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
|
"#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma",
|
||||||
"#tryinclude", "#undef",
|
"#tryinclude", "#undef",
|
||||||
";", ";", "-integer value-", "-rational value-", "-identifier-",
|
";", ";", "-integer value-", "-rational value-", "-identifier-",
|
||||||
|
5
sourcepawn/compiler/tests/ok-static-stocks-1.sp
Normal file
5
sourcepawn/compiler/tests/ok-static-stocks-1.sp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
static stock const X = 5;
|
||||||
|
stock static const Y = 6;
|
||||||
|
|
||||||
|
public main()
|
||||||
|
{}
|
7
sourcepawn/compiler/tests/ok-static-stocks-2.sp
Normal file
7
sourcepawn/compiler/tests/ok-static-stocks-2.sp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
static stock const X = 5;
|
||||||
|
stock static const Y = 6;
|
||||||
|
|
||||||
|
public main()
|
||||||
|
{
|
||||||
|
return X + Y;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user