core/vm/sp_vm_basecontext.cpp
changeset 1000 aefbd36eaf91
parent 938 8e95112b2501
child 1231 17badaf66ce4
     1.1 --- a/core/vm/sp_vm_basecontext.cpp	Fri Jun 22 04:35:27 2007 +0000
     1.2 +++ b/core/vm/sp_vm_basecontext.cpp	Fri Jun 22 14:59:26 2007 +0000
     1.3 @@ -83,6 +83,15 @@
     1.4  	} else {
     1.5  		m_pNullVec = NULL;
     1.6  	}
     1.7 +
     1.8 +	if (FindPubvarByName("NULL_STRING", &index) == SP_ERROR_NONE)
     1.9 +	{
    1.10 +		sp_pubvar_t *pubvar;
    1.11 +		GetPubvarByIndex(index, &pubvar);
    1.12 +		m_pNullString = pubvar->offs;
    1.13 +	} else {
    1.14 +		m_pNullString = NULL;
    1.15 +	}
    1.16  }
    1.17  
    1.18  void BaseContext::FlushFunctionCache()
    1.19 @@ -992,6 +1001,22 @@
    1.20  	return pFunc;
    1.21  }
    1.22  
    1.23 +int BaseContext::LocalToStringNULL(cell_t local_addr, char **addr)
    1.24 +{
    1.25 +	int err;
    1.26 +	if ((err = LocalToString(local_addr, addr)) != SP_ERROR_NONE)
    1.27 +	{
    1.28 +		return err;
    1.29 +	}
    1.30 +
    1.31 +	if ((cell_t *)*addr == m_pNullString)
    1.32 +	{
    1.33 +		*addr = NULL;
    1.34 +	}
    1.35 +
    1.36 +	return SP_ERROR_NONE;
    1.37 +}
    1.38 +
    1.39  #if defined SOURCEMOD_BUILD
    1.40  SourceMod::IdentityToken_t *BaseContext::GetIdentity()
    1.41  {