Skip to content

Commit

Permalink
Serial: Silence a lot of debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiralPotato committed Aug 5, 2024
1 parent 9793777 commit 42b1648
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions Software/GameEngine/src/games/mage/mage_command_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,26 @@ void MageCommandControl::processInputAsCommand(std::string input) {

verb = aliasLookup(verb);

/*
if (MageGame->isEntityDebugOn) {
std::string message = "Verb: " + verb;
if (!modifier.empty()) { message += " | Modifier: " + modifier; }
if (!subject.empty()) { message += " | Subject: " + subject; }
message += "\n";
commandResponseBuffer += message;
}

*/

MageSerialDialogCommand* foundCommand = searchForCommand(
verb,
subject
);
if (foundCommand != nullptr) {
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += "COMMAND FOUND!!!!: " + verb + "\n";
}
*/
MageScript->initScriptState(
&MageScript->resumeStates.serial,
foundCommand->scriptId,
Expand All @@ -116,7 +119,7 @@ void MageCommandControl::processInputAsCommand(std::string input) {
// would be really useful earlier, but I can't remember why now.
lastCommandUsed = COMMAND_HELP;
commandResponseBuffer += (
"Supported Verbs:\n"
"Supported Commands:\n"
" help look go"
);
if (!registeredCommands.empty()) {
Expand Down Expand Up @@ -258,32 +261,37 @@ void MageCommandControl::processInputAsCommand(std::string input) {
}
// end SECRET_GOAT
else {
commandResponseBuffer += "Unrecognized Verb: " + verb + "\n";
commandResponseBuffer += "Unrecognized Command: " + verb + "\n";
}
}

std::string MageCommandControl::aliasLookup(std::string& input) {
auto result = input;
auto found = commandAliases.find(input);
if (found == commandAliases.end()) {
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += "Alias NOT found: " + input + "\n";
}
*/
}
else {
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += "Alias found: " + found->first + " is " + found->second + "\n";
}
*/
result = found->second;
}
return result;
};

void MageCommandControl::processInputAsTrappedResponse(const std::string& input) {

/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += "processInputAsTrappedResponse: " + input + "\n";
}
*/
MageSerialDialogResponseTypes responseType = serialDialog.serialResponseType;
if (responseType == RESPONSE_ENTER_NUMBER) {
bool errorWhileParsingInt = false;
Expand All @@ -300,19 +308,23 @@ void MageCommandControl::processInputAsTrappedResponse(const std::string& input)
) {
MageSerialDialogResponse *response = &serialDialogResponses[responseIndex];
std::string responseLabel = MageGame->getString(response->stringId, NO_PLAYER);
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += (
"Valid response: " +
input + " - " +
responseLabel + "\n"
);
}
*/
jumpScriptId = response->scriptId;
isInputTrapped = false;
} else {
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += "Invalid response: " + input + "\n";
}
*/
showSerialDialog(serialDialogId);
}
}
Expand All @@ -324,9 +336,11 @@ void MageCommandControl::processInputAsTrappedResponse(const std::string& input)
std::string responseLabel = MageGame->getString(response->stringId, NO_PLAYER);
badAsciiLowerCase(&responseLabel);
if (responseLabel == input) {
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += "Valid response: " + input + "\n";
}
*/
jumpScriptId = response->scriptId;
isInputTrapped = false;
validResponseFound = true;
Expand Down Expand Up @@ -583,7 +597,7 @@ void MageCommandControl::registerCommandAlias(
) {
auto command = MageGame->getString(commandStringId, NO_PLAYER);
auto alias = MageGame->getString(aliasStringId, NO_PLAYER);

/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += (
"registerCommandAlias: "
Expand All @@ -592,6 +606,7 @@ void MageCommandControl::registerCommandAlias(
+ "\n"
);
}
*/
commandAliases[alias] = command;
// debugAliases();
}
Expand All @@ -609,13 +624,15 @@ void MageCommandControl::unregisterCommandAlias(
uint16_t aliasStringId
) {
auto alias = MageGame->getString(aliasStringId, NO_PLAYER);
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += (
"unregisterCommandAlias:"
" aliasStringId: " + alias
+ "\n"
);
}
*/
commandAliases.erase(alias);
// debugAliases();
}
Expand All @@ -625,6 +642,7 @@ void MageCommandControl::setCommandVisibility(
bool isVisible
) {
auto commandString = MageGame->getString(commandStringId, NO_PLAYER);
/*
if(MageGame->isEntityDebugOn) {
commandResponseBuffer += (
"setCommandVisibility:"
Expand All @@ -633,6 +651,7 @@ void MageCommandControl::setCommandVisibility(
+ "\n"
);
}
*/
int32_t existingCommandIndex = getCommandIndex(commandString, false, true);
if (existingCommandIndex != -1) {
// set the visibility
Expand Down

0 comments on commit 42b1648

Please sign in to comment.