Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
fixed some errors
Browse files Browse the repository at this point in the history
11 Warnings remaining - Array-based enums needs to be removed/changed
  • Loading branch information
Riccardo H authored and Riccardo H committed Jan 3, 2020
1 parent 42200fc commit 6754f79
Show file tree
Hide file tree
Showing 27 changed files with 1,267 additions and 1,379 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode/
.vs/
.idea/

addons/sourcemod/scripting/surftimer-api.sp
addons/sourcemod/scripting/surftimer-api.smx
Expand Down
37 changes: 18 additions & 19 deletions addons/sourcemod/scripting/include/smlib/arrays.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* @param start Optional: Offset where to start (0 - (size-1)).
* @return Array index, or -1 if the value couldn't be found.
*/
stock Array_FindValue(any:array[], size, any:value, start=0)
stock int Array_FindValue(const any[] array, int size, any value, int start=0)
{
if (start < 0) {
start = 0;
}

for (new i=start; i < size; i++) {
for (int i=start; i < size; i++) {

if (array[i] == value) {
return i;
Expand All @@ -41,13 +41,13 @@ stock Array_FindValue(any:array[], size, any:value, start=0)
* @param start Optional: Offset where to start(0 - (size-1)).
* @return Array index, or -1 if the value couldn't be found.
*/
stock Array_FindString(const String:array[][], size, const String:str[], bool:caseSensitive=true, start=0)
stock int Array_FindString(const char[][] array, int size, const char[] str, bool caseSensitive=true, int start=0)
{
if (start < 0) {
start = 0;
}

for (new i=start; i < size; i++) {
for (int i=start; i < size; i++) {

if (StrEqual(array[i], str, caseSensitive)) {
return i;
Expand All @@ -65,17 +65,17 @@ stock Array_FindString(const String:array[][], size, const String:str[], bool:ca
* @param start Optional: Offset where to start (0 - (size-1)).
* @return Array index.
*/
stock Array_FindLowestValue(any:array[], size, start=0)
stock int Array_FindLowestValue(const any[] array, int size, int start=0)
{
if (start < 0) {
start = 0;
}

new any:value = array[start];
new any:tempValue;
new x = start;
any value = array[start];
any tempValue;
int x = start;

for (new i=start; i < size; i++) {
for (int i=start; i < size; i++) {

tempValue = array[i];

Expand All @@ -97,17 +97,17 @@ stock Array_FindLowestValue(any:array[], size, start=0)
* @param start Optional: Offset where to start (0 - (size-1)).
* @return Array index.
*/
stock Array_FindHighestValue(any:array[], size, start=0)
stock int Array_FindHighestValue(const any[] array, int size, int start=0)
{
if (start < 0) {
start = 0;
}

new any:value = array[start];
new any:tempValue;
new x = start;
any value = array[start];
any tempValue;
int x = start;

for (new i=start; i < size; i++) {
for (int i=start; i < size; i++) {

tempValue = array[i];

Expand All @@ -129,15 +129,14 @@ stock Array_FindHighestValue(any:array[], size, start=0)
* @param size Number of cells to write (eg. the array's size)
* @param value Fill value.
* @param start Optional: Offset where to start (0 - (size-1)).
* @noreturn
*/
stock Array_Fill(any:array[], size, any:value, start=0)
stock void Array_Fill(any[] array, int size, any value, int start=0)
{
if (start < 0) {
start = 0;
}

for (new i=start; i < size; i++) {
for (int i=start; i < size; i++) {
array[i] = value;
}
}
Expand All @@ -150,9 +149,9 @@ stock Array_Fill(any:array[], size, any:value, start=0)
* @param size Size of the array (or number of cells to copy)
* @noreturn
*/
stock Array_Copy(const any:array[], any:newArray[], size)
stock void Array_Copy(const any[] array, any[] newArray, int size)
{
for (new i=0; i < size; i++) {
for (int i=0; i < size; i++) {
newArray[i] = array[i];
}
}
Loading

0 comments on commit 6754f79

Please sign in to comment.