For the developers out there, here's a fun little snippet I found while coming up with a better solution to create formatted strings:
str_scratch.str("");
str_scratch << TileIndexTranslation[mTile->index()];
r.drawText(font(), str_scratch.str(), rect().x() + 5 + mBold.width("Terrain: "), rect().y() + 75, 0, 0, 0);
r.drawText(mBold, "Terrain:", rect().x() + 5, rect().y() + 75, 0, 0, 0);
str_scratch is a std::stringstream.
TileIndexTranslation is a std::map that uses an int as a key and returns a std::string as a value (std::map<int, std::string>).
Yeah. It's truly that bad.
I used a stringstream to create a formatted string using a string.
Genuinely belongs on TheDailyWTF.
Corrected code looks like this:
r.drawText(mBold, "Terrain:", rect().x() + 5, rect().y() + 75, 0, 0, 0);
r.drawText(font(), TileIndexTranslation[mTile->index()], rect().x() + 5 + mBold.width("Terrain: "), rect().y() + 75, 0, 0, 0);