remove trailing whitespaces from sourcecode

This commit is contained in:
2016-02-06 00:47:47 +01:00
parent 6f9558373d
commit d88e748f0e
85 changed files with 3559 additions and 3559 deletions

View File

@ -27,18 +27,18 @@
/**
* Application Programming Interface (API)
*
*
* To allow other plugins or extensions to interact directly with Zombie:Reloaded we need to implement
* an API. SourceMod allows us to do this by creating global "natives" or "forwards."
*
*
* Natives are basically functions that can be called from any plugin that includes its definition.
* Forwards are functions that are called on a given event. (Such as OnClientPutInServer)
* ZR's API files are located in sourcemod/scripting/include/zr/category.zr.inc. We chose to create multiple
* files simply for organization. Including zr.inc will automatically include the rest of the files as well.
*
*
* To better understand how natives and forwards are created, go here:
* http://wiki.alliedmods.net/Creating_Natives_(SourceMod_Scripting)
* http://wiki.alliedmods.net/Function_Calling_API_(SourceMod_Scripting)
* http://wiki.alliedmods.net/Function_Calling_API_(SourceMod_Scripting)
*/
#include "zr/api/infect.api"
@ -58,10 +58,10 @@ APIInit()
/**
* Validates a client index and when it fails, an error is thrown.
*
*
* @param client The client index to validate.
* @param alive Set to true to validate that the client is alive, false to ignore.
*
*
* @error Throws an error when the client isn't valid.
*/
stock APIValidateClientIndex(client, EligibleCondition:alive = Condition_Either)
@ -72,14 +72,14 @@ stock APIValidateClientIndex(client, EligibleCondition:alive = Condition_Either)
ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index. (%d)", client);
return;
}
// Verify that the client is connected.
if (!IsClientConnected(client))
{
ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected.", client);
return;
}
// Check if the player must be dead or alive.
new bool:bAlive = bool:alive;
if (alive != Condition_Either)

View File

@ -31,7 +31,7 @@
APIClassInit()
{
// Class module natives/forwards (class.zr.inc)
// Natives
CreateNative("ZR_IsValidClassIndex", APIIsValidClassIndex);
CreateNative("ZR_GetActiveClass", APIGetActiveClass);
@ -50,7 +50,7 @@ APIClassInit()
public APIIsValidClassIndex(Handle:plugin, numParams)
{
new classIndex = GetNativeCell(1);
return ClassValidateIndex(classIndex);
}
@ -62,10 +62,10 @@ public APIIsValidClassIndex(Handle:plugin, numParams)
public APIGetActiveClass(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate the client index. Player must be alive.
APIValidateClientIndex(client, Condition_True);
return ClassGetActiveIndex(client);
}
@ -77,10 +77,10 @@ public APIGetActiveClass(Handle:plugin, numParams)
public APIGetHumanClass(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate the client index. Player must be alive.
APIValidateClientIndex(client, Condition_True);
return ClassSelected[client][ZR_CLASS_TEAM_HUMANS];
}
@ -92,10 +92,10 @@ public APIGetHumanClass(Handle:plugin, numParams)
public APIGetZombieClass(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate the client index. Player must be alive.
APIValidateClientIndex(client, Condition_True);
return ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES];
}
@ -110,17 +110,17 @@ public APISelectClientClass(Handle:plugin, numParams)
new classIndex = GetNativeCell(2);
new bool:applyIfPossible = bool:GetNativeCell(3);
new bool:saveIfEnabled = bool:GetNativeCell(4);
// Validate the client index.
APIValidateClientIndex(client, Condition_Either);
// Validate class index.
if (!ClassValidateIndex(classIndex))
{
ThrowNativeError(SP_ERROR_NATIVE, "Invalid class index. (%d)", classIndex);
return -1;
}
return _:ClassSelectClientClass(client, classIndex, applyIfPossible, saveIfEnabled);
}
@ -133,21 +133,21 @@ public APIGetClassByName(Handle:plugin, numParams)
{
decl String:className[64];
className[0] = 0;
// Get class name.
if (GetNativeString(1, className, sizeof(className)) != SP_ERROR_NONE)
{
ThrowNativeError(SP_ERROR_NATIVE, "Unexpected error when reading className parameter. Possibly corrupt or missing data.");
return -1;
}
new cacheType = GetNativeCell(2);
if (cacheType == ZR_CLASS_CACHE_PLAYER)
{
ThrowNativeError(SP_ERROR_NATIVE, "Invalid cache type. Player cache is not allowed in this function.");
return -1;
}
return ClassGetIndex(className, cacheType);
}
@ -161,13 +161,13 @@ public APIGetClassDisplayName(Handle:plugin, numParams)
new index = GetNativeCell(1);
new maxlen = GetNativeCell(3);
new cacheType = GetNativeCell(4);
if (maxlen <= 0)
{
// No buffer size.
return 0;
}
// Validate index.
if (cacheType == ZR_CLASS_CACHE_PLAYER)
{
@ -183,17 +183,17 @@ public APIGetClassDisplayName(Handle:plugin, numParams)
return 0;
}
}
decl String:displayName[maxlen];
new bytes = ClassGetName(index, displayName, maxlen, cacheType);
if (bytes <= 0)
{
// The class doesn't have a name for some reason. Make sure the buffer is empty.
displayName[0] = 0;
}
SetNativeString(2, displayName, maxlen);
return bytes;
}

View File

@ -42,13 +42,13 @@ new Handle:g_hAPIFwdOnClientHumanPost = INVALID_HANDLE;
APIInfectInit()
{
// Infect module natives/forwards (infect.zr.inc)
// Natives
CreateNative("ZR_IsClientZombie", APIIsClientZombie);
CreateNative("ZR_IsClientHuman", APIIsClientHuman);
CreateNative("ZR_InfectClient", APIInfectClient);
CreateNative("ZR_HumanClient", APIHumanClient);
// Forwards
g_hAPIFwdOnClientInfect = CreateGlobalForward("ZR_OnClientInfect", ET_Hook, Param_CellByRef, Param_CellByRef, Param_CellByRef, Param_CellByRef, Param_CellByRef);
g_hAPIFwdOnClientInfected = CreateGlobalForward("ZR_OnClientInfected", ET_Ignore, Param_Cell, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
@ -63,33 +63,33 @@ APIInfectInit()
public APIIsClientZombie(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate the client index.
APIValidateClientIndex(client, Condition_True);
return InfectIsClientInfected(client);
}
/**
* Native call function (ZR_IsClientHuman)
* Returns true if the client is a human, false if not.
*
*
* bool:InfectIsClientHuman(client)
*/
public APIIsClientHuman(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate the client index.
APIValidateClientIndex(client, Condition_True);
return InfectIsClientHuman(client);
}
/**
* Native call function (ZR_InfectClient)
* Infects a client.
*
*
* native ZR_InfectClient(client, attacker = -1, bool:motherInfect = false, bool:respawnOverride = false, bool:respawn = false);
*/
public APIInfectClient(Handle:plugin, numParams)
@ -99,17 +99,17 @@ public APIInfectClient(Handle:plugin, numParams)
new bool:motherInfect = bool:GetNativeCell(3);
new bool:respawnOverride = bool:GetNativeCell(4);
new bool:respawn = bool:GetNativeCell(5);
// Validate the client index.
APIValidateClientIndex(client, Condition_True);
InfectHumanToZombie(client, attacker, motherInfect, respawnOverride, respawn);
}
/**
* Native call function (ZR_HumanClient)
* Turns a zombie back into a human.
*
*
* native ZR_HumanClient(client, bool:respawn = false, bool:protect = false);
*/
public APIHumanClient(Handle:plugin, numParams)
@ -117,36 +117,36 @@ public APIHumanClient(Handle:plugin, numParams)
new client = GetNativeCell(1);
new bool:respawn = bool:GetNativeCell(2);
new bool:protect = bool:GetNativeCell(2);
// Validate the client index.
APIValidateClientIndex(client, Condition_True);
InfectZombieToHuman(client, respawn, protect);
}
/**
* Called when a client is about to become a zombie.
*
*
* @param client The client to infect.
* @param attacker The attacker who did the infect.
* @param motherinfect Indicates a mother zombie infect.
* @param respawnoverride Set to true to override respawn cvar.
* @param respawn Value to override with.
*
*
* InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respawnoverride = false, bool:respawn = false)
*/
Action:APIOnClientInfect(&client, &attacker, &bool:motherinfect, &bool:respawnoverride, &bool:respawn)
{
// Start forward call.
Call_StartForward(g_hAPIFwdOnClientInfect);
// Push the parameters.
Call_PushCellRef(client);
Call_PushCellRef(attacker);
Call_PushCellRef(motherinfect);
Call_PushCellRef(respawnoverride);
Call_PushCellRef(respawn);
// Get what they returned.
new Action:result;
Call_Finish(result);
@ -155,50 +155,50 @@ Action:APIOnClientInfect(&client, &attacker, &bool:motherinfect, &bool:respawnov
/**
* Called after a client has become a zombie.
*
*
* @param client The client to infect.
* @param attacker The attacker who did the infect.
* @param motherinfect Indicates a mother zombie infect.
* @param respawnoverride Set to true to override respawn cvar.
* @param respawn Value to override with.
*
*
* InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respawnoverride = false, bool:respawn = false)
*/
APIOnClientInfected(client, attacker, bool:motherinfect, bool:respawnoverride, bool:respawn)
{
// Start forward call.
Call_StartForward(g_hAPIFwdOnClientInfected);
// Push the parameters.
Call_PushCell(client);
Call_PushCell(attacker);
Call_PushCell(motherinfect);
Call_PushCell(respawnoverride);
Call_PushCell(respawn);
// Finish the call.
Call_Finish();
}
/**
* Called when a client is about to become a human. (Through either zr_human or admin menu)
*
*
* @param client The client index.
* @param respawn True if the client was respawned, false if not.
* @param protect True if the client spawn protected, false if not.
*
*
* InfectZombieToHuman(client, bool:respawn = false, bool:protect = false)
*/
Action:APIOnClientHuman(&client, &bool:respawn, &bool:protect)
{
// Start forward call.
Call_StartForward(g_hAPIFwdOnClientHuman);
// Push the parameters.
Call_PushCellRef(client);
Call_PushCellRef(respawn);
Call_PushCellRef(protect);
// Get what they returned.
new Action:result;
Call_Finish(result);
@ -207,23 +207,23 @@ Action:APIOnClientHuman(&client, &bool:respawn, &bool:protect)
/**
* Called after a client has become a human. (Through either zr_human or admin menu)
*
*
* @param client The client index.
* @param respawn True if the client was respawned, false if not.
* @param protect True if the client spawn protected, false if not.
*
*
* InfectZombieToHuman(client, bool:respawn = false, bool:protect = false)
*/
APIOnClientHumanPost(client, bool:respawn, bool:protect)
{
// Start forward call.
Call_StartForward(g_hAPIFwdOnClientHumanPost);
// Push the parameters.
Call_PushCell(client);
Call_PushCell(respawn);
Call_PushCell(protect);
// Finish the call.
Call_Finish();
}

View File

@ -40,12 +40,12 @@ new Handle:g_hAPIFwdOnClientRespawned = INVALID_HANDLE;
APIRespawnInit()
{
// Respawn module natives/forwards (respawn.zr.inc)
// Natives
CreateNative("ZR_RespawnClient", APIRespawnClient);
CreateNative("ZR_SetKilledByWorld", APISetKilledByWorld);
CreateNative("ZR_GetKilledByWorld", APIGetKilledByWorld);
// Forwards
g_hAPIFwdOnClientRespawn = CreateGlobalForward("ZR_OnClientRespawn", ET_Hook, Param_CellByRef, Param_CellByRef);
g_hAPIFwdOnClientRespawned = CreateGlobalForward("ZR_OnClientRespawned", ET_Ignore, Param_Cell, Param_Cell);
@ -54,29 +54,29 @@ APIRespawnInit()
/**
* Native call function (ZR_RespawnClient)
* Spawns a player into the round following rules set by cvars.
*
*
* RespawnSpawnClient(client, bool:zombie = false, bool:zombie_if_suicide = false)
*/
public APIRespawnClient(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate index and that player isn't alive.
APIValidateClientIndex(client, Condition_False);
// Restore respawn condition.
new RespawnCondition:condition = RespawnCondition:GetNativeCell(2);
new bool:zombie;
new bool:zombieIfSuicide;
RespawnRestoreCondition(condition, zombie, zombieIfSuicide);
// Respawn the client.
RespawnSpawnClient(client, zombie, zombieIfSuicide);
}
/**
* Called right before ZR is about to respawn a player.
*
*
* @param client The client index.
* @param condition Respawn condition. See RespawnCondition for
* details.
@ -85,11 +85,11 @@ Action:APIOnClientRespawn(&client, &RespawnCondition:condition)
{
// Start forward call.
Call_StartForward(g_hAPIFwdOnClientRespawn);
// Push the parameters.
Call_PushCellRef(client);
Call_PushCellRef(condition);
// Get what they returned.
new Action:result;
Call_Finish(result);
@ -98,7 +98,7 @@ Action:APIOnClientRespawn(&client, &RespawnCondition:condition)
/**
* Called after a player was respawned.
*
*
* @param client The client index.
* @param condition Current condition of the respawned player. See
* RespawnCondition for details.
@ -107,11 +107,11 @@ Action:APIOnClientRespawned(client, RespawnCondition:condition)
{
// Start forward call.
Call_StartForward(g_hAPIFwdOnClientRespawned);
// Push the parameters.
Call_PushCell(client);
Call_PushCell(condition);
// Finish the call.
Call_Finish();
}
@ -123,12 +123,12 @@ Action:APIOnClientRespawned(client, RespawnCondition:condition)
public APISetKilledByWorld(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate the client index.
APIValidateClientIndex(client, Condition_Either);
new bool:suicide = bool:GetNativeCell(2);
// Override the old value.
bKilledByWorld[client] = suicide;
}
@ -140,10 +140,10 @@ public APISetKilledByWorld(Handle:plugin, numParams)
public APIGetKilledByWorld(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
// Validate the client index.
APIValidateClientIndex(client, Condition_Either);
// Return the value.
return _:bKilledByWorld[client];
}