mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Documented the shared miscellaneous code and made minor fixes.
This commit is contained in:
parent
6f3579192a
commit
dec4033208
@ -583,8 +583,8 @@ bool IsModelWeapon(SQInt32 id)
|
||||
case 291:
|
||||
case 292:
|
||||
case 293:
|
||||
case 294: return SQTrue;
|
||||
default: return SQFalse;
|
||||
case 294: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,14 +623,14 @@ bool IsModelActuallyWeapon(SQInt32 id)
|
||||
case 288:
|
||||
case 289:
|
||||
case 290:
|
||||
case 291: return SQTrue;
|
||||
default: return SQFalse;
|
||||
case 291: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsModelValid(SQInt32 id)
|
||||
{
|
||||
return (strcmp(GetModelName(id), _SC("")) != 0) ? SQTrue : SQFalse;
|
||||
return (strcmp(GetModelName(id), _SC("")) != 0) ? true : false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1431,7 +1431,7 @@ SQInt32 GetSkinID(const SQChar * name)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool IsSkinValid(SQInt32 id)
|
||||
{
|
||||
return (strcmp(GetSkinName(id), _SC("")) != 0) ? SQTrue : SQFalse;
|
||||
return (strcmp(GetSkinName(id), _SC("")) != 0) ? true : false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -2120,7 +2120,7 @@ SQInt32 GetAutomobileID(const SQChar * name)
|
||||
|
||||
bool IsAutomobileValid(SQInt32 id)
|
||||
{
|
||||
return (strcmp(GetAutomobileName(id), _SC("")) != 0) ? SQTrue : SQFalse;
|
||||
return (strcmp(GetAutomobileName(id), _SC("")) != 0) ? true : false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -2376,7 +2376,7 @@ SQInt32 GetWeaponID(const SQChar * name)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool IsWeaponValid(SQInt32 id)
|
||||
{
|
||||
return (strcmp(GetWeaponName(id), _SC("")) != 0) ? SQTrue : SQFalse;
|
||||
return (strcmp(GetWeaponName(id), _SC("")) != 0) ? true : false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -2389,8 +2389,8 @@ bool IsWeaponNatural(SQInt32 id)
|
||||
case SQMOD_WEAPON_DROWNED:
|
||||
case SQMOD_WEAPON_FALL:
|
||||
case SQMOD_WEAPON_EXPLOSION2:
|
||||
case SQMOD_WEAPON_SUICIDE: return SQTrue;
|
||||
default: return SQFalse;
|
||||
case SQMOD_WEAPON_SUICIDE: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,35 +11,91 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attempt to convert the specified key code to a name.
|
||||
*/
|
||||
const SQChar * GetKeyCodeName(SQInteger keycode);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attemp to convert the specified model identifier to a name.
|
||||
*/
|
||||
const SQChar * GetModelName(SQInt32 id);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* See whether the specified model identifier points to model that is used to represent weapons.
|
||||
*/
|
||||
bool IsModelWeapon(SQInt32 id);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* See whether the specified model identifier points to model that is used to represent
|
||||
* an actual weapon.
|
||||
*/
|
||||
bool IsModelActuallyWeapon(SQInt32 id);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* See whether the specified model identifier is valid.
|
||||
*/
|
||||
bool IsModelValid(SQInt32 id);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attemp to convert the specified player skin identifier to a name.
|
||||
*/
|
||||
const SQChar * GetSkinName(SQInt32 id);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attempt to convert the specified player skin name to an identifier.
|
||||
*/
|
||||
SQInt32 GetSkinID(const SQChar * name);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* See whether the specified player skin identifier is valid.
|
||||
*/
|
||||
bool IsSkinValid(SQInt32 id);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attemp to convert the specified vehicle model identifier to a name.
|
||||
*/
|
||||
const SQChar * GetAutomobileName(SQInt32 id);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attempt to convert the specified vehicle model name to an identifier.
|
||||
*/
|
||||
SQInt32 GetAutomobileID(const SQChar * name);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* See whether the specified vehicle model identifier is valid.
|
||||
*/
|
||||
bool IsAutomobileValid(SQInt32 id);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attemp to convert the specified weapon identifier to a name.
|
||||
*/
|
||||
const SQChar * GetWeaponName(SQInt32 id);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attempt to convert the specified weapon name to an identifier.
|
||||
*/
|
||||
SQInt32 GetWeaponID(const SQChar * name);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* See whether the specified weapon identifier is valid.
|
||||
*/
|
||||
bool IsWeaponValid(SQInt32 id);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* See whether the specified weapon identifier points to a weapon that may not be used by
|
||||
* another player to perform a kill. Such as a player fall, drown, explosion etc.
|
||||
*/
|
||||
bool IsWeaponNatural(SQInt32 id);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Attempt to convert the weapon identifier to it's corresponding model identifier.
|
||||
*/
|
||||
SQInt32 WeaponToModel(SQInt32 id);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Helper class used to associate a tag and arbitrary data to an identifier.
|
||||
*/
|
||||
template < class T, unsigned N > class IdentifierStorage
|
||||
{
|
||||
public:
|
||||
@ -57,7 +113,7 @@ protected:
|
||||
protected:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
* Retrieve the global tag.
|
||||
*/
|
||||
static const SQChar * GlobalTag(SQUint32 id) noexcept
|
||||
{
|
||||
@ -65,11 +121,12 @@ protected:
|
||||
{
|
||||
return s_Globals[id].first.c_str();
|
||||
}
|
||||
|
||||
return _SC("");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
* Change the global tag.
|
||||
*/
|
||||
static void GlobalTag(SQUint32 id, const SQChar * tag) noexcept
|
||||
{
|
||||
@ -84,7 +141,7 @@ protected:
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
* Retrieve the global data.
|
||||
*/
|
||||
static SqObj & GlobalData(SQUint32 id) noexcept
|
||||
{
|
||||
@ -96,7 +153,7 @@ protected:
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* ...
|
||||
* Change the global data.
|
||||
*/
|
||||
static void GlobalData(SQUint32 id, SqObj & data) noexcept
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user