core/smn_lang.cpp
author David Anderson <dvander@alliedmods.net>
Fri Feb 16 04:16:31 2007 +0000 (2007-02-16)
changeset 502 4530ea065a8b
parent 396 c0af59ee9ca4
child 591 86e97f3eda1f
permissions -rw-r--r--
fixed a serious potential bug with swapping plugins to debug mode, leaving stale function pointers without plugin removal
     1 /**
     2  * ===============================================================
     3  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     4  * ===============================================================
     5  *
     6  * This file is not open source and may not be copied without explicit
     7  * written permission of AlliedModders LLC.  This file may not be redistributed 
     8  * in whole or significant part.
     9  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
    10  *
    11  * Version: $Id$
    12  */
    13 
    14 #include "PluginSys.h"
    15 #include "CTranslator.h"
    16 
    17 static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
    18 {
    19 	char *filename;
    20 	unsigned int index;
    21 	CPlugin *pl = (CPlugin *)g_PluginSys.FindPluginByContext(pCtx->GetContext());
    22 
    23 	pCtx->LocalToString(params[1], &filename);
    24 
    25 	index = g_Translator.FindOrAddPhraseFile(filename);
    26 	pl->AddLangFile(index);
    27 
    28 	return 1;
    29 }
    30 
    31 REGISTER_NATIVES(langNativeS)
    32 {
    33 	{"LoadTranslations",			sm_LoadTranslations},
    34 	{NULL,							NULL},
    35 };