Skip to content

Commit fdab699

Browse files
committed
Fix/Delay decision which .obj file to copy/load
1 parent 3de5fdc commit fdab699

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ else()
3232
endif()
3333

3434
project(XPMP2
35-
VERSION 3.4.0
35+
VERSION 3.4.1
3636
DESCRIPTION "Multiplayer library for X-Plane 11 and 12")
3737

3838
# Source list

XPMP2.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@
483483
);
484484
XPMP2_VER_MAJOR = 3;
485485
XPMP2_VER_MINOR = 4;
486-
XPMP2_VER_PATCH = 0;
486+
XPMP2_VER_PATCH = 1;
487487
XPSDK_ROOT = lib/SDK;
488488
};
489489
name = Debug;
@@ -585,7 +585,7 @@
585585
);
586586
XPMP2_VER_MAJOR = 3;
587587
XPMP2_VER_MINOR = 4;
588-
XPMP2_VER_PATCH = 0;
588+
XPMP2_VER_PATCH = 1;
589589
XPSDK_ROOT = lib/SDK;
590590
};
591591
name = Release;

src/CSLModels.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ XPLMObjectRef CSLObj::GetAndLoadObj ()
104104

105105
// Determine which file to load and if we need a copied .obj file
106106
/// @details 1. Determine if we need to access a copied file at all
107-
/// 2. Compute that copied file name
107+
/// 2. Avoid double-execution by testing if the file name is one for a copied file already
108+
/// 3. Compute that copied file name
108109
/// It will include one of the texture ids if texture replacement is involved
109110
/// It will always end on ".xpmp2.obj"
110-
/// 3. Test if that copied file already exists
111+
/// 4. Test if that copied file already exists
111112
/// The actual copy operation will only be peformed upon load.
112113
void CSLObj::DetermineWhichObjToLoad ()
113114
{
@@ -116,7 +117,11 @@ void CSLObj::DetermineWhichObjToLoad ()
116117
if (!glob.bObjReplDataRefs && !bDoReplTextures)
117118
return;
118119

119-
// 2. Compute that copied file name
120+
// 2. Test if this determination has previously already led to a copied file name
121+
if (path.find(".xpmp2.obj") != std::string::npos)
122+
return;
123+
124+
// 3. Compute that copied file name
120125
pathOrig = path; // Save the original name
121126
// remove the current extension
122127
RemoveExtension(path);
@@ -130,7 +135,7 @@ void CSLObj::DetermineWhichObjToLoad ()
130135
// always add 'xpmp2.obj' as the final extension
131136
path += ".xpmp2.obj";
132137

133-
// 3. Test if that copied file already exists
138+
// 4. Test if that copied file already exists
134139
if (ExistsFile(path))
135140
// It does exist, so no new copy is needed
136141
pathOrig.clear();
@@ -221,6 +226,7 @@ void CSLObj::Load ()
221226
return;
222227

223228
// If needed it is now the time to copy the .obj file
229+
DetermineWhichObjToLoad();
224230
if (!TriggerCopyAndReplace())
225231
return;
226232

@@ -808,9 +814,6 @@ void AcTxtLine_OBJ8 (CSLModel& csl,
808814
if (tokens.size() >= 6)
809815
obj.text_lit = CSLModelsConvPackagePath(tokens[5], lnNr, true);
810816
} // TEXTURE available
811-
812-
// Determine which file to load and if we need a copied .obj file
813-
obj.DetermineWhichObjToLoad ();
814817
} // Package name valid
815818
} // at least 3 params
816819
else

0 commit comments

Comments
 (0)