summaryrefslogtreecommitdiff
path: root/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'memory.cpp')
-rw-r--r--memory.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/memory.cpp b/memory.cpp
index 28f1797..30574e9 100644
--- a/memory.cpp
+++ b/memory.cpp
@@ -107,11 +107,16 @@ Memory_Block_PrincipalBitmap_AllocateNew(project_data *File, project_state *Stat
{
int h = 0, c = 0, i = 0;
int MaxBlockIndex = -1;
+ int PrincipalCount = 0;
while (Block_Loop(Memory, F_Sources, File->Source_Count, &h, &c, &i)) {
block_source *Source = (block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, i);
- if (Source->Bitmap_Index > MaxBlockIndex && Source->Type == source_type_principal)
+ if (Source->Type == source_type_principal || Source->Type == source_type_principal_temp)
+ PrincipalCount++;
+ if (Source->Bitmap_Index > MaxBlockIndex)
MaxBlockIndex = i;
}
+ if (!PrincipalCount)
+ return 0;
block_source Source = *(block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, MaxBlockIndex);
uint32 LastBlock = Source.Bitmap_Index;