Browse Source

Exposed active song count

Plugins can use the active song count to limit the number of songs they
put in the queue.
nosoop 8 years ago
parent
commit
3ccd46e25d
2 changed files with 9 additions and 2 deletions
  1. 3 1
      scripting/include/round_end_music.inc
  2. 6 1
      scripting/round_end_music.sp

+ 3 - 1
scripting/include/round_end_music.inc

@@ -45,4 +45,6 @@ typedef OnSongsRequested = function void ();
 
 native void REM_RegisterSource(OnSongsRequested callback);
 
-native bool REM_AddSong(MusicEntry song);
+native bool REM_AddSong(MusicEntry song);
+
+native int REM_GetActiveSongCount();

+ 6 - 1
scripting/round_end_music.sp

@@ -12,7 +12,7 @@
 #pragma newdecls required
 #include <round_end_music>
 
-#define PLUGIN_VERSION "0.1.0"
+#define PLUGIN_VERSION "0.2.0"
 public Plugin myinfo = {
     name = "[CSRD] Round End Music",
     author = "nosoop",
@@ -242,6 +242,7 @@ public APLRes AskPluginLoad2(Handle self, bool late, char[] error, int err_max)
 	
 	CreateNative("REM_RegisterSource", Native_RegisterSource);
 	CreateNative("REM_AddSong", Native_AddSong);
+	CreateNative("REM_GetActiveSongCount", Native_GetActiveSongCount);
 }
 
 public int Native_RegisterSource(Handle hPlugin, int nArgs) {
@@ -291,4 +292,8 @@ public int Native_AddSong(Handle hPlugin, int nArgs) {
 		}
 	}
 	return false;
+}
+
+public int Native_GetActiveSongCount(Handle hPlugin, int nArgs) {
+	return g_nMaxActiveSongs;
 }