Skip to content

Commit a34fd16

Browse files
authored
tweak: Disable test asset loading in release builds (#1485)
1 parent 1dac726 commit a34fd16

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

Core/GameEngine/Include/Common/FileSystem.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,17 @@ typedef FilenameList::iterator FilenameListIter;
8787

8888
// LOAD_TEST_ASSETS automatically loads w3d assets from the TEST_W3D_DIR_PATH
8989
// without having to add an INI entry.
90-
///@todo this allows us to use the test art directory, it should be removed for FINAL release
90+
#if defined(RTS_DEBUG)
9191
#define LOAD_TEST_ASSETS 1
92+
#endif
93+
9294
#ifdef LOAD_TEST_ASSETS
9395
#define ROAD_DIRECTORY "../TestArt/TestRoad/"
9496
#define TEST_STRING "***TESTING"
95-
// the following directories will be used to look for test art
96-
#define LOOK_FOR_TEST_ART
97-
#define TEST_W3D_DIR_PATH "../TestArt/" ///< .w3d files live here
98-
#define TEST_TGA_DIR_PATH "../TestArt/" ///< .tga texture files live here
97+
// the following directories will be used to look for test art
98+
#define LOOK_FOR_TEST_ART
99+
#define TEST_W3D_DIR_PATH "../TestArt/" ///< .w3d files live here
100+
#define TEST_TGA_DIR_PATH "../TestArt/" ///< .tga texture files live here
99101
#endif
100102

101103
struct FileInfo {

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ void W3DDefaultDraw::reactToTransformChange( const Matrix3D *oldMtx,
9494
const Coord3D *oldPos,
9595
Real oldAngle )
9696
{
97-
97+
#ifdef LOAD_TEST_ASSETS
9898
if( m_renderObject )
9999
m_renderObject->Set_Transform( *getDrawable()->getTransformMatrix() );
100-
100+
#endif
101101
}
102102

103103
//-------------------------------------------------------------------------------------------------

Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,15 +1251,18 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body
12511251
break;
12521252
}
12531253

1254-
AsciiString modelName("No Model Name");
1254+
AsciiString modelName;
12551255
*scale = 1.0f;
1256-
Int i;
1256+
1257+
#ifdef LOAD_TEST_ASSETS
12571258
char buffer[ _MAX_PATH ];
1259+
12581260
if (strncmp(TEST_STRING, pMapObj->getName().str(), strlen(TEST_STRING)) == 0)
12591261
{
12601262
/* Handle test art models here */
12611263
strcpy(buffer, pMapObj->getName().str());
12621264

1265+
Int i;
12631266
for (i=0; buffer[i]; i++) {
12641267
if (buffer[i] == '/') {
12651268
i++;
@@ -1268,7 +1271,9 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body
12681271
}
12691272
modelName = buffer+i;
12701273
}
1271-
else
1274+
#endif
1275+
1276+
if (modelName.isEmpty())
12721277
{
12731278
modelName = "No Model Name"; // must be this while GDF exists (it's the default)
12741279
const ThingTemplate *tTemplate;
@@ -1281,8 +1286,8 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body
12811286
modelName = getBestModelName(tTemplate, state);
12821287
*scale = tTemplate->getAssetScale();
12831288

1284-
} // end if
1285-
} // end else
1289+
}
1290+
}
12861291
return modelName;
12871292
}
12881293

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDefaultDraw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ void W3DDefaultDraw::reactToTransformChange( const Matrix3D *oldMtx,
9494
const Coord3D *oldPos,
9595
Real oldAngle )
9696
{
97-
97+
#ifdef LOAD_TEST_ASSETS
9898
if( m_renderObject )
9999
m_renderObject->Set_Transform( *getDrawable()->getTransformMatrix() );
100-
100+
#endif
101101
}
102102

103103
//-------------------------------------------------------------------------------------------------

GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,15 +1308,18 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body
13081308
break;
13091309
}
13101310

1311-
AsciiString modelName("No Model Name");
1311+
AsciiString modelName;
13121312
*scale = 1.0f;
1313-
Int i;
1313+
1314+
#ifdef LOAD_TEST_ASSETS
13141315
char buffer[ _MAX_PATH ];
1316+
13151317
if (strncmp(TEST_STRING, pMapObj->getName().str(), strlen(TEST_STRING)) == 0)
13161318
{
13171319
/* Handle test art models here */
13181320
strcpy(buffer, pMapObj->getName().str());
13191321

1322+
Int i;
13201323
for (i=0; buffer[i]; i++) {
13211324
if (buffer[i] == '/') {
13221325
i++;
@@ -1325,7 +1328,9 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body
13251328
}
13261329
modelName = buffer+i;
13271330
}
1328-
else
1331+
#endif
1332+
1333+
if (modelName.isEmpty())
13291334
{
13301335
modelName = "No Model Name"; // must be this while GDF exists (it's the default)
13311336
const ThingTemplate *tTemplate;
@@ -1338,8 +1343,8 @@ AsciiString WbView3d::getModelNameAndScale(MapObject *pMapObj, Real *scale, Body
13381343
modelName = getBestModelName(tTemplate, state);
13391344
*scale = tTemplate->getAssetScale();
13401345

1341-
} // end if
1342-
} // end else
1346+
}
1347+
}
13431348
return modelName;
13441349
}
13451350

0 commit comments

Comments
 (0)