فهرست منبع

Added MusicEntry.Equals, HasFilePath

Some convenience methods for checking path name equality.  Two
MusicEntry handles are equal if they refer to the same music path.
nosoop 10 سال پیش
والد
کامیت
bd17ac9f00
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      scripting/include/round_end_music.inc

+ 14 - 0
scripting/include/round_end_music.inc

@@ -39,6 +39,20 @@ methodmap MusicEntry < KeyValues {
 	public void GetSource(char[] buffer, int maxlen) {
 		this.GetString("source", buffer, maxlen);
 	}
+	
+	public bool HasFilePath(const char[] filePath) {
+		char thisFilePath[PLATFORM_MAX_PATH];
+		this.GetFilePath(thisFilePath, sizeof(thisFilePath));
+		
+		return StrEqual(thisFilePath, filePath);
+	}
+	
+	public bool Equals(MusicEntry other) {
+		char otherFilePath[PLATFORM_MAX_PATH];
+		other.GetFilePath(otherFilePath, sizeof(otherFilePath));
+		
+		return this.HasFilePath(otherFilePath);
+	}
 }
 
 typedef OnSongsRequested = function void ();