Game Development Community

1.8- Bens a little *too* lazy (and strings don't like strings?)

by Kirk Longendyke · in Torque Game Engine Advanced · 11/19/2008 (7:16 pm) · 4 replies

The error AssertISV( false, "Ben is lazy. No mip generation, and your image doesn't have 'em." );

proved to be more than a bit useless during porting, where were looking at testing against quite a few textures already knocked out for the prototype, so tossed in:

AssertISV( false, String::ToString("Ben is lazy. No mip generation, and %s doesn't have 'em.", dds->getSourcePath().getFullFileName()));

to get additional data. problem is, strings don't seem to evaluate correctly to %s for some oddball reason...

#1
11/19/2008 (7:35 pm)
Any sort of formatting, unless very explicitly set up otherwise, is only going to work on basic builtin types. You'll want dds->getSourcePath().getFullFileName().c_str().

And yes, that assert is pretty useless. But Ben *is* lazy, says so right there :)
#2
11/19/2008 (7:52 pm)
Thanks. Knew it'd be something simple I was overlooking.
#3
11/19/2008 (7:56 pm)
Just to add to this a bit - the problem is that Strings cannot be implicity converted when using variable argument lists. This is the same when you use std::string which also uses c_str() to access the string as a char *.

And just for info's sake, another way to do this is using avar() like this:

AssertISV( false, avar("Ben is lazy. No mip generation, and %s doesn't have 'em.", dds->getSourcePath().getFullFileName().c_str()));

avar() uses a static buffer in place instead of going through all the String machinations. Obviously efficiency is not a concern here, but it's another choice for future reference. [avar() is defined in platformAssert.h.]
#4
11/19/2008 (8:29 pm)
Ah. explains the additional tack-ons for that in the bitmap setting protocols. makes sense.