Skip to content

Commit

Permalink
C4Section: Don't load the material enumeration and reinitialize the t…
Browse files Browse the repository at this point in the history
…exture map

if the materials and textures were copied from another section

This allows `CPattern` to reuse the cached patterns, massively cutting down
on RAM costs - with 2000 20x20 sections, 10 GB of RAM were previously used
just for cached patterns.
  • Loading branch information
Fulgen301 committed Jun 25, 2024
1 parent 5ca4a3f commit 08c522d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/C4Section.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,16 @@ bool C4Section::InitMaterialTexture(C4Section *const fallback)
// Logs
LogF(LoadResStr("IDS_PRC_TEXTURES"), tex_count);
LogF(LoadResStr("IDS_PRC_MATERIALS"), mat_count);
}

// Load material enumeration
if (!Material.LoadEnumeration(Group))
{
LogFatal(LoadResStr("IDS_PRC_NOMATENUM")); return false;
}
// Load material enumeration
if (!Material.LoadEnumeration(Group))
{
LogFatal(LoadResStr("IDS_PRC_NOMATENUM")); return false;
}

// Initialize texture map
TextureMap.Init();
// Initialize texture map
TextureMap.Init();
}

// Cross map mats (after texture init, because Material-Texture-combinations are used)
Material.CrossMapMaterials();
Expand Down

0 comments on commit 08c522d

Please sign in to comment.