Alright so this whole function works fine unless an E is put through the switch statement. It will print out a blank line, then ask for input again. If you put in the E again, it works fine. It ONLY does it for THIS letter. Every other letter works like a charm. Am i missing something obvious?
std::string userInput;
char extractedInput;
bool validChoiceMade = false;
while ( !validChoiceMade )
{
std::cout << ">";
std::getline(std::cin, userInput);
extractedInput = toupper(userInput[0]);
switch ( extractedInput )
{
case'N': if ( world[userX][userY].get_exit(North) )
{
validChoiceMade = true;
userX--;
std::cout << world[userX][userY].get_description(North) << std::endl;
}
else
{
std::cout << "I dont think that is an option at this point." << std::endl;
} break;
case'E': if ( world[userX][userY].get_exit(East) )
{
validChoiceMade = true;
userY++;
std::cout << world[userX][userY].get_description(East) << std::endl;
}
else
{
std::cout << "I dont think that is an option at this point." << std::endl;
} break;
case'S': if ( world[userX][userY].get_exit(South) )
{
validChoiceMade = true;
userX++;
std::cout << "I dont think that is an option at this point." << std::endl;
}
else
{
std::cout << "I dont think that is an option at this point." << std::endl;
} break;
case'W': if ( world[userX][userY].get_exit(West) )
{
validChoiceMade = true;
userY--;
std::cout << world[userX][userY].get_description(West) << std::endl;
}
else
{
std::cout << "I dont think that is an option at this point." << std::endl;
} break;
default: std::cout << "I dont think that is an option at this point." << std::endl;
}
}
}