mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
make the reset checkpoints button also trigger Shavit_OnDelete (#1138)
This commit is contained in:
parent
e344ea2d89
commit
b956ffb8aa
@ -107,9 +107,12 @@ forward Action Shavit_OnSave(int client, int index, bool overflow);
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param index Checkpoint that will be deleted.
|
||||
* @param cleared Whether the checkpoint is being deleted due to all the checkpoints being cleared/reset.
|
||||
The return value CANNOT be used to block deletion of these.
|
||||
*
|
||||
* @return Plugin_Continue to continue deletion, anything else to prevent.
|
||||
*/
|
||||
forward Action Shavit_OnDelete(int client, int index);
|
||||
forward Action Shavit_OnDelete(int client, int index, bool cleared);
|
||||
|
||||
/**
|
||||
* Called after the checkpoint menu has been made and before it's sent to the client.
|
||||
|
||||
@ -170,7 +170,7 @@ public void OnPluginStart()
|
||||
gH_Forwards_OnTeleportPre = CreateGlobalForward("Shavit_OnTeleportPre", ET_Event, Param_Cell, Param_Cell);
|
||||
gH_Forwards_OnCheckpointMenuMade = CreateGlobalForward("Shavit_OnCheckpointMenuMade", ET_Event, Param_Cell, Param_Cell, Param_Cell);
|
||||
gH_Forwards_OnCheckpointMenuSelect = CreateGlobalForward("Shavit_OnCheckpointMenuSelect", ET_Event, Param_Cell, Param_Cell, Param_String, Param_Cell, Param_Cell, Param_Cell);
|
||||
gH_Forwards_OnDelete = CreateGlobalForward("Shavit_OnDelete", ET_Event, Param_Cell, Param_Cell);
|
||||
gH_Forwards_OnDelete = CreateGlobalForward("Shavit_OnDelete", ET_Event, Param_Cell, Param_Cell, Param_Cell);
|
||||
gH_Forwards_OnCheckpointCacheSaved = CreateGlobalForward("Shavit_OnCheckpointCacheSaved", ET_Ignore, Param_Cell, Param_Array, Param_Cell, Param_Cell);
|
||||
gH_Forwards_OnCheckpointCacheLoaded = CreateGlobalForward("Shavit_OnCheckpointCacheLoaded", ET_Ignore, Param_Cell, Param_Array, Param_Cell);
|
||||
|
||||
@ -788,12 +788,21 @@ void DeleteCheckpointCache(cp_cache_t cache)
|
||||
delete cache.customdata;
|
||||
}
|
||||
|
||||
void DeleteCheckpointCacheList(ArrayList cps)
|
||||
void DeleteCheckpointCacheList(ArrayList cps, int client_for_callback=0)
|
||||
{
|
||||
if (cps != null)
|
||||
{
|
||||
for(int i = 0; i < cps.Length; i++)
|
||||
for (int i = cps.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (client_for_callback)
|
||||
{
|
||||
Call_StartForward(gH_Forwards_OnDelete);
|
||||
Call_PushCell(client_for_callback);
|
||||
Call_PushCell(i+1);
|
||||
Call_PushCell(true);
|
||||
Call_Finish();
|
||||
}
|
||||
|
||||
cp_cache_t cache;
|
||||
cps.GetArray(i, cache);
|
||||
DeleteCheckpointCache(cache);
|
||||
@ -805,8 +814,8 @@ void DeleteCheckpointCacheList(ArrayList cps)
|
||||
|
||||
void ResetCheckpoints(int client)
|
||||
{
|
||||
DeleteCheckpointCacheList(gA_Checkpoints[client]);
|
||||
gI_CurrentCheckpoint[client] = 0;
|
||||
DeleteCheckpointCacheList(gA_Checkpoints[client], client);
|
||||
}
|
||||
|
||||
bool ShouldReopenCheckpointMenu(int client)
|
||||
@ -1807,6 +1816,7 @@ bool DeleteCheckpoint(int client, int index, bool force=false)
|
||||
Call_StartForward(gH_Forwards_OnDelete);
|
||||
Call_PushCell(client);
|
||||
Call_PushCell(index);
|
||||
Call_PushCell(false);
|
||||
Call_Finish(result);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user