]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/CEngine.cpp
Allow music tags to be stored in the pak file.
[quix0rs-blobwars.git] / src / CEngine.cpp
index a5a75acd34702c8d312d2fa45762dc402e0d9e67..7017039722123c54f5df2ad448a3a2297b5b4282 100644 (file)
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 
 #include "headers.h"
+#include <errno.h>
 
 Engine::Engine()
 {
@@ -365,7 +366,7 @@ bool Engine::unpack(const char *filename, int fileType)
                }
        }
 
-       if ((fileType == PAK_MUSIC) || (fileType == PAK_FONT))
+       if ((fileType == PAK_MUSIC) || (fileType == PAK_FONT) || (fileType == PAK_TAGS))
        {
                char tempPath[PATH_MAX];
                
@@ -377,6 +378,12 @@ bool Engine::unpack(const char *filename, int fileType)
                        fp = fopen(tempPath, "wb");
                }
 
+               if (fileType == PAK_TAGS)
+               {
+                       snprintf(tempPath, sizeof tempPath, "%smusic.tags", userHomeDirectory);
+                       fp = fopen(tempPath, "wb");
+               }
+
                if (fileType == PAK_FONT)
                {
                        snprintf(tempPath, sizeof tempPath, "%sfont.ttf", userHomeDirectory);
@@ -385,6 +392,7 @@ bool Engine::unpack(const char *filename, int fileType)
 
                if (!fp)
                {
+                       printf("Fatal Error: could not open %s for writing: %s", tempPath, strerror(errno));
                        return false;
                }