From 83c82387e3a6e1198ff84744d64e05be6a0f65f1 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Thu, 26 Jul 2007 16:22:29 +0000 Subject: [PATCH] Changed ArrayGetCell() to return the cell value instead of byreferencing the value. --- amxmodx/datastructs.cpp | 5 +++-- plugins/include/cellarray.inc | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/amxmodx/datastructs.cpp b/amxmodx/datastructs.cpp index 934bd899..51f3a581 100644 --- a/amxmodx/datastructs.cpp +++ b/amxmodx/datastructs.cpp @@ -136,13 +136,14 @@ static cell AMX_NATIVE_CALL ArrayGetCell(AMX* amx, cell* params) return 0; } - if (vec->GetCell(params[2],get_amxaddr(amx, params[3]))!=1) + cell ret; + if (vec->GetCell(params[2],&ret)!=1) { LogError(amx, AMX_ERR_NATIVE, "Invalid cellvector handle provided (%d:%d:%d)", params[1], params[2], vec->Size()); return 0; } - return 1; + return ret; } // ArrayGetString(Array:which, item, any:output[], size); static cell AMX_NATIVE_CALL ArrayGetString(AMX* amx, cell* params) diff --git a/plugins/include/cellarray.inc b/plugins/include/cellarray.inc index 78a511e9..9909f3d1 100644 --- a/plugins/include/cellarray.inc +++ b/plugins/include/cellarray.inc @@ -19,14 +19,14 @@ * * @param cellsize How many cells each entry in the array is. * @param reserved How many blank entries are created immediately when the array is created. These entries are not valid to read from until called with ArraySet. - * @return Handle to the array. + * @return Handle to the array. */ native Array:ArrayCreate(cellsize=1, reserved=32); /** * Clears all entries from the array. * - * @param which The array to clear. + * @param which The array to clear. * @return 1 on success, 0 on failure. */ native ArrayClear(Array:which); @@ -34,7 +34,7 @@ native ArrayClear(Array:which); /** * Returns the number of elements in the array. * - * @param which The array to check. + * @param which The array to check. * @return How many elements are in the array. */ native ArraySize(Array:which); @@ -43,7 +43,7 @@ native ArraySize(Array:which); * Returns data within an array. * Make sure the output buffer matches the size the array was created with! * - * @param which The array to retrieve the item from. + * @param which The array to retrieve the item from. * @param item The item to retrieve (zero-based). * @param output The output buffer to write. */ @@ -53,11 +53,11 @@ native ArrayGetArray(Array:which, item, any:output[]); * Returns a single cell of data from an array. * Use this only with arrays that were created with a cellsize of 1! * - * @param which The array to retrieve the item from. + * @param which The array to retrieve the item from. * @param item The item to retrieve (zero-based). - * @param output The variable to store the value in. + * @return The value of the cell. */ -native ArrayGetCell(Array:which, item, &any:output); +native any:ArrayGetCell(Array:which, item); /** * Returns a string value from an array.