Skip to content

Commit bfa9498

Browse files
committed
Don't store module ID ContentFile was loaded from - get it from path on demand
Demand is literally in one place when texturizing terrain Fixes my stack overflow lel AAAAAAAAAAAAAAAAAAAAAAAAA
1 parent 8df894c commit bfa9498

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

Entities/SLTerrain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ namespace RTE {
141141
BITMAP *defaultBGLayerTexture = m_DefaultBGTextureFile.GetAsBitmap();
142142

143143
const std::array<Material *, c_PaletteEntriesNumber> &materialPalette = g_SceneMan.GetMaterialPalette();
144-
const std::array<unsigned char, c_PaletteEntriesNumber> &materialMappings = g_ModuleMan.GetDataModule(m_BitmapFile.GetDataModuleID())->GetAllMaterialMappings();
144+
const std::array<unsigned char, c_PaletteEntriesNumber> &materialMappings = g_ModuleMan.GetDataModule(g_ModuleMan.GetModuleIDFromPath(m_BitmapFile.GetDataPath()))->GetAllMaterialMappings();
145145

146146
std::array<BITMAP *, c_PaletteEntriesNumber> materialFGTextures;
147147
materialFGTextures.fill(nullptr);

System/ContentFile.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ namespace RTE {
2626
m_DataPathIsImageFile = false;
2727
m_FormattedReaderPosition.clear();
2828
m_DataPathAndReaderPosition.clear();
29-
m_DataModuleID = 0;
3029

3130
m_ImageFileInfo.fill(-1);
3231
}
@@ -45,7 +44,6 @@ namespace RTE {
4544
m_DataPath = reference.m_DataPath;
4645
m_DataPathExtension = reference.m_DataPathExtension;
4746
m_DataPathWithoutExtension = reference.m_DataPathWithoutExtension;
48-
m_DataModuleID = reference.m_DataModuleID;
4947

5048
return 0;
5149
}
@@ -81,12 +79,6 @@ namespace RTE {
8179
return 0;
8280
}
8381

84-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
85-
86-
int ContentFile::GetDataModuleID() const {
87-
return (m_DataModuleID < 0) ? g_ModuleMan.GetModuleIDFromPath(m_DataPath) : m_DataModuleID;
88-
}
89-
9082
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9183

9284
void ContentFile::SetDataPath(const std::string &newDataPath) {
@@ -99,7 +91,6 @@ namespace RTE {
9991

10092
m_DataPathWithoutExtension = m_DataPath.substr(0, m_DataPath.length() - m_DataPathExtension.length());
10193
s_PathHashes[GetHash()] = m_DataPath;
102-
m_DataModuleID = g_ModuleMan.GetModuleIDFromPath(m_DataPath);
10394
}
10495

10596
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

System/ContentFile.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ namespace RTE {
6969
#pragma endregion
7070

7171
#pragma region Getters and Setters
72-
/// <summary>
73-
/// Gets the ID of the Data Module this file is inside.
74-
/// </summary>
75-
/// <returns>The ID of the DataModule containing this' file.</returns>
76-
int GetDataModuleID() const;
77-
7872
/// <summary>
7973
/// Gets the file path of the content file represented by this ContentFile object.
8074
/// </summary>
@@ -211,8 +205,6 @@ namespace RTE {
211205
std::string m_FormattedReaderPosition; //!< A string containing the currently read file path and the line being read. Formatted to be used for logging.
212206
std::string m_DataPathAndReaderPosition; //!< The path to this ContentFile's data file combined with the ini file and line it is being read from. This is used for logging.
213207

214-
int m_DataModuleID; //!< Data Module ID of where this was loaded from.
215-
216208
#pragma region Image Info Getters
217209
/// <summary>
218210
/// Gets the specified image info from this ContentFile's data file on disk.

0 commit comments

Comments
 (0)