Revision: 8974
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8974&view=rev
Author:   jpgr87
Date:     2010-11-22 18:20:31 +0000 (Mon, 22 Nov 2010)

Log Message:
-----------
Applied patch to dynamically resize map_points array if it fills up

Modified Paths:
--------------
    code/player/trunk/utils/pmap/lodo.cpp

Modified: code/player/trunk/utils/pmap/lodo.cpp
===================================================================
--- code/player/trunk/utils/pmap/lodo.cpp       2010-11-22 18:18:19 UTC (rev 
8973)
+++ code/player/trunk/utils/pmap/lodo.cpp       2010-11-22 18:20:31 UTC (rev 
8974)
@@ -387,6 +387,17 @@
     // Walk the line
     for (j = 0; j < step_count; j++)
     {
+      if (self->num_map_points == self->max_map_points) {
+        // resize the array
+        int new_size = self->max_map_points + 10 * self->num_ranges * 
self->max_map_scans;
+        lodo_map_point_t *tmp = new lodo_map_point_t[new_size];
+        memset(tmp,0,new_size*sizeof(tmp[0]));
+        
memcpy(tmp,self->map_points,self->max_map_points*sizeof(self->map_points[0]));
+        delete [] self->map_points;
+        self->map_points = tmp;
+        fprintf(stderr,"resized from %d to %d\n\n", self->max_map_points, 
new_size);
+        self->max_map_points = new_size;
+      }
       assert(self->num_map_points < self->max_map_points);
       free = self->map_points + self->num_map_points++;
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to