mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Removed duplicate checkbox image
Added asset import conflict resolution option to prepend folder name Cleanups of Project Importer and fixed importing of material and terrain materials, specifically, fallbacks in the event they are unnamed to utilize the mapTo and internalName fields, respectively Fixed typos in guiTerrainMaterialDlg Added AssetBrowser button to GuiEditor Improved FileObject's PeekLine function to be able to peek forward further via an optional lineOffset argument
This commit is contained in:
parent
438e6cbb3c
commit
abf5a09bc3
12 changed files with 298 additions and 194 deletions
|
|
@ -177,7 +177,7 @@ const U8 *FileObject::readLine()
|
|||
return mFileBuffer + tokPos;
|
||||
}
|
||||
|
||||
void FileObject::peekLine( U8* line, S32 length )
|
||||
void FileObject::peekLine( S32 peekLineOffset, U8* line, S32 length )
|
||||
{
|
||||
if(!mFileBuffer)
|
||||
{
|
||||
|
|
@ -189,6 +189,31 @@ void FileObject::peekLine( U8* line, S32 length )
|
|||
// we can't modify the file buffer.
|
||||
S32 i = 0;
|
||||
U32 tokPos = mCurPos;
|
||||
S32 lineOffset = 0;
|
||||
|
||||
//Lets push our tokPos up until we've offset the requested number of lines
|
||||
while (lineOffset < peekLineOffset && tokPos <= mBufferSize)
|
||||
{
|
||||
if (mFileBuffer[tokPos] == '\r')
|
||||
{
|
||||
tokPos++;
|
||||
if (mFileBuffer[tokPos] == '\n')
|
||||
tokPos++;
|
||||
lineOffset++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mFileBuffer[tokPos] == '\n')
|
||||
{
|
||||
tokPos++;
|
||||
lineOffset++;
|
||||
continue;
|
||||
}
|
||||
|
||||
tokPos++;
|
||||
}
|
||||
|
||||
//now peek that line, then return the results
|
||||
while( ( tokPos != mBufferSize ) && ( mFileBuffer[tokPos] != '\r' ) && ( mFileBuffer[tokPos] != '\n' ) && ( i < ( length - 1 ) ) )
|
||||
line[i++] = mFileBuffer[tokPos++];
|
||||
|
||||
|
|
@ -317,7 +342,7 @@ DefineEngineMethod( FileObject, readLine, const char*, (),,
|
|||
return (const char *) object->readLine();
|
||||
}
|
||||
|
||||
DefineEngineMethod( FileObject, peekLine, const char*, (),,
|
||||
DefineEngineMethod( FileObject, peekLine, const char*, (S32 peekOffset), (0),
|
||||
"@brief Read a line from the file without moving the stream position.\n\n"
|
||||
|
||||
"Emphasis on *line*, as in you cannot parse individual characters or chunks of data. "
|
||||
|
|
@ -345,7 +370,7 @@ DefineEngineMethod( FileObject, peekLine, const char*, (),,
|
|||
{
|
||||
static const U32 bufSize = 512;
|
||||
char *line = Con::getReturnBuffer( bufSize );
|
||||
object->peekLine( (U8*)line, bufSize );
|
||||
object->peekLine(peekOffset, (U8*)line, bufSize );
|
||||
return line;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue