Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 62bad41

Browse files
committed
Rename PresetMan::FullModulePath to GetFullModulePath
Remove no longer necessary backslash correction
1 parent de9bf73 commit 62bad41

16 files changed

+36
-35
lines changed

Activities/GAScripted.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int GAScripted::Create(const GAScripted &reference) {
114114

115115
int GAScripted::ReadProperty(const std::string_view &propName, Reader &reader) {
116116
if (propName == "ScriptPath") {
117-
m_ScriptPath = CorrectBackslashesInPath(g_PresetMan.FullModulePath(CorrectBackslashesInPath(reader.ReadPropValue())));
117+
m_ScriptPath = CorrectBackslashesInPath(reader.ReadPropValue());
118118
} else if (propName == "LuaClassName") {
119119
reader >> m_LuaClassName;
120120
} else if (propName == "AddPieSlice") {
@@ -136,7 +136,7 @@ int GAScripted::ReadProperty(const std::string_view &propName, Reader &reader) {
136136
int GAScripted::Save(Writer &writer) const {
137137
// Call the script OnSave() function, if it exists
138138
g_LuaMan.RunScriptString("if " + m_LuaClassName + " and " + m_LuaClassName + ".OnSave then " + m_LuaClassName + ":OnSave(); end");
139-
139+
140140
GameActivity::Save(writer);
141141

142142
writer.NewPropertyWithValue("ScriptPath", m_ScriptPath);
@@ -510,7 +510,7 @@ void GAScripted::Draw(BITMAP *pTargetBitmap, const Vector &targetPos) {
510510

511511
void GAScripted::CollectRequiredAreas() {
512512
// Open the script file so we can check it out
513-
std::ifstream *pScriptFile = new std::ifstream(g_PresetMan.FullModulePath(m_ScriptPath.c_str()));
513+
std::ifstream *pScriptFile = new std::ifstream(g_PresetMan.GetFullModulePath(m_ScriptPath.c_str()));
514514
if (!pScriptFile->good()) {
515515
return;
516516
}

Entities/MovableObject.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ int MovableObject::ReadProperty(const std::string_view &propName, Reader &reader
334334
else if (propName == "HUDVisible")
335335
reader >> m_HUDVisible;
336336
else if (propName == "ScriptPath") {
337-
std::string scriptPath = g_PresetMan.FullModulePath(CorrectBackslashesInPath(reader.ReadPropValue()));
338-
switch (LoadScript(CorrectBackslashesInPath(scriptPath))) {
337+
std::string scriptPath = g_PresetMan.GetFullModulePath(reader.ReadPropValue());
338+
switch (LoadScript(scriptPath)) {
339339
case 0:
340340
break;
341341
case -1:
@@ -490,7 +490,7 @@ int MovableObject::Save(Writer &writer) const
490490
writer << m_IgnoreTerrain;
491491
writer.NewProperty("SimUpdatesBetweenScriptedUpdates");
492492
writer << m_SimUpdatesBetweenScriptedUpdates;
493-
493+
494494
return 0;
495495
}
496496

@@ -687,7 +687,7 @@ MovableObject::MovableObject(const MovableObject &reference):
687687
m_AgeTimer(reference.GetAge()),
688688
m_Lifetime(reference.GetLifetime())
689689
{
690-
690+
691691
}
692692
*/
693693

@@ -866,7 +866,7 @@ void MovableObject::PreTravel()
866866

867867
void MovableObject::Travel()
868868
{
869-
869+
870870
}
871871

872872

@@ -946,7 +946,7 @@ void MovableObject::Draw(BITMAP* targetBitmap, const Vector& targetPos, DrawMode
946946
if (mode == g_DrawMOID && m_MOID == g_NoMOID) {
947947
return;
948948
}
949-
949+
950950
g_SceneMan.RegisterDrawing(targetBitmap, mode == g_DrawNoMOID ? g_NoMOID : m_MOID, m_Pos - targetPos, 1.0F);
951951
}
952952

Entities/Scene.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ int Scene::ExpandAIPlanAssemblySchemes()
10291029

10301030
int Scene::SaveData(std::string pathBase)
10311031
{
1032-
const std::string fullPathBase = g_PresetMan.FullModulePath(pathBase);
1032+
const std::string fullPathBase = g_PresetMan.GetFullModulePath(pathBase);
10331033
if (fullPathBase.empty())
10341034
return -1;
10351035

GUI/GUIControlManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ bool GUIControlManager::Save(GUIWriter *W) {
405405

406406
bool GUIControlManager::Load(const std::string &Filename, bool keepOld) {
407407
GUIReader reader;
408-
const std::string pathFile = g_PresetMan.FullModulePath(Filename);
408+
const std::string pathFile = g_PresetMan.GetFullModulePath(Filename);
409409
if (reader.Create(pathFile.c_str()) != 0) {
410410
return false;
411411
}

GUI/GUISkin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ bool GUISkin::Load(const std::string &directory, const std::string &fileName) {
3939
Destroy();
4040

4141
if (!directory.empty()) {
42-
m_Directory = g_PresetMan.FullModulePath(directory) + "/";
42+
m_Directory = g_PresetMan.GetFullModulePath(directory) + "/";
4343
} else {
4444
// Empty directory means file can be loaded from anywhere in the working directory so need to figure out in what data directory the file actually is from fileName.
45-
std::string fileFullPath = g_PresetMan.FullModulePath(fileName);
45+
std::string fileFullPath = g_PresetMan.GetFullModulePath(fileName);
4646
m_Directory = fileFullPath.substr(0, fileFullPath.find_first_of("/\\") + 1);
4747
}
4848

Lua/LuaBindingsManagers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ namespace RTE {
204204
.def("ReloadAllScripts", &PresetMan::ReloadAllScripts)
205205
.def("IsModuleOfficial", &PresetMan::IsModuleOfficial)
206206
.def("IsModuleUserdata", &PresetMan::IsModuleUserdata)
207-
.def("FullModulePath", &PresetMan::FullModulePath);
207+
.def("GetFullModulePath", &PresetMan::GetFullModulePath);
208208
}
209209

210210
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Managers/ActivityMan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ namespace RTE {
103103
modifiableScene->GetTerrain()->MigrateToModule(g_PresetMan.GetModuleID(c_UserScriptedSavesModuleName));
104104

105105
// Block the main thread for a bit to let the Writer access the relevant data.
106-
std::unique_ptr<Writer> writer(std::make_unique<Writer>(g_PresetMan.FullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName + ".ini"));
106+
std::unique_ptr<Writer> writer(std::make_unique<Writer>(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName + ".ini"));
107107
writer->NewPropertyWithValue("Activity", activity);
108108

109109
// Pull all stuff from MovableMan into the Scene for saving, so existing Actors/ADoors are saved, without transferring ownership, so the game can continue.
@@ -144,7 +144,7 @@ namespace RTE {
144144
std::unique_ptr<Scene> scene(std::make_unique<Scene>());
145145
std::unique_ptr<GAScripted> activity(std::make_unique<GAScripted>());
146146

147-
Reader reader(g_PresetMan.FullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName + ".ini", true, nullptr, false);
147+
Reader reader(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName + ".ini", true, nullptr, false);
148148
if (!reader.ReaderOK()) {
149149
g_ConsoleMan.PrintString("ERROR: Game loading failed! Make sure you have a saved game called \"" + fileName + "\"");
150150
return false;

Managers/AudioMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ namespace RTE {
286286

287287
void AudioMan::PlayMusic(const char *filePath, int loops, float volumeOverrideIfNotMuted) {
288288
if (m_AudioEnabled) {
289-
const std::string fullFilePath = g_PresetMan.FullModulePath(filePath);
289+
const std::string fullFilePath = g_PresetMan.GetFullModulePath(filePath);
290290
if (m_IsInMultiplayerMode) {
291291
RegisterMusicEvent(-1, NetworkMusicState::MUSIC_PLAY, fullFilePath.c_str(), loops);
292292
}

Managers/FrameMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ namespace RTE {
473473
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
474474

475475
bool FrameMan::LoadPalette(const std::string &palettePath) {
476-
const std::string fullPalettePath = g_PresetMan.FullModulePath(palettePath);
476+
const std::string fullPalettePath = g_PresetMan.GetFullModulePath(palettePath);
477477
BITMAP *tempBitmap = load_bitmap(fullPalettePath.c_str(), m_Palette);
478478
RTEAssert(tempBitmap, ("Failed to load palette from bitmap with following path:\n\n" + fullPalettePath).c_str());
479479

Managers/LuaMan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ namespace RTE {
214214
"math.random = function(lower, upper) if lower ~= nil and upper ~= nil then return SelectRand(lower, upper); elseif lower ~= nil then return SelectRand(1, lower); else return PosRand(); end end"
215215
"\n"
216216
// Override "dofile" to be able to account for Data/ or Mods/ directory.
217-
"OriginalDoFile = dofile; dofile = function(filePath) filePath = PresetMan:FullModulePath(filePath); if filePath ~= '' then return OriginalDoFile(filePath); end end;"
217+
"OriginalDoFile = dofile; dofile = function(filePath) filePath = PresetMan:GetFullModulePath(filePath); if filePath ~= '' then return OriginalDoFile(filePath); end end;"
218218
);
219219
}
220220

@@ -360,7 +360,7 @@ namespace RTE {
360360
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
361361

362362
int LuaMan::RunScriptFile(const std::string &filePath, bool consoleErrors) {
363-
const std::string fullScriptPath = g_PresetMan.FullModulePath(filePath);
363+
const std::string fullScriptPath = g_PresetMan.GetFullModulePath(filePath);
364364
if (fullScriptPath.empty()) {
365365
m_LastError = "Can't run a script file with an empty filepath!";
366366
return -1;

0 commit comments

Comments
 (0)