mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 06:45:37 +03:00
Small bug fix and tiny optimizations in xs_get_maxmessages and xs_is_msg_valid
Added xs_vec_maked2d (at28754)
This commit is contained in:
parent
229b149247
commit
f10ecbb239
@ -604,6 +604,13 @@
|
|||||||
xs_vec_sub(tmp1, tmp2, out);
|
xs_vec_sub(tmp1, tmp2, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Turn a 3D vector into a 2D vector
|
||||||
|
XS_LIBFUNC_ATTRIB xs_vec_make2d(const Float:vec[3], Float:out[2])
|
||||||
|
{
|
||||||
|
out[0] = vec[0];
|
||||||
|
out[1] = vec[1];
|
||||||
|
}
|
||||||
|
|
||||||
// *** planes
|
// *** planes
|
||||||
|
|
||||||
// normal
|
// normal
|
||||||
@ -1017,20 +1024,20 @@
|
|||||||
// Returns max number of messages for mod
|
// Returns max number of messages for mod
|
||||||
XS_LIBFUNC_ATTRIB xs_get_maxmessages()
|
XS_LIBFUNC_ATTRIB xs_get_maxmessages()
|
||||||
{
|
{
|
||||||
new name[32];
|
new name[2];
|
||||||
|
|
||||||
for (new i = XS__MAX_ENGINE_MESSAGES + 1; i <= XS__MAX_POSSIBLE_MESSAGES; i++)
|
for (new i = XS__MAX_ENGINE_MESSAGES + 1; i <= XS__MAX_POSSIBLE_MESSAGES; i++)
|
||||||
if (!get_user_msgname(i, name, 31))
|
if (!get_user_msgname(i, name, 1))
|
||||||
return i - 1;
|
return i - 1;
|
||||||
|
|
||||||
return XS__MAX_ENGINE_MESSAGES;
|
return XS__MAX_POSSIBLE_MESSAGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if msgid is a valid message
|
// Returns true if msgid is a valid message
|
||||||
XS_LIBFUNC_ATTRIB bool:xs_is_msg_valid(msgid)
|
XS_LIBFUNC_ATTRIB bool:xs_is_msg_valid(msgid)
|
||||||
{
|
{
|
||||||
new name[32];
|
new name[2];
|
||||||
new retval = get_user_msgname(msgid, name, 31);
|
new retval = get_user_msgname(msgid, name, 1);
|
||||||
|
|
||||||
if (msgid < 1 || (msgid > XS__MAX_ENGINE_MESSAGES && !retval))
|
if (msgid < 1 || (msgid > XS__MAX_ENGINE_MESSAGES && !retval))
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user