More refactoring. No logic changes.

This commit is contained in:
Eric S. Raymond 2007-07-18 03:30:56 +00:00
parent 1def1d9364
commit 83ce5e8e0a
6 changed files with 30 additions and 4 deletions

View file

@ -572,12 +572,10 @@ bool command_executor::execute_command(HOTKEY_COMMAND command, int /*index*/)
speak();
break;
case HOTKEY_SPEAK_ALLY:
preferences::set_message_private(true);
speak();
whisper();
break;
case HOTKEY_SPEAK_ALL:
preferences::set_message_private(false);
speak();
shout();
break;
case HOTKEY_CREATE_UNIT:
create_unit();

View file

@ -173,6 +173,8 @@ public:
virtual void recruit() {}
virtual void repeat_recruit() {}
virtual void speak() {}
virtual void whisper() {}
virtual void shout() {}
virtual void create_unit() {}
virtual void change_unit_side() {}
virtual void preferences() {}

View file

@ -675,6 +675,20 @@ namespace events{
has_friends() ? _("Send to allies only") : "", preferences::message_private(), *gui_);
}
void menu_handler::whisper()
{
preferences::set_message_private(true);
textbox_info_.show(gui::TEXTBOX_MESSAGE,_("Message:"),
has_friends() ? _("Send to allies only") : "", true, *gui_);
}
void menu_handler::shout()
{
preferences::set_message_private(false);
textbox_info_.show(gui::TEXTBOX_MESSAGE,_("Message:"),
has_friends() ? _("Send to allies only") : "", false, *gui_);
}
bool menu_handler::has_friends() const
{
if(is_observer()) {

View file

@ -81,6 +81,8 @@ public:
void show_chat_log();
void show_help();
void speak();
void whisper();
void shout();
void recruit(const bool browse, const unsigned int team_num, const gamemap::location& last_hex);
void repeat_recruit(const unsigned int team_num, const gamemap::location& last_hex);
void recall(const unsigned int team_num, const gamemap::location& last_hex);

View file

@ -54,6 +54,14 @@ void playmp_controller::speak(){
menu_handler_.speak();
}
void playmp_controller::whisper(){
menu_handler_.whisper();
}
void playmp_controller::shout(){
menu_handler_.shout();
}
void playmp_controller::play_side(const unsigned int team_index, bool save){
do {
player_type_changed_ = false;

View file

@ -35,6 +35,8 @@ protected:
virtual void handle_generic_event(const std::string& name);
virtual void speak();
virtual void whisper();
virtual void shout();
virtual void clear_labels();
virtual bool can_execute_command(hotkey::HOTKEY_COMMAND command, int index=-1) const;