Quellcode durchsuchen

Exposed active song count

Plugins can use the active song count to limit the number of songs they
put in the queue.
nosoop vor 10 Jahren
Ursprung
Commit
3ccd46e25d
2 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen
  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;
 }