Better compatibility with output info plugins

Fixed spelling mistake
Commented out native errors
This commit is contained in:
KiD Fearless 2019-07-09 19:35:32 -06:00
parent 8cf826af69
commit c79876d57e
2 changed files with 44 additions and 25 deletions

View File

@ -428,12 +428,12 @@ public any Native_GetDumpStringMap(Handle plugin, int numParams)
{ {
if(!gB_Ready) if(!gB_Ready)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Native called before dump file has been processed."); //LogError("Native called before dump file has been processed.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1) if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Entity lists are empty."); //LogError("Entity lists are empty.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
@ -445,12 +445,12 @@ public any Native_GetDumpEntityAsList(Handle plugin, int numParams)
{ {
if(!gB_Ready) if(!gB_Ready)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Native called before dump file has been processed."); //LogError("Native called before dump file has been processed.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1) if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Entity lists are empty."); //LogError("Entity lists are empty.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
@ -462,13 +462,13 @@ public any Native_GetDumpEntityAsList(Handle plugin, int numParams)
int position = -1; int position = -1;
if(!gSM_EntityList.GetValue(id, position)) if(!gSM_EntityList.GetValue(id, position))
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Could not find entity with that index."); //LogError("Could not find entity with with the index '%i', hammmerid '%i'.", index, hammer);
return INVALID_HANDLE; return INVALID_HANDLE;
} }
if(position >= gA_Entites.Length || position < 0) if(position >= gA_Entites.Length || position < 0)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "List position out of range"); //LogError( "List position out of range");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
@ -488,12 +488,12 @@ public any Native_GetDumpEntityFromID(Handle plugin, int numParams)
{ {
if(!gB_Ready) if(!gB_Ready)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Native called before dump file has been processed."); //LogError("Native called before dump file has been processed.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1) if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Entity lists are empty."); //LogError("Entity lists are empty.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
@ -504,13 +504,13 @@ public any Native_GetDumpEntityFromID(Handle plugin, int numParams)
int position = -1; int position = -1;
if(!gSM_EntityList.GetValue(id, position)) if(!gSM_EntityList.GetValue(id, position))
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Could not find entity with that index."); //LogError("Could not find entity with that index.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
if(position >= gA_Entites.Length || position < 0) if(position >= gA_Entites.Length || position < 0)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "List position out of range"); //LogError("List position out of range");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
@ -530,12 +530,12 @@ public any Native_GetDumpEntities(Handle plugin, int numParams)
{ {
if(!gB_Ready) if(!gB_Ready)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Native called before dump file has been processed."); //LogError("Native called before dump file has been processed.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }
if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1) if(gA_Entites.Length < 1 || gSM_EntityList.Size < 1)
{ {
ThrowNativeError(SP_ERROR_NATIVE, "Entity lists are empty."); //LogError("Entity lists are empty.");
return INVALID_HANDLE; return INVALID_HANDLE;
} }

View File

@ -169,14 +169,14 @@ native ArrayList GetDumpEntityAsList(int index);
stock bool GetDumpEntity(int index, Entity ent) stock bool GetDumpEntity(int index, Entity ent)
{ {
ArrayList temp = GetDumpEntityAsList(index); ArrayList temp = GetDumpEntityAsList(index);
if(temp != INVALID_HANDLE) if(temp != INVALID_HANDLE && temp != null)
{ {
temp.GetArray(0, ent); temp.GetArray(0, ent);
delete temp; delete temp;
return true; return true;
} }
delete temp; delete temp;
return false return false;
} }
/* * /* *
@ -201,7 +201,7 @@ native ArrayList GetDumpEntityFromID(int hammerid);
stock bool GetDumpEntity2(int hammerid, Entity ent) stock bool GetDumpEntity2(int hammerid, Entity ent)
{ {
ArrayList temp = GetDumpEntityFromID(hammerid); ArrayList temp = GetDumpEntityFromID(hammerid);
if(temp != INVALID_HANDLE) if(temp != INVALID_HANDLE && temp != null)
{ {
temp.GetArray(0, ent); temp.GetArray(0, ent);
delete temp; delete temp;
@ -253,7 +253,10 @@ native bool IsDumpReady();
stock int GetOutputCount(int index, const char[] output = "") stock int GetOutputCount(int index, const char[] output = "")
{ {
Entity ent; Entity ent;
GetDumpEntity(index, ent); if(!GetDumpEntity(index, ent))
{
return -1;
}
int count = 0; int count = 0;
if(output[0] == 0) if(output[0] == 0)
@ -272,7 +275,7 @@ stock int GetOutputCount(int index, const char[] output = "")
} }
} }
} }
ent.Cleanup(); ent.CleanUp();
return count; return count;
} }
@ -291,7 +294,11 @@ stock int GetOutputCount(int index, const char[] output = "")
stock bool GetOutputTarget(int index, const char[] output, int num, char[] target, int length = MEMBER_SIZE) stock bool GetOutputTarget(int index, const char[] output, int num, char[] target, int length = MEMBER_SIZE)
{ {
Entity ent; Entity ent;
GetDumpEntity(index, ent); if(!GetDumpEntity(index, ent))
{
return false;
}
int count = 0; int count = 0;
bool ret = false; bool ret = false;
@ -320,7 +327,7 @@ stock bool GetOutputTarget(int index, const char[] output, int num, char[] targe
} }
} }
ent.Cleanup(); ent.CleanUp();
return ret; return ret;
} }
@ -339,7 +346,11 @@ stock bool GetOutputTarget(int index, const char[] output, int num, char[] targe
stock bool GetOutputTargetInput(int index, const char[] output, int num, char[] input, int length = MEMBER_SIZE) stock bool GetOutputTargetInput(int index, const char[] output, int num, char[] input, int length = MEMBER_SIZE)
{ {
Entity ent; Entity ent;
GetDumpEntity(index, ent); if(!GetDumpEntity(index, ent))
{
return false;
}
int count = 0; int count = 0;
bool ret = false; bool ret = false;
char buffer[MEMBER_SIZE]; char buffer[MEMBER_SIZE];
@ -367,7 +378,7 @@ stock bool GetOutputTargetInput(int index, const char[] output, int num, char[]
} }
} }
ent.Cleanup(); ent.CleanUp();
return ret; return ret;
} }
@ -386,7 +397,11 @@ stock bool GetOutputTargetInput(int index, const char[] output, int num, char[]
stock bool GetOutputParameter(int index, const char[] output, int num, char[] parameters, int length = MEMBER_SIZE) stock bool GetOutputParameter(int index, const char[] output, int num, char[] parameters, int length = MEMBER_SIZE)
{ {
Entity ent; Entity ent;
GetDumpEntity(index, ent); if(!GetDumpEntity(index, ent))
{
return false;
}
int count = 0; int count = 0;
bool ret = false; bool ret = false;
char buffer[MEMBER_SIZE]; char buffer[MEMBER_SIZE];
@ -414,7 +429,7 @@ stock bool GetOutputParameter(int index, const char[] output, int num, char[] pa
} }
} }
ent.Cleanup(); ent.CleanUp();
return ret; return ret;
} }
@ -431,7 +446,11 @@ stock bool GetOutputParameter(int index, const char[] output, int num, char[] pa
stock float GetOutputDelay(int index, const char[] output, int num) stock float GetOutputDelay(int index, const char[] output, int num)
{ {
Entity ent; Entity ent;
GetDumpEntity(index, ent); if(!GetDumpEntity(index, ent))
{
return -1.0;
}
float delay = 0.0; float delay = 0.0;
int count = 0; int count = 0;
char buffer[MEMBER_SIZE]; char buffer[MEMBER_SIZE];
@ -458,7 +477,7 @@ stock float GetOutputDelay(int index, const char[] output, int num)
} }
} }
ent.Cleanup(); ent.CleanUp();
return delay; return delay;
} }