core/logic/smn_maplists.cpp
author Nicholas Hastings <skamonkey@gmail.com>
Wed Oct 09 08:43:08 2013 -0400 (2013-10-09)
changeset 4139 de7d1cd00703
parent 4066 c055944bdfd6
child 4196 5346ef2b217e
permissions -rw-r--r--
Move ForwardSys from core to logic (bug 5953, r=fyren).
     1 /**
     2  * vim: set ts=4 sw=4 tw=99 noet :
     3  * =============================================================================
     4  * SourceMod
     5  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     6  * =============================================================================
     7  *
     8  * This program is free software; you can redistribute it and/or modify it under
     9  * the terms of the GNU General Public License, version 3.0, as published by the
    10  * Free Software Foundation.
    11  * 
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *
    20  * As a special exception, AlliedModders LLC gives you permission to link the
    21  * code of this program (as well as its derivative works) to "Half-Life 2," the
    22  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    23  * by the Valve Corporation.  You must obey the GNU General Public License in
    24  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    25  * this exception to all derivative works.  AlliedModders LLC defines further
    26  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    27  * or <http://www.sourcemod.net/license.php>.
    28  *
    29  * Version: $Id$
    30  */
    31 
    32 #include <sh_list.h>
    33 #include <sm_namehashset.h>
    34 #include "common_logic.h"
    35 #include "CellArray.h"
    36 #include <IGameHelpers.h>
    37 #include <ILibrarySys.h>
    38 #include <ITextParsers.h>
    39 #include <ISourceMod.h>
    40 #include "stringutil.h"
    41 
    42 using namespace SourceHook;
    43 
    44 struct maplist_info_t
    45 {
    46 	bool bIsCompat;
    47 	bool bIsPath;
    48 	char name[PLATFORM_MAX_PATH];
    49 	char path[PLATFORM_MAX_PATH];
    50 	time_t last_modified_time;
    51 	CellArray *pArray;
    52 	int serial;
    53 
    54 	static inline bool matches(const char *key, const maplist_info_t *value)
    55 	{
    56 		return strcmp(value->name, key) == 0;
    57 	}
    58 };
    59 
    60 #define MAPLIST_FLAG_MAPSFOLDER		(1<<0)		/**< On failure, use all maps in the maps folder. */
    61 #define MAPLIST_FLAG_CLEARARRAY		(1<<1)		/**< If an input array is specified, clear it before adding. */
    62 #define MAPLIST_FLAG_NO_DEFAULT		(1<<2)		/**< Do not read "default" or "mapcyclefile" on failure. */
    63 
    64 class MapLists : public SMGlobalClass, public ITextListener_SMC
    65 {
    66 public:
    67 	enum MapListState
    68 	{
    69 		MPS_NONE,
    70 		MPS_GLOBAL,
    71 		MPS_MAPLIST,
    72 	};
    73 public:
    74 	MapLists()
    75 	{
    76 		m_pMapCycleFile = NULL;
    77 		m_ConfigLastChanged = 0;
    78 		m_nSerialChange = 0;
    79 	}
    80 	void OnSourceModAllInitialized()
    81 	{
    82 		g_pSM->BuildPath(Path_SM, m_ConfigFile, sizeof(m_ConfigFile), "configs/maplists.cfg");
    83 	}
    84 	void OnSourceModShutdown()
    85 	{
    86 		DumpCache(NULL);
    87 	}
    88 	void GetMapCycleFilePath(char *pBuffer, int maxlen)
    89 	{
    90 		const char *pEngineName = smcore.GetSourceEngineName();
    91 		const char *pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
    92 
    93 		if (strcmp(pEngineName, "tf2") == 0 || strcmp(pEngineName, "css") == 0
    94 			|| strcmp(pEngineName, "dods") == 0 || strcmp(pEngineName, "hl2dm") == 0)
    95 		{
    96 			// These four games and Source SDK 2013 do a lookup in this order; so shall we.
    97 			g_pSM->BuildPath(Path_Game,
    98 				pBuffer,
    99 				maxlen,
   100 				"cfg/%s",
   101 				pMapCycleFileName);
   102 
   103 			if (!libsys->PathExists(pBuffer))
   104 			{
   105 				g_pSM->BuildPath(Path_Game,
   106 					pBuffer,
   107 					maxlen,
   108 					"%s",
   109 					pMapCycleFileName);
   110 
   111 				if (!libsys->PathExists(pBuffer))
   112 				{
   113 					g_pSM->BuildPath(Path_Game,
   114 						pBuffer,
   115 						maxlen,
   116 						"cfg/mapcycle_default.txt");
   117 				}
   118 			}
   119 		}
   120 		else
   121 		{
   122 			g_pSM->BuildPath(Path_Game,
   123 				pBuffer,
   124 				maxlen,
   125 				"%s",
   126 				pMapCycleFileName);
   127 		}
   128 	}
   129 	void AddOrUpdateDefault(const char *name, const char *file)
   130 	{
   131 		char path[PLATFORM_MAX_PATH];
   132 		maplist_info_t *pMapList;
   133 
   134 		if (!m_ListLookup.retrieve(name, &pMapList))
   135 		{
   136 			pMapList = new maplist_info_t;
   137 			pMapList->bIsCompat = true;
   138 			pMapList->bIsPath = true;
   139 			pMapList->last_modified_time = 0;
   140 			smcore.strncopy(pMapList->name, name, sizeof(pMapList->name));
   141 			pMapList->pArray = NULL;
   142 			g_pSM->BuildPath(Path_Game, pMapList->path, sizeof(pMapList->path), "%s", file);
   143 			pMapList->serial = 0;
   144 			m_ListLookup.insert(name, pMapList);
   145 			m_MapLists.push_back(pMapList);
   146 			return;
   147 		}
   148 
   149 		/* Don't modify if it's from the config file */
   150 		if (!pMapList->bIsCompat)
   151 			return;
   152 
   153 		g_pSM->BuildPath(Path_Game, path, sizeof(path), "%s", file);
   154 
   155 		/* If the path matches, don't reset the serial/time */
   156 		if (strcmp(path, pMapList->path) == 0)
   157 			return;
   158 
   159 		smcore.strncopy(pMapList->path, path, sizeof(pMapList->path));
   160 		pMapList->bIsPath = true;
   161 		pMapList->last_modified_time = 0;
   162 		pMapList->serial = 0;
   163 	}
   164 	void UpdateCache()
   165 	{
   166 		bool fileFound;
   167 		SMCError error;
   168 		time_t fileTime;
   169 		SMCStates states = {0, 0};
   170 		
   171 		fileFound = libsys->FileTime(m_ConfigFile, FileTime_LastChange, &fileTime);
   172 
   173 		/* If the file is found and hasn't changed, bail out now. */
   174 		if (fileFound && fileTime == m_ConfigLastChanged)
   175 		{
   176 			return;
   177 		}
   178 
   179 		/* If the file wasn't found, and we already have entries, we bail out too. 
   180 		 * This case lets us optimize when a user deletes the config file, so we 
   181 		 * don't reparse every single time the function is called.
   182 		 */
   183 		if (!fileFound && m_MapLists.size() > 0)
   184 		{
   185 			return;
   186 		}
   187 
   188 		m_pMapCycleFile = smcore.FindConVar("mapcyclefile");
   189 
   190 		/* Dump everything we know about. */
   191 		List<maplist_info_t *> compat;
   192 		DumpCache(&compat);
   193 
   194 		/* All this is to add the default entry back in. */
   195 		maplist_info_t *pDefList = new maplist_info_t;
   196 
   197 		pDefList->bIsPath = true;
   198 		smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
   199 
   200 		GetMapCycleFilePath(pDefList->path, sizeof(pDefList->path));
   201 		
   202 		pDefList->last_modified_time = 0;
   203 		pDefList->pArray = NULL;
   204 		pDefList->serial = 0;
   205 
   206 		m_ListLookup.insert("mapcyclefile", pDefList);
   207 		m_MapLists.push_back(pDefList);
   208 
   209 		/* Now parse the config file even if we don't know about it.
   210 		 * This will give us a nice error message.
   211 		 */
   212 		if ((error = textparser->ParseFile_SMC(m_ConfigFile, this, &states))
   213 			!= SMCError_Okay)
   214 		{
   215 			const char *errmsg = textparser->GetSMCErrorString(error);
   216 			if (errmsg == NULL)
   217 			{
   218 				errmsg = "Unknown error";
   219 			}
   220 			smcore.LogError("[SM] Could not parse file \"%s\"", m_ConfigFile);
   221 			smcore.LogError("[SM] Error on line %d (col %d): %s", states.line, states.col, errmsg);
   222 		}
   223 		else
   224 		{
   225 			m_ConfigLastChanged = fileTime;
   226 		}
   227 
   228 		/* Now, re-add compat stuff back in if we can. */
   229 		List<maplist_info_t *>::iterator iter = compat.begin();
   230 		while (iter != compat.end())
   231 		{
   232 			if (m_ListLookup.contains((*iter)->name))
   233 			{
   234 				/* The compatibility shim is no longer needed. */
   235 				delete (*iter)->pArray;
   236 				delete (*iter);
   237 			}
   238 			else
   239 			{
   240 				m_ListLookup.insert((*iter)->name, (*iter));
   241 				m_MapLists.push_back((*iter));
   242 			}
   243 			iter = compat.erase(iter);
   244 		}
   245 	}
   246 	void ReadSMC_ParseStart()
   247 	{
   248 		m_CurState = MPS_NONE;
   249 		m_IgnoreLevel = 0;
   250 		m_pCurMapList = NULL;
   251 	}
   252 	SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name)
   253 	{
   254 		if (m_IgnoreLevel)
   255 		{
   256 			m_IgnoreLevel++;
   257 			return SMCResult_Continue;
   258 		}
   259 
   260 		if (m_CurState == MPS_NONE)
   261 		{
   262 			if (strcmp(name, "MapLists") == 0)
   263 			{
   264 				m_CurState = MPS_GLOBAL;
   265 			}
   266 			else
   267 			{
   268 				m_IgnoreLevel = 1;
   269 			}
   270 		}
   271 		else if (m_CurState == MPS_GLOBAL)
   272 		{
   273 			m_pCurMapList = new maplist_info_t;
   274 
   275 			memset(m_pCurMapList, 0, sizeof(maplist_info_t));
   276 			smcore.strncopy(m_pCurMapList->name, name, sizeof(m_pCurMapList->name));
   277 
   278 			m_CurState = MPS_MAPLIST;
   279 		}
   280 		else if (m_CurState == MPS_MAPLIST)
   281 		{
   282 			m_IgnoreLevel++;
   283 		}
   284 
   285 		return SMCResult_Continue;
   286 	}
   287 	SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
   288 	{
   289 		if (m_IgnoreLevel || m_pCurMapList == NULL)
   290 		{
   291 			return SMCResult_Continue;
   292 		}
   293 
   294 		if (strcmp(key, "file") == 0)
   295 		{
   296 			g_pSM->BuildPath(Path_Game, 
   297 				m_pCurMapList->path,
   298 				sizeof(m_pCurMapList->path),
   299 				"%s",
   300 				value);
   301 			m_pCurMapList->bIsPath = true;
   302 		}
   303 		else if (strcmp(key, "target") == 0)
   304 		{
   305 			smcore.strncopy(m_pCurMapList->path, value, sizeof(m_pCurMapList->path));
   306 			m_pCurMapList->bIsPath = false;
   307 		}
   308 
   309 		return SMCResult_Continue;
   310 	}
   311 	SMCResult ReadSMC_LeavingSection(const SMCStates *states)
   312 	{
   313 		if (m_IgnoreLevel)
   314 		{
   315 			m_IgnoreLevel--;
   316 			return SMCResult_Continue;
   317 		}
   318 
   319 		if (m_CurState == MPS_MAPLIST)
   320 		{
   321 			if (m_pCurMapList != NULL
   322 				&& m_pCurMapList->path[0] != '\0'
   323 				&& !m_ListLookup.contains(m_pCurMapList->name))
   324 			{
   325 				m_ListLookup.insert(m_pCurMapList->name, m_pCurMapList);
   326 				m_MapLists.push_back(m_pCurMapList);
   327 				m_pCurMapList = NULL;
   328 			}
   329 			else
   330 			{
   331 				delete m_pCurMapList;
   332 				m_pCurMapList = NULL;
   333 			}
   334 			m_CurState = MPS_GLOBAL;
   335 		}
   336 		else if (m_CurState == MPS_GLOBAL)
   337 		{
   338 			m_CurState = MPS_NONE;
   339 		}
   340 
   341 		return SMCResult_Continue;
   342 	}
   343 	void ReadSMC_ParseEnd(bool halted, bool failed)
   344 	{
   345 		delete m_pCurMapList;
   346 		m_pCurMapList = NULL;
   347 	}
   348 	static int sort_maps_in_adt_array(const void *str1, const void *str2)
   349 	{
   350 		return strcmp((char *)str1, (char *)str2);
   351 	}
   352 	CellArray *UpdateMapList(CellArray *pUseArray, const char *name, int *pSerial, unsigned int flags)
   353 	{
   354 		int change_serial;
   355 		CellArray *pNewArray = NULL;
   356 		bool success, free_new_array;
   357 
   358 		free_new_array = false;
   359 		
   360 		if ((success = GetMapList(&pNewArray, name, &change_serial)) == false)
   361 		{
   362 			if ((flags & MAPLIST_FLAG_NO_DEFAULT) != MAPLIST_FLAG_NO_DEFAULT)
   363 			{
   364 				/* If this list failed, and it's not the default, try the default. 
   365 				 */
   366 				if (strcmp(name, "default") != 0)
   367 				{
   368 					success = GetMapList(&pNewArray, name, &change_serial);
   369 				}
   370 				/* If either of the last two conditions failed, try again if we can. */
   371 				if (!success && strcmp(name, "mapcyclefile") != 0)
   372 				{
   373 					success = GetMapList(&pNewArray, "mapcyclefile", &change_serial);
   374 				}
   375 			}
   376 		}
   377 
   378 		/* If there was a success, and the serial has not changed, bail out. */
   379 		if (success && *pSerial == change_serial)
   380 		{
   381 			return NULL;
   382 		}
   383 
   384 		/**
   385 		 * If there was a success but no map list, we need to look in the maps folder.
   386 		 * If there was a failure and the flag is specified, we need to look in the maps folder.
   387 		 */
   388 		if ((success && pNewArray == NULL)
   389 			|| (!success && ((flags & MAPLIST_FLAG_MAPSFOLDER) == MAPLIST_FLAG_MAPSFOLDER)))
   390 		{
   391 			pNewArray = new CellArray(64);
   392 			free_new_array = true;
   393 
   394 			cell_t *blk;
   395 
   396 			FileFindHandle_t findHandle;
   397 			const char *fileName = smcore.filesystem->FindFirstEx("maps/*.bsp", "GAME", &findHandle);
   398 
   399 			while (fileName)
   400 			{
   401 				char buffer[PLATFORM_MAX_PATH];
   402 
   403 				UTIL_StripExtension(fileName, buffer, sizeof(buffer));
   404 
   405 				if (!engine->IsMapValid(buffer))
   406 				{
   407 					fileName = smcore.filesystem->FindNext(findHandle);
   408 					continue;
   409 				}
   410 
   411 				if ((blk = pNewArray->push()) == NULL)
   412 				{
   413 					fileName = smcore.filesystem->FindNext(findHandle);
   414 					continue;
   415 				}
   416 
   417 				smcore.strncopy((char *)blk, buffer, 255);
   418 
   419 				fileName = smcore.filesystem->FindNext(findHandle);
   420 			}
   421 
   422 			smcore.filesystem->FindClose(findHandle);
   423 
   424 			/* Remove the array if there were no items. */
   425 			if (pNewArray->size() == 0)
   426 			{
   427 				delete pNewArray;
   428 				pNewArray = NULL;
   429 			}
   430 			else
   431 			{
   432 				qsort(pNewArray->base(), 
   433 					pNewArray->size(), 
   434 					pNewArray->blocksize() * sizeof(cell_t), 
   435 					sort_maps_in_adt_array);
   436 			}
   437 
   438 			change_serial = -1;
   439 		}
   440 
   441 		/* If there is still no array by this point, bail out. */
   442 		if (pNewArray == NULL)
   443 		{
   444 			*pSerial = -1;
   445 			return NULL;
   446 		}
   447 
   448 		*pSerial = change_serial;
   449 
   450 		/* If there is no input array, return something temporary. */
   451 		if (pUseArray == NULL)
   452 		{
   453 			if (free_new_array)
   454 			{
   455 				return pNewArray;
   456 			}
   457 			else
   458 			{
   459 				return pNewArray->clone();
   460 			}
   461 		}
   462 
   463 		/* Clear the input array if necessary. */
   464 		if ((flags & MAPLIST_FLAG_CLEARARRAY) == MAPLIST_FLAG_CLEARARRAY)
   465 		{
   466 			pUseArray->clear();
   467 		}
   468 
   469 		/* Copy. */
   470 		cell_t *blk_dst;
   471 		cell_t *blk_src;
   472 		for (size_t i = 0; i < pNewArray->size(); i++)
   473 		{
   474 			blk_dst = pUseArray->push();
   475 			blk_src = pNewArray->at(i);
   476 			smcore.strncopy((char *)blk_dst, (char *)blk_src, pUseArray->blocksize() * sizeof(cell_t));
   477 		}
   478 
   479 		/* Free resources if necessary. */
   480 		if (free_new_array)
   481 		{
   482 			delete pNewArray;
   483 		}
   484 
   485 		/* Return the array we were given. */
   486 		return pUseArray;
   487 	}
   488 private:
   489 	bool GetMapList(CellArray **ppArray, const char *name, int *pSerial)
   490 	{
   491 		time_t last_time;
   492 		maplist_info_t *pMapList;
   493 
   494 		if (!m_ListLookup.retrieve(name, &pMapList))
   495 			return false;
   496 
   497 		if (!pMapList->bIsPath)
   498 			return GetMapList(ppArray, pMapList->path, pSerial);
   499 
   500 		/* If it is a path, and the path is "*", assume all files must be used. */
   501 		if (strcmp(pMapList->path, "*") == 0)
   502 		{
   503 			*ppArray = NULL;
   504 			return true;
   505 		}
   506 
   507 		if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
   508 		{
   509 			char path[PLATFORM_MAX_PATH];
   510 			GetMapCycleFilePath(path, sizeof(path));
   511 
   512 			if (strcmp(path, pMapList->path) != 0)
   513 			{
   514 				smcore.strncopy(pMapList->path, path, sizeof(pMapList->path));
   515 				pMapList->last_modified_time = 0;
   516 			}
   517 		}
   518 
   519 		if (!libsys->FileTime(pMapList->path, FileTime_LastChange, &last_time)
   520 			|| last_time > pMapList->last_modified_time)
   521 		{
   522 			/* Reparse */
   523 			FILE *fp;
   524 			cell_t *blk;
   525 			char buffer[255];
   526 
   527 			if ((fp = fopen(pMapList->path, "rt")) == NULL)
   528 			{
   529 				return false;
   530 			}
   531 
   532 			delete pMapList->pArray;
   533 			pMapList->pArray = new CellArray(64);
   534 
   535 			while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
   536 			{
   537 				size_t len = strlen(buffer);
   538 				char *ptr = smcore.TrimWhitespace(buffer, len);
   539 				if (*ptr == '\0'
   540 					|| *ptr == ';'
   541 					|| strncmp(ptr, "//", 2) == 0)
   542 				{
   543 					continue;
   544 				}
   545 				if (!gamehelpers->IsMapValid(ptr))
   546 				{
   547 					continue;
   548 				}
   549 				if ((blk = pMapList->pArray->push()) != NULL)
   550 				{
   551 					smcore.strncopy((char *)blk, ptr, 255);
   552 				}
   553 			}
   554 
   555 			fclose(fp);
   556 
   557 			pMapList->last_modified_time = last_time;
   558 			pMapList->serial = ++m_nSerialChange;
   559 		}
   560 
   561 		if (pMapList->pArray == NULL || pMapList->pArray->size() == 0)
   562 		{
   563 			return false;
   564 		}
   565 
   566 		*pSerial = pMapList->serial;
   567 		*ppArray = pMapList->pArray;
   568 
   569 		return true;
   570 	}
   571 	void DumpCache(List<maplist_info_t *> *compat_list)
   572 	{
   573 		m_ListLookup.clear();
   574 
   575 		List<maplist_info_t *>::iterator iter = m_MapLists.begin();
   576 		while (iter != m_MapLists.end())
   577 		{
   578 			if (compat_list != NULL && (*iter)->bIsCompat)
   579 			{
   580 				compat_list->push_back((*iter));
   581 			}
   582 			else
   583 			{
   584 				delete (*iter)->pArray;
   585 				delete (*iter);
   586 			}
   587 			iter = m_MapLists.erase(iter);
   588 		}
   589 	}
   590 private:
   591 	char m_ConfigFile[PLATFORM_MAX_PATH];
   592 	time_t m_ConfigLastChanged;
   593 	ConVar *m_pMapCycleFile;
   594 	NameHashSet<maplist_info_t *> m_ListLookup;
   595 	List<maplist_info_t *> m_MapLists;
   596 	MapListState m_CurState;
   597 	unsigned int m_IgnoreLevel;
   598 	maplist_info_t *m_pCurMapList;
   599 	int m_nSerialChange;
   600 } s_MapLists;
   601 
   602 static cell_t LoadMapList(IPluginContext *pContext, const cell_t *params)
   603 {
   604 	char *str;
   605 	Handle_t hndl;
   606 	cell_t *addr, flags;
   607 	CellArray *pArray, *pNewArray;
   608 
   609 	hndl = params[1];
   610 	pContext->LocalToPhysAddr(params[2], &addr);
   611 	pContext->LocalToString(params[3], &str);
   612 	flags = params[4];
   613 
   614 	/* Make sure the input Handle is valid */
   615 	pArray = NULL;
   616 	if (hndl != BAD_HANDLE)
   617 	{
   618 		HandleError err;
   619 		HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
   620 
   621 		if ((err = handlesys->ReadHandle(hndl, htCellArray, &sec, (void **)&pArray))
   622 			!= HandleError_None)
   623 		{
   624 			return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
   625 		}
   626 	}
   627 
   628 	/* Make sure the map list cache is up to date at the root */
   629 	s_MapLists.UpdateCache();
   630 
   631 	/* Try to get the map list. */
   632 	if ((pNewArray = s_MapLists.UpdateMapList(pArray, str, addr, flags)) == NULL)
   633 	{
   634 		return BAD_HANDLE;
   635 	}
   636 
   637 	/* If the user wanted a new array, create it now. */
   638 	if (hndl == BAD_HANDLE)
   639 	{
   640 		if ((hndl = handlesys->CreateHandle(htCellArray, pNewArray, pContext->GetIdentity(), g_pCoreIdent, NULL))
   641 			== BAD_HANDLE)
   642 		{
   643 			*addr = -1;
   644 			delete pNewArray;
   645 			return BAD_HANDLE;
   646 		}
   647 	}
   648 
   649 	return hndl;
   650 }
   651 
   652 static cell_t SetMapListCompatBind(IPluginContext *pContext, const cell_t *params)
   653 {
   654 	char *name, *file;
   655 
   656 	pContext->LocalToString(params[1], &name);
   657 	pContext->LocalToString(params[2], &file);
   658 
   659 	s_MapLists.UpdateCache();
   660 	s_MapLists.AddOrUpdateDefault(name, file);
   661 
   662 	return 1;
   663 }
   664 
   665 REGISTER_NATIVES(mapListNatives)
   666 {
   667 	{"ReadMapList",				LoadMapList},
   668 	{"SetMapListCompatBind",	SetMapListCompatBind},
   669 	{NULL,						NULL},
   670 };