Mercurial > mm7
diff SpriteObject.cpp @ 810:f5156b8c61ad
savegame refactoring
author | Gloval |
---|---|
date | Tue, 26 Mar 2013 00:57:54 +0400 |
parents | d170f23f70d1 |
children | c232f160e6f3 bebc19f3d2af |
line wrap: on
line diff
--- a/SpriteObject.cpp Mon Mar 25 14:56:50 2013 +0200 +++ b/SpriteObject.cpp Tue Mar 26 00:57:54 2013 +0400 @@ -17,7 +17,7 @@ #include "mm7_data.h" size_t uNumSpriteObjects; -SpriteObject pSpriteObjects[1000]; +SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS]; //----- (00404828) -------------------------------------------------------- SpriteObject::SpriteObject() @@ -83,7 +83,7 @@ v21 = v6; } while ( (signed int)v7 < (signed int)((char *)&pObjectList->uNumObjects + 2) );*/ - for (uint i = 0; i < 1000; ++i) + for (uint i = 0; i < MAX_SPRITE_OBJECTS; ++i) if (!pSpriteObjects[i].uObjectDescID) { v6 = i; @@ -1100,3 +1100,17 @@ } } } + + +//----- (0042FA22) -------------------------------------------------------- +void CompactLayingItemsList() + { + int new_obj_pos=0; + + for (int i=0; i<MAX_SPRITE_OBJECTS; ++i) + { + if (pSpriteObjects[i].uObjectDescID) + memcpy(&pSpriteObjects[new_obj_pos++], &pSpriteObjects[i],sizeof(SpriteObject)); + } + uNumSpriteObjects = new_obj_pos; + } \ No newline at end of file