- Performance optimization for FBlockThingsIterator::Next(): Actors that

exist in only one block don't need to be added to the CheckArray or
  scanned for in it.


SVN r1532 (trunk)
This commit is contained in:
Randy Heit 2009-04-08 22:59:06 +00:00
parent 3dc01e77f7
commit a54367a3c0
2 changed files with 12 additions and 2 deletions

View file

@ -1,4 +1,9 @@
April 7, 2009 (Changes by Graf Zahl)
April 8, 2009
- Performance optimization for FBlockThingsIterator::Next(): Actors that
exist in only one block don't need to be added to the CheckArray or
scanned for in it.
April 7, 2009 (Changes by Graf Zahl)
- added some default definitions for constants that may miss in some headers.
- replaced __va_copy with va_copy per Chris's suggestion.
- replaced #include <malloc.h> with #include <stdlib.h> where possible.

View file

@ -830,15 +830,20 @@ void FBlockThingsIterator::StartBlock(int x, int y)
AActor *FBlockThingsIterator::Next()
{
while (true)
for (;;)
{
while (block != NULL)
{
AActor *me = block->Me;
FBlockNode *mynode = block;
int i;
block = block->NextActor;
// Don't recheck things that were already checked
if (mynode->NextBlock == NULL && mynode->PrevBlock == &me->BlockNode)
{ // This actor doesn't span blocks, so we know it can only ever be checked once.
return me;
}
for (i = (int)CheckArray.Size() - 1; i >= checkindex; --i)
{
if (CheckArray[i] == me)