Skip to content

Commit

Permalink
Fix compilation with SourcePawn 1.12
Browse files Browse the repository at this point in the history
Cannot pass an array of enum structs to `SortCustom2D` anymore.
  • Loading branch information
peace-maker committed Dec 17, 2024
1 parent 474c323 commit 2a8d0ab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.smx
build/
package/
10 changes: 4 additions & 6 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ fi

# setup the auto version file to have the git revision in the version convar.
# get the correct revision count
# https://github.com/travis-ci/travis-ci/issues/3412
git fetch --unshallow
GITREVCOUNT=$(git rev-list --count HEAD)

echo -e "#if defined _smrpg_version_included\n#endinput\n#endif\n#define _smrpg_version_included\n\n" > build/addons/sourcemod/scripting/include/smrpg/smrpg_autoversion.inc
Expand Down Expand Up @@ -74,16 +72,16 @@ do
if [ "$f" != "smrpg_chattags.sp" ]; then
echo -e "\nCompiling $f..."
smxfile="`echo $f | sed -e 's/\.sp$/\.smx/'`"
./spcomp $f -o$PACKAGEDIR/plugins/$smxfile -E
./spcomp $f -o$PACKAGEDIR/plugins/$smxfile
fi
done

# compile both versions of chattags for both chat processors..
echo -e "\nCompiling smrpg_chattags.sp for Chat Processor..."
./spcomp smrpg_chattags.sp -o$PACKAGEDIR/plugins/smrpg_chattags_cp.smx -E
./spcomp smrpg_chattags.sp -o$PACKAGEDIR/plugins/smrpg_chattags_cp.smx

echo -e "\nCompiling smrpg_chattags.sp for Simple Chat Processor..."
./spcomp smrpg_chattags.sp -o$PACKAGEDIR/plugins/smrpg_chattags_scp.smx -E USE_SIMPLE_PROCESSOR=
./spcomp smrpg_chattags.sp -o$PACKAGEDIR/plugins/smrpg_chattags_scp.smx USE_SIMPLE_PROCESSOR=

# compile all upgrades
for f in upgrades/*.sp
Expand All @@ -92,7 +90,7 @@ do
if [ "$f" != "upgrades/smrpg_upgrade_example.sp" ]; then
echo -e "\nCompiling upgrade $f..."
smxfile="`echo $f | sed -e 's/\.sp$/\.smx/'`"
./spcomp $f -o$PACKAGEDIR/plugins/$smxfile -E
./spcomp $f -o$PACKAGEDIR/plugins/$smxfile
fi
done

Expand Down
7 changes: 6 additions & 1 deletion scripting/smrpg/smrpg_stats.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,12 @@ public void SQL_GetNext10(Database db, DBResultSet results, const char[] error,
nextCache[i].credits = GetClientCredits(iLocalPlayer);
}

SortCustom2D(nextCache, iCount, Sort2D_NextPlayers);
int nextCacheWorkaround[sizeof(nextCache)][sizeof(nextCache[])];
for (int i = 0; i < iCount; i++)
Array_Copy(nextCache[i], nextCacheWorkaround[i], sizeof(nextCache[]));
SortCustom2D(nextCacheWorkaround, iCount, Sort2D_NextPlayers);
for (int i = 0; i < iCount; i++)
Array_Copy(nextCacheWorkaround[i], nextCache[i], sizeof(nextCache[]));

// Save the next rank as reference if the list is reordered with current data below
int iLastRank = nextCache[0].rank;
Expand Down

0 comments on commit 2a8d0ab

Please sign in to comment.