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

Method readText

Engine/source/materials/materialList.cpp:204–234  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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