13 April 2013

The Debug Dialog

When I was creating the iOS version of King of Dragon Pass, I included some of the same debugging utilities we had in the original game. Unfortunately, I couldn’t remember exactly what we had, and there was no good way to look, because the release version of the game didn’t have them. (And it’s real hard to search an mTropolis project.)

I knew there was a way to trigger a specific scene (critical for running them over and over to test all the possibilities). And a set of commands that do things like get rid of all your food (to test things like starvation advice) or get raided by Trolls.

But I knew there was something more, just not what it was.

Today I happened to run into this code
/*
Returns text about our clan helpful for debugging (shown in the \ dialogette)
*/
char* CPlayerClan::DebugInfo() const
{
gString = "farmerMorale: ";
UString::Append(gString, this->MoraleFarmers());
gString += ", warriorMorale: ";
UString::Append(gString, this->MoraleWarriors());
gString += ", thrallMorale: ";
UString::Append(gString, COSL::GetIntegerVariable(var_thrallMorale));
gString += ", mood: ";
UString::Append(gString, this->Mood());
gString += "\rvictory: ";
UString::Append(gString, COSL::GetIntegerVariable(var_victory));
gString += ", kingship: ";
UString::Append(gString, this->Kingship());
gString += "\r";
UString::Append(gString, fYearsAsType, "year", "years");
gString += " as clan type\r";

return (char *)gString.data();
} // DebugInfo

which was clearly used to display some internal status useful for testing.

This isn’t as important as it was in 1999, but we’re in the process of thoroughly testing a number of new scenes (currently 14, but several more are in progress). So I put this into the current debug dialog. It’s almost like seeing a long-forgotten friend.