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