2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-01 09:35:47 +03:00

Added reapi_version.inc and other typos

This commit is contained in:
s1lentq 2016-05-03 19:11:45 +06:00
parent e64210dee7
commit c1c59ce26c
15 changed files with 48 additions and 37 deletions

View File

@ -31,6 +31,10 @@ task publishPrepareFiles << {
from 'reapi/extra' from 'reapi/extra'
into 'publish/publishRoot/reapi/addons' into 'publish/publishRoot/reapi/addons'
} }
copy {
from 'reapi/src/reapi_version.inc'
into 'publish/publishRoot/reapi/addons/amxmodx/scripting/include'
}
} }
task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') { task publishPackage(type: Zip, dependsOn: 'publishPrepareFiles') {

View File

@ -13,16 +13,12 @@
#pragma library reapi #pragma library reapi
#endif #endif
// reapi version
#define REAPI_VERSION_MAJOR 1
#define REAPI_VERSION_MINOR 0
#define NULLENT -1 #define NULLENT -1
#include <reapi_const.inc>
#include <reapi_engine.inc> // NOTE: only for ReHLDS #include <reapi_engine.inc> // NOTE: only for ReHLDS
#include <reapi_gamedll.inc> // NOTE: only for gamedll Counter-Strike (ReGameDLL_CS) #include <reapi_gamedll.inc> // NOTE: only for gamedll Counter-Strike (ReGameDLL_CS)
#include <reapi_addons.inc> // NOTE: 3-rd party addons #include <reapi_addons.inc> // NOTE: 3-rd party addons
#include <reapi_version.inc>
// hookchain return type // hookchain return type
enum enum

View File

@ -26,7 +26,7 @@ enum client_auth_type
* @return 1 if client is speaking, 0 otherwise * @return 1 if client is speaking, 0 otherwise
* *
*/ */
native VTC_IsClientSpeaking(index); native VTC_IsClientSpeaking(const index);
/* /*
* Mutes this player * Mutes this player
@ -34,7 +34,7 @@ native VTC_IsClientSpeaking(index);
* @param index Client index * @param index Client index
* @noreturn * @noreturn
*/ */
native VTC_MuteClient(index); native VTC_MuteClient(const index);
/* /*
* Unmutes this player * Unmutes this player
@ -42,7 +42,7 @@ native VTC_MuteClient(index);
* @param index Client index * @param index Client index
* @noreturn * @noreturn
*/ */
native VTC_UnmuteClient(index); native VTC_UnmuteClient(const index);
/* /*
* Called when player started talking * Called when player started talking
@ -50,7 +50,7 @@ native VTC_UnmuteClient(index);
* @param index Client index * @param index Client index
* @noreturn * @noreturn
*/ */
forward VTC_OnClientStartSpeak(index); forward VTC_OnClientStartSpeak(const index);
/* /*
* Called when player stopped talking * Called when player stopped talking
@ -58,13 +58,13 @@ forward VTC_OnClientStartSpeak(index);
* @param index Client index * @param index Client index
* @noreturn * @noreturn
*/ */
forward VTC_OnClientStopSpeak(index); forward VTC_OnClientStopSpeak(const index);
/* /*
* Get client protocol * Get client protocol
* *
* @param index Client index * @param index Client index
* @noreturn * @return client protocol
*/ */
native REU_GetProtocol(const index); native REU_GetProtocol(const index);
@ -72,6 +72,6 @@ native REU_GetProtocol(const index);
* Get client auth type * Get client auth type
* *
* @param index Client index * @param index Client index
* @noreturn * @return client auth type
*/ */
native REU_GetAuthtype(const index); native client_auth_type:REU_GetAuthtype(const index);

View File

@ -173,7 +173,6 @@ enum GamedllFunc_CBasePlayer
*/ */
RG_CBasePlayer_ObjectCaps, RG_CBasePlayer_ObjectCaps,
/** /**
* Description: - * Description: -
* Return type: int * Return type: int

View File

@ -4,7 +4,7 @@
public plugin_init() public plugin_init()
{ {
register_plugin("ReAPI Test", "1.0", "s1lent"); register_plugin("ReAPI Test", "1.0", "s1lent");
RegisterHookChain(RH_CBasePlayer_GiveAmmo, "CBasePlayer_GiveAmmo"); RegisterHookChain(RG_CBasePlayer_GiveAmmo, "CBasePlayer_GiveAmmo");
} }
public CBasePlayer_GiveAmmo(const this, iAmount, szName[], iMax) public CBasePlayer_GiveAmmo(const this, iAmount, szName[], iMax)

View File

@ -268,7 +268,7 @@
<None Include="..\extra\amxmodx\scripting\include\reapi_gamedll_const.inc" /> <None Include="..\extra\amxmodx\scripting\include\reapi_gamedll_const.inc" />
<None Include="..\extra\amxmodx\scripting\include\reapi_addons.inc" /> <None Include="..\extra\amxmodx\scripting\include\reapi_addons.inc" />
<None Include="..\extra\amxmodx\scripting\reapi_test.sma" /> <None Include="..\extra\amxmodx\scripting\reapi_test.sma" />
<None Include="..\src\reapi_const.inc" /> <None Include="..\src\reapi_version.inc" />
<None Include="reapi.def" /> <None Include="reapi.def" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">

View File

@ -739,9 +739,6 @@
<None Include="..\extra\amxmodx\scripting\reapi_test.sma"> <None Include="..\extra\amxmodx\scripting\reapi_test.sma">
<Filter>amxmodx\scripting</Filter> <Filter>amxmodx\scripting</Filter>
</None> </None>
<None Include="..\src\reapi_const.inc">
<Filter>src</Filter>
</None>
<None Include="reapi.def" /> <None Include="reapi.def" />
<None Include="..\extra\amxmodx\scripting\include\reapi_gamedll.inc"> <None Include="..\extra\amxmodx\scripting\include\reapi_gamedll.inc">
<Filter>amxmodx\scripting\include</Filter> <Filter>amxmodx\scripting\include</Filter>
@ -758,6 +755,9 @@
<None Include="..\extra\amxmodx\scripting\include\reapi_addons.inc"> <None Include="..\extra\amxmodx\scripting\include\reapi_addons.inc">
<Filter>amxmodx\scripting\include</Filter> <Filter>amxmodx\scripting\include</Filter>
</None> </None>
<None Include="..\src\reapi_version.inc">
<Filter>src</Filter>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="reapi.rc" /> <ResourceCompile Include="reapi.rc" />

View File

@ -177,7 +177,7 @@ C_DLLEXPORT int AMXX_Detach()
C_DLLEXPORT int AMXX_PluginsLoaded() C_DLLEXPORT int AMXX_PluginsLoaded()
{ {
int iFwd = g_amxxapi.RegisterForward("__reapi_version_check", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE); int iFwd = g_amxxapi.RegisterForward("__reapi_version_check", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE);
g_amxxapi.ExecuteForward(iFwd, REAPI_VERISON_MAJOR, REAPI_VERISON_MINOR); g_amxxapi.ExecuteForward(iFwd, REAPI_VERSION_MAJOR, REAPI_VERSION_MINOR);
if (api_cfg.hasVTC()) { if (api_cfg.hasVTC()) {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
// reapi version // reapi version
#include "reapi_const.inc" #include "reapi_version.inc"
class CAPI_Config { class CAPI_Config {
public: public:

View File

@ -6,7 +6,7 @@
* @param index Client index * @param index Client index
* @return 1 if client is speaking, 0 otherwise * @return 1 if client is speaking, 0 otherwise
* *
* native VTC_IsClientSpeaking(index); * native VTC_IsClientSpeaking(const index);
*/ */
cell AMX_NATIVE_CALL VTC_IsClientSpeaking(AMX *amx, cell *params) cell AMX_NATIVE_CALL VTC_IsClientSpeaking(AMX *amx, cell *params)
{ {
@ -23,7 +23,7 @@ cell AMX_NATIVE_CALL VTC_IsClientSpeaking(AMX *amx, cell *params)
* @param index Client index * @param index Client index
* @noreturn * @noreturn
* *
* native VTC_MuteClient(index); * native VTC_MuteClient(const index);
*/ */
cell AMX_NATIVE_CALL VTC_MuteClient(AMX *amx, cell *params) cell AMX_NATIVE_CALL VTC_MuteClient(AMX *amx, cell *params)
{ {
@ -42,7 +42,7 @@ cell AMX_NATIVE_CALL VTC_MuteClient(AMX *amx, cell *params)
* @param index Client index * @param index Client index
* @noreturn * @noreturn
* *
* native VTC_UnmuteClient(index); * native VTC_UnmuteClient(const index);
*/ */
cell AMX_NATIVE_CALL VTC_UnmuteClient(AMX *amx, cell *params) cell AMX_NATIVE_CALL VTC_UnmuteClient(AMX *amx, cell *params)
{ {
@ -68,6 +68,7 @@ AMX_NATIVE_INFO Vtc_Natives[] =
* Get client protocol * Get client protocol
* *
* @param index Client index * @param index Client index
* @return client protocol
* *
* native REU_GetProtocol(const index); * native REU_GetProtocol(const index);
*/ */
@ -84,6 +85,7 @@ cell AMX_NATIVE_CALL REU_GetProtocol(AMX *amx, cell *params)
* Get client auth type * Get client auth type
* *
* @param index Client index * @param index Client index
* @return client auth type
* *
* native REU_GetAuthtype(const index); * native REU_GetAuthtype(const index);
*/ */

View File

@ -36,7 +36,13 @@ public:
{ {
if (m_value < 0) if (m_value < 0)
return nullptr; return nullptr;
return g_ReGameFuncs->UTIL_PlayerByIndex(m_value); return getPrivate<CBaseEntity>(m_value);
}
operator CBasePlayer*() const
{
if (m_value < 0)
return nullptr;
return static_cast<CBasePlayer *>(g_ReGameFuncs->UTIL_PlayerByIndex(m_value));
} }
operator PLAYER_ANIM() const operator PLAYER_ANIM() const
{ {

View File

@ -1,8 +0,0 @@
#if defined _reapi_const_included
#endinput
#endif
#define _reapi_const_included
// reapi version
#define REAPI_VERISON_MAJOR 1
#define REAPI_VERISON_MINOR 0

View File

@ -27,7 +27,11 @@ inline edict_t* edictByIndex(size_t index)
template<typename T> template<typename T>
T* getPrivate(int index) T* getPrivate(int index)
{ {
return (T *)edictByIndex(index)->pvPrivateData; edict_t* pent = edictByIndex(index);
if (pent)
return (T *)pent->pvPrivateData;
return nullptr;
} }
inline entvars_t* PEV(int index) inline entvars_t* PEV(int index)

View File

@ -0,0 +1,8 @@
#if defined _reapi_version_included
#endinput
#endif
#define _reapi_version_included
// reapi version
#define REAPI_VERSION_MAJOR 1
#define REAPI_VERSION_MINOR 0