2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-28 14:37:57 +03:00

Add an important clarification to the native rg_create_entity comment about cannot use a hash table for an entity with mutable class name otherwise, it will cause a memory leak

This commit is contained in:
s1lentq 2023-09-03 09:13:44 +07:00
parent 2bceff94cf
commit 30c1964df1
2 changed files with 10 additions and 8 deletions

View File

@ -419,8 +419,9 @@ native rg_update_teamscores(const iCtsWins = 0, const iTsWins = 0, const bool:bA
* *
* @param classname Entity classname * @param classname Entity classname
* @param useHashTable Use this only for known game entities * @param useHashTable Use this only for known game entities
* * @note: Do not use this if you plan to change custom classname an entity after creation,
* @note: Do not use this if you use a custom classname * otherwise it will never be release from hash table even if an entity was destroyed,
* and that to lead table to inflate/memory leaks
* *
* @return Index of the created entity or 0 otherwise * @return Index of the created entity or 0 otherwise
*/ */

View File

@ -542,8 +542,9 @@ cell AMX_NATIVE_CALL rg_update_teamscores(AMX *amx, cell *params)
* *
* @param classname Entity classname * @param classname Entity classname
* @param useHashTable Use this only for known game entities * @param useHashTable Use this only for known game entities
* * @note: Do not use this if you plan to change custom classname an entity after creation,
* @note: Do not use this if you use a custom classname * otherwise it will never be release from hash table even if an entity was destroyed,
* and that to lead table to inflate/memory leaks
* *
* @return Index of the created entity or 0 otherwise * @return Index of the created entity or 0 otherwise
* *
@ -1259,7 +1260,7 @@ cell AMX_NATIVE_CALL rg_give_defusekit(AMX *amx, cell *params)
if (CSGameRules() != nullptr && !CSGameRules()->m_bMapHasBombTarget && !CSGameRules()->m_bMapHasBombZone) { if (CSGameRules() != nullptr && !CSGameRules()->m_bMapHasBombTarget && !CSGameRules()->m_bMapHasBombZone) {
return FALSE; return FALSE;
} }
if (pPlayer->m_iTeam != CT) { if (pPlayer->m_iTeam != CT) {
return FALSE; return FALSE;
} }
@ -2734,7 +2735,7 @@ cell AMX_NATIVE_CALL rh_drop_client(AMX *amx, cell *params)
* *
* @param output Buffer to copy the ip address * @param output Buffer to copy the ip address
* @param len Maximum buffer size * @param len Maximum buffer size
* *
* @noreturn * @noreturn
* *
* native rh_get_net_from(output[], len); * native rh_get_net_from(output[], len);
@ -2747,7 +2748,7 @@ cell AMX_NATIVE_CALL rh_get_net_from(AMX* amx, cell* params)
char *addr = NET_AdrToString(*g_RehldsData->GetNetFrom()); char *addr = NET_AdrToString(*g_RehldsData->GetNetFrom());
setAmxString(dest, addr, params[arg_maxlen]); setAmxString(dest, addr, params[arg_maxlen]);
return TRUE; return TRUE;
} }
@ -2772,7 +2773,7 @@ cell AMX_NATIVE_CALL rh_get_client_connect_time(AMX *amx, cell *params)
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]);
return FALSE; return FALSE;
} }
return (cell)(g_RehldsFuncs->GetRealTime() - pClient->netchan.connect_time); return (cell)(g_RehldsFuncs->GetRealTime() - pClient->netchan.connect_time);
} }