class SpeechComponent
{
class PlayerSpeechData
{
bool speechTurnedOn;
};
// All components implement this
void addDataToPlayer(CHAR_DATA* ch)
{
ch->add_component_data("PlayerSpeechData", (void*)new PlayerSpeechData));
}
void do_say(CHAR_DATA* ch, char* arguments)
{
char* message = strcpy(arguments);
PlayerSpeechData* ourData = (PlayerSpeechData*)ch->get_component_data("PlayerSpeechData");
assert(ourData);
if (ourData->speechTurnedOn)
echo_to_room(ch->in_room, message);
else
send_to_char(ch, "You have speech turned off.");
}
// All components implement this
void registerCommands(CMD_TABLE* tbl)
{
tbl->addCommand(&do_say, "say");
}
};
The "another" topic touched on writing a parser. But what I did not see (although it was not necessarily being asked) was, "Oh, I see you are using Python, here are some nice and clean open source parser libraries that you should be able to import into your codebase with little coupling." I don't even think it is possible to say that, even if it were.