changeset 4:e0fc7863d024

Mask out bits from resFlags that should not be there after initialization.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 28 Sep 2012 03:45:02 +0300
parents 82fc316e70d0
children bf77857b8e62
files dmres.c dmres.h
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dmres.c	Fri Sep 28 02:24:40 2012 +0300
+++ b/dmres.c	Fri Sep 28 03:45:02 2012 +0300
@@ -783,7 +783,7 @@
         // Initialize resources from a PACK file
         for (node = dfResPackFile->entries; node != NULL; node = node->next)
         {
-            DMResource *res = dmres_new(node->filename, node->resFlags, node->size);
+            DMResource *res = dmres_new(node->filename, node->resFlags & DMF_MASK, node->size);
             if (res == NULL)
             {
                 dmError("Could not allocate memory for resource node '%s' [0x%08x], %d.\n",
@@ -878,7 +878,7 @@
 
     if (dfPreload != NULL)
     {
-        if (dfPreload->flags & DMF_PRELOAD)
+        if ((dfPreload->flags & DMF_PRELOAD) && (dfPreload->flags & DMF_LOADED) == 0)
         {
             (*loaded)++;
         }
--- a/dmres.h	Fri Sep 28 02:24:40 2012 +0300
+++ b/dmres.h	Fri Sep 28 03:45:02 2012 +0300
@@ -37,6 +37,7 @@
     DMF_PRELOAD     = 0x0001, // Preload this resource
     DMF_PERSIST     = 0x0002, // Persist loaded resource (only freed at shutdown/explicit prune)
     //DMF_STREAM      = 0x0004, // This resource is streamed
+    DMF_MASK        = 0x0fff,
 
     DMF_LOADED      = 0x1000, // Resource has been loaded
 };