core/smn_core.cpp
changeset 2193 db7c6362f3f2
parent 2042 4a2faafca477
child 2289 44045ead61cd
     1.1 --- a/core/smn_core.cpp	Thu Jul 10 01:26:02 2008 +0000
     1.2 +++ b/core/smn_core.cpp	Fri Jul 11 08:18:43 2008 +0000
     1.3 @@ -130,7 +130,7 @@
     1.4  
     1.5  	g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
     1.6  
     1.7 -	if (pContext->GetContext()->n_err == SP_ERROR_NONE)
     1.8 +	if (pContext->GetLastNativeError() == SP_ERROR_NONE)
     1.9  	{
    1.10  		pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "%s", buffer);
    1.11  	}
    1.12 @@ -387,7 +387,7 @@
    1.13  		char buffer[2048];
    1.14  
    1.15  		g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 1);
    1.16 -		if (pContext->GetContext()->n_err != SP_ERROR_NONE)
    1.17 +		if (pContext->GetLastNativeError() != SP_ERROR_NONE)
    1.18  		{
    1.19  			pPlugin->SetErrorState(Plugin_Error, "%s", str);
    1.20  			return pContext->ThrowNativeErrorEx(SP_ERROR_ABORTED, "Formatting error (%s)", str);
    1.21 @@ -455,7 +455,7 @@
    1.22  {
    1.23  	char *name;
    1.24  	uint32_t idx;
    1.25 -	sp_context_t *ctx = pContext->GetContext();
    1.26 +	sp_native_t *native;
    1.27  
    1.28  	pContext->LocalToString(params[1], &name);
    1.29  	if (pContext->FindNativeByName(name, &idx) != SP_ERROR_NONE)
    1.30 @@ -464,7 +464,9 @@
    1.31  		return 0;
    1.32  	}
    1.33  
    1.34 -	ctx->natives[idx].flags |= SP_NTVFLAG_OPTIONAL;
    1.35 +	pContext->GetNativeByIndex(idx, &native);
    1.36 +
    1.37 +	native->flags |= SP_NTVFLAG_OPTIONAL;
    1.38  
    1.39  	return 1;
    1.40  }
    1.41 @@ -505,7 +507,7 @@
    1.42  	g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
    1.43  	g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 3);
    1.44  
    1.45 -	if (pContext->GetContext()->n_err != SP_ERROR_NONE)
    1.46 +	if (pContext->GetLastNativeError() != SP_ERROR_NONE)
    1.47  	{
    1.48  		return 0;
    1.49  	}
    1.50 @@ -535,7 +537,7 @@
    1.51  	g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
    1.52  	g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
    1.53  
    1.54 -	if (pContext->GetContext()->n_err != SP_ERROR_NONE)
    1.55 +	if (pContext->GetLastNativeError() != SP_ERROR_NONE)
    1.56  	{
    1.57  		fclose(fp);
    1.58  		return 0;
    1.59 @@ -568,7 +570,7 @@
    1.60  	g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
    1.61  	g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
    1.62  
    1.63 -	if (pContext->GetContext()->n_err != SP_ERROR_NONE)
    1.64 +	if (pContext->GetLastNativeError() != SP_ERROR_NONE)
    1.65  	{
    1.66  		fclose(fp);
    1.67  		return 0;