MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / readText

Method readText

Engine/source/materials/materialList.cpp:214–244  ·  view source on GitHub ↗

--------------------------------------

Source from the content-addressed store, hash-verified

212
213//--------------------------------------
214bool MaterialList::readText(Stream &stream, U8 firstByte)
215{
216 free();
217
218 if (!firstByte)
219 return (stream.getStatus() == Stream::Ok || stream.getStatus() == Stream::EOS);
220
221 char buf[1024];
222 buf[0] = firstByte;
223 U32 offset = 1;
224
225 for(;;)
226 {
227 stream.readLine((U8*)(buf+offset), sizeof(buf)-offset);
228 if(!buf[0])
229 break;
230 offset = 0;
231
232 // Material paths are a legacy of Tribes tools,
233 // strip them off...
234 char *name = &buf[dStrlen(buf)];
235 while (name != buf && name[-1] != '/' && name[-1] != '\\')
236 name--;
237
238 // Add it to the list
239 mMaterialNames.push_back(name);
240 mMatInstList.push_back(NULL);
241 }
242
243 return (stream.getStatus() == Stream::Ok || stream.getStatus() == Stream::EOS);
244}
245
246bool MaterialList::readText(Stream &stream)
247{

Callers

nothing calls this directly

Calls 6

freeFunction · 0.85
dStrlenFunction · 0.50
getStatusMethod · 0.45
readLineMethod · 0.45
push_backMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected