From 62325d11aa56851f02a73e8f5f93bb87a4d288ec Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 1 Jun 2016 04:50:28 +0600 Subject: [PATCH] get_member, get_member_game, get_entvar, get_movevar: Allow use of output of the Float-variable via the 3rd argument. --- reapi/src/natives/natives_members.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/reapi/src/natives/natives_members.cpp b/reapi/src/natives/natives_members.cpp index c7c79ea..da04d3b 100644 --- a/reapi/src/natives/natives_members.cpp +++ b/reapi/src/natives/natives_members.cpp @@ -51,7 +51,7 @@ cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params) cell* arg3 = getAmxAddr(amx, params[arg_3]); if (isTypeReturnable(member->type)) { - dest = nullptr; + dest = (member->type != MEMBER_FLOAT) ? nullptr : arg3; element = *arg3; } else { @@ -116,7 +116,7 @@ cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params) cell* arg3 = getAmxAddr(amx, params[arg_3]); if (isTypeReturnable(member->type)) { - dest = nullptr; + dest = (member->type != MEMBER_FLOAT) ? nullptr : arg3; element = *arg3; } else { @@ -194,7 +194,7 @@ cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params) cell* arg3 = getAmxAddr(amx, params[arg_3]); if (isTypeReturnable(member->type)) { - dest = nullptr; + dest = (member->type != MEMBER_FLOAT) ? nullptr : arg3; element = *arg3; } else { @@ -256,7 +256,7 @@ cell AMX_NATIVE_CALL get_movevar(AMX *amx, cell *params) element = *getAmxAddr(amx, params[arg_3]); } else { - dest = nullptr; + dest = (member->type != MEMBER_FLOAT) ? nullptr : getAmxAddr(amx, params[arg_3]); element = 0; } @@ -474,8 +474,13 @@ cell get_member(void* pdata, const member_t *member, size_t element, cell* dest) } case MEMBER_FLOAT: case MEMBER_INTEGER: - // native any:get_member(_index, any:_member, element); - return get_member(pdata, member->offset, element); + { + auto& ret = get_member(pdata, member->offset, element); + if (dest != nullptr) { + *dest = ret; + } + return ret; + } case MEMBER_SHORT: // native any:get_member(_index, any:_member, element); return get_member(pdata, member->offset, element);