Add new public var with mapname and new constant (#687)
* Add new public var with current map name * Add a constant to define max map's name length * Reducing the maximum buffer size to store a map's name * The PLATFORM_MAX_PATH constant replaced to MAX_MAPNAME_LENGTH
This commit is contained in:
parent
6bed09db57
commit
1cc7786a4c
|
@ -15,6 +15,7 @@
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "libraries.h"
|
#include "libraries.h"
|
||||||
#include <amxmodx_version.h>
|
#include <amxmodx_version.h>
|
||||||
|
#include "engine_strucs.h"
|
||||||
|
|
||||||
extern const char *no_function;
|
extern const char *no_function;
|
||||||
|
|
||||||
|
@ -154,6 +155,11 @@ int CPluginMngr::loadPluginsFromFile(const char* filename, bool warn)
|
||||||
*get_amxaddr(plugin->getAMX(), addr) = gpGlobals->maxClients;
|
*get_amxaddr(plugin->getAMX(), addr) = gpGlobals->maxClients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (amx_FindPubVar(plugin->getAMX(), "MapName", &addr) != AMX_ERR_NOTFOUND)
|
||||||
|
{
|
||||||
|
set_amxstring(plugin->getAMX(), addr, STRING(gpGlobals->mapname), MAX_MAPNAME_LENGTH - 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (amx_FindPubVar(plugin->getAMX(), "NULL_STRING", &addr) != AMX_ERR_NOTFOUND)
|
if (amx_FindPubVar(plugin->getAMX(), "NULL_STRING", &addr) != AMX_ERR_NOTFOUND)
|
||||||
{
|
{
|
||||||
plugin->m_pNullStringOfs = get_amxaddr(plugin->getAMX(), addr);
|
plugin->m_pNullStringOfs = get_amxaddr(plugin->getAMX(), addr);
|
||||||
|
|
|
@ -29,7 +29,7 @@ static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
|
||||||
char* sName = get_amxstring(amx, params[1], 0, len);
|
char* sName = get_amxstring(amx, params[1], 0, len);
|
||||||
cell ptr;
|
cell ptr;
|
||||||
|
|
||||||
if (!strcmp(sName, "MaxClients") || !strcmp(sName, "NULL_STRING") || !strcmp(sName, "NULL_VECTOR"))
|
if (!strcmp(sName, "MaxClients") || !strcmp(sName, "MapName") || !strcmp(sName, "NULL_STRING") || !strcmp(sName, "NULL_VECTOR"))
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,11 @@
|
||||||
*/
|
*/
|
||||||
#define MAX_STRING_LENGTH 16384
|
#define MAX_STRING_LENGTH 16384
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum buffer size required to store a map's name.
|
||||||
|
*/
|
||||||
|
#define MAX_MAPNAME_LENGTH 64
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines and constants related to the maximum number of clients.
|
* Defines and constants related to the maximum number of clients.
|
||||||
*
|
*
|
||||||
|
@ -44,6 +49,11 @@
|
||||||
*/
|
*/
|
||||||
public stock const MaxClients;
|
public stock const MaxClients;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current map name
|
||||||
|
*/
|
||||||
|
public stock const MapName[MAX_MAPNAME_LENGTH];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass this into certain functions to act as a C++ NULL
|
* Pass this into certain functions to act as a C++ NULL
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#define MAX_LIGHTSTYLES 64
|
#define MAX_LIGHTSTYLES 64
|
||||||
#define MAX_PACKET_ENTITIES 256
|
#define MAX_PACKET_ENTITIES 256
|
||||||
#define MAX_PATH_LENGTH 260
|
#define MAX_PATH_LENGTH 260
|
||||||
|
#define MAX_MAPNAME_LENGTH 64
|
||||||
|
|
||||||
#define MAX_LATENT 32
|
#define MAX_LATENT 32
|
||||||
#define FRAGMENT_SIZE 1400
|
#define FRAGMENT_SIZE 1400
|
||||||
|
|
Loading…
Reference in New Issue
Block a user