]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.c
renamed IN_Activate to VID_GrabMouse and made it a public function in
[xonotic/darkplaces.git] / zone.c
diff --git a/zone.c b/zone.c
index 32655d9ad143e38fa8e9d390d6f62dd2d4b8fcd4..e6a51f5be693aa7902819c1668d143a696e7c58b 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -431,6 +431,7 @@ void *Mem_ExpandableArray_AllocRecord(memexpandablearray_t *l)
                                {
                                        l->arrays[i].allocflags[j] = true;
                                        l->arrays[i].numflaggedrecords++;
+                                       memset(l->arrays[i].data + l->recordsize * j, 0, l->recordsize);
                                        return (void *)(l->arrays[i].data + l->recordsize * j);
                                }
                        }
@@ -460,14 +461,19 @@ void Mem_ExpandableArray_FreeRecord(memexpandablearray_t *l, void *record)
 
 size_t Mem_ExpandableArray_IndexRange(memexpandablearray_t *l)
 {
-       size_t i, j, k;
-       if (!l->numarrays)
-               return 0;
-       i = l->numarrays - 1;
-       for (j = 0, k = 0;k < l->arrays[i].numflaggedrecords;j++)
-               if (l->arrays[i].allocflags[j])
-                       k++;
-       return l->numrecordsperarray * i + j;
+       size_t i, j, k, end = 0;
+       for (i = 0;i < l->numarrays;i++)
+       {
+               for (j = 0, k = 0;k < l->arrays[i].numflaggedrecords;j++)
+               {
+                       if (l->arrays[i].allocflags[j])
+                       {
+                               end = l->numrecordsperarray * i + j + 1;
+                               k++;
+                       }
+               }
+       }
+       return end;
 }
 
 void *Mem_ExpandableArray_RecordAtIndex(memexpandablearray_t *l, size_t index)
@@ -558,6 +564,16 @@ void MemStats_f(void)
 }
 
 
+char* Mem_strdup (mempool_t *pool, const char* s)
+{
+       char* p;
+       size_t sz = strlen (s) + 1;
+       if (s == NULL) return NULL;
+       p = (char*)Mem_Alloc (pool, sz);
+       strlcpy (p, s, sz);
+       return p;
+}
+
 /*
 ========================
 Memory_Init