Torque 1.4 HEAD guiTreeViewCtlr.cc
by Gregory "Centove" McLean · in Torque Game Engine · 10/23/2005 (6:10 pm) · 4 replies
This may only affect the linux/gcc combination...
None of the tree icons were loading and I was getting loads of 'Could not locate texture: com' in the log.
In the guiTreeViewCtrl.cc file around line 990
Also, what happens if by some odd chance the path of an icon is more then 64 chars?
Proposed fix:
This works here on the linux build. And I now see icons, and in case some nut out there wants icon paths to be
'/some/really/really/long/path/to/the/icons/just/cause/we/can/and/watch/things/blow/up'
It won't puke on it. Seeing as its using the FrameAllocator it shouldn't thrash memory to bad.
None of the tree icons were loading and I was getting loads of 'Could not locate texture: com' in the log.
In the guiTreeViewCtrl.cc file around line 990
char *buf = (char*)txtBuff.alloc(sizeof(char) * 64);
char* token = dStrtok( drawText, ":" );
// Count the number of icons and store them.
while (token && numIcons < MaxIcons)
{
dSprintf( buf, sizeof( buf ), "%s", token );
mIconTable[numIcons] = TextureHandle( buf, BitmapKeepTexture );
token = dStrtok( NULL, ":" );
numIcons++;
}On linux that 'sizeof( buf )' turns out to be 4. So we were passing to the resource manager to load 'com' which it dutifly reported it couldn't load.Also, what happens if by some odd chance the path of an icon is more then 64 chars?
Proposed fix:
char *buf;
char* token = dStrtok( drawText, ":" );
// Count the number of icons and store them.
while (token && numIcons < MaxIcons)
{
buf = (char *)txtBuff.alloc(sizeof(char) * (dStrlen(token) + 1));
dSprintf( buf, dStrlen(token) + 1, "%s", token );
mIconTable[numIcons] = TextureHandle( buf, BitmapKeepTexture );
token = dStrtok( NULL, ":" );
numIcons++;
}This works here on the linux build. And I now see icons, and in case some nut out there wants icon paths to be
'/some/really/really/long/path/to/the/icons/just/cause/we/can/and/watch/things/blow/up'
It won't puke on it. Seeing as its using the FrameAllocator it shouldn't thrash memory to bad.
Torque Owner Gregory "Centove" McLean
while (token && numIcons < MaxIcons) { mIconTable[numIcons] = TextureHandle( token , BitmapKeepTexture ); token = dStrtok( NULL, ":" ); numIcons++; }Seems to work just as well.