Fix incorrect rendering of menu and entities background maps

Load the map images for the menu and entities background maps before the respective map layers. Otherwise, the total number of images is `0` when loading the layers, which causes the images of tiles and quads layers to be considered invalid during the initialization, which results in the wrong tile/quad memory layout being used.

Regression from #9213.
This commit is contained in:
Robert Müller 2024-11-07 20:22:33 +01:00
parent 50d8dfeb6a
commit 1ceb7d0212
2 changed files with 4 additions and 2 deletions

View file

@ -80,10 +80,12 @@ void CBackground::LoadBackground()
if(m_Loaded) if(m_Loaded)
{ {
CMapLayers::OnMapLoad();
if(NeedImageLoading) if(NeedImageLoading)
{
m_pImages->LoadBackground(m_pLayers, m_pMap); m_pImages->LoadBackground(m_pLayers, m_pMap);
} }
CMapLayers::OnMapLoad();
}
} }
} }

View file

@ -256,8 +256,8 @@ void CMenuBackground::LoadMenuBackground(bool HasDayHint, bool HasNightHint)
{ {
m_pLayers->Init(m_pMap, true); m_pLayers->Init(m_pMap, true);
CMapLayers::OnMapLoad();
m_pImages->LoadBackground(m_pLayers, m_pMap); m_pImages->LoadBackground(m_pLayers, m_pMap);
CMapLayers::OnMapLoad();
// look for custom positions // look for custom positions
CMapItemLayerTilemap *pTLayer = m_pLayers->GameLayer(); CMapItemLayerTilemap *pTLayer = m_pLayers->GameLayer();