Skip to content

Commit

Permalink
Fix GiveC4 hook callback return type
Browse files Browse the repository at this point in the history
  • Loading branch information
dystopm committed Nov 26, 2023
1 parent 4c1932c commit 8e7ba2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,7 @@ enum GamedllFunc_CSGameRules

/*
* Description: -
* Return type: CBasePlayer * (Entity index of player)
* Params: ()
*/
RG_CSGameRules_GiveC4,
Expand Down
6 changes: 3 additions & 3 deletions reapi/src/hook_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,14 +972,14 @@ void CSGameRules_RemoveGuns(IReGameHook_CSGameRules_RemoveGuns *chain)
callVoidForward(RG_CSGameRules_RemoveGuns, original);
}

void CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain)
CBasePlayer *CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain)
{
auto original = [chain]()
{
chain->callNext();
return indexOfPDataAmx(chain->callNext());
};

callVoidForward(RG_CSGameRules_GiveC4, original);
return getPrivate<CBasePlayer>(callForward<size_t>(RG_CSGameRules_GiveC4, original));
}

void CSGameRules_ChangeLevel(IReGameHook_CSGameRules_ChangeLevel *chain)
Expand Down
2 changes: 1 addition & 1 deletion reapi/src/hook_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ void CSGameRules_CleanUpMap(IReGameHook_CSGameRules_CleanUpMap *chain);
void CSGameRules_RestartRound(IReGameHook_CSGameRules_RestartRound *chain);
void CSGameRules_CheckWinConditions(IReGameHook_CSGameRules_CheckWinConditions *chain);
void CSGameRules_RemoveGuns(IReGameHook_CSGameRules_RemoveGuns *chain);
void CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain);
CBasePlayer *CSGameRules_GiveC4(IReGameHook_CSGameRules_GiveC4 *chain);
void CSGameRules_ChangeLevel(IReGameHook_CSGameRules_ChangeLevel *chain);
void CSGameRules_GoToIntermission(IReGameHook_CSGameRules_GoToIntermission *chain);
void CSGameRules_BalanceTeams(IReGameHook_CSGameRules_BalanceTeams *chain);
Expand Down

0 comments on commit 8e7ba2e

Please sign in to comment.