some final enhancements

This commit is contained in:
Jörg Hinrichs 2006-04-05 18:36:28 +00:00
parent f8ac313625
commit 48cf5672d9
7 changed files with 16 additions and 56 deletions

View File

@ -17,6 +17,10 @@ namespace gui{
public:
floating_textbox();
const TEXTBOX_MODE mode() const { return mode_; }
const util::scoped_ptr<gui::button> check() const { return check_; }
const util::scoped_ptr<gui::textbox> box() const { return box_; }
void close(display& gui);
void update_location(display& gui);
void show(gui::TEXTBOX_MODE mode, const std::string& label,
@ -24,6 +28,7 @@ namespace gui{
void tab(std::vector<team>& teams, const unit_map& units, display& gui);
bool active() const { return box_.get() != NULL; }
private:
util::scoped_ptr<gui::textbox> box_;
util::scoped_ptr<gui::button> check_;
@ -31,7 +36,6 @@ namespace gui{
std::string label_string_;
int label_;
private:
};
}

View File

@ -1198,7 +1198,9 @@ namespace events{
}
void menu_handler::do_speak(){
do_speak(textbox_info_.box_->text(),textbox_info_.check_ != NULL ? textbox_info_.check_->checked() : false);
//None of the two parameters really needs to be passed since the informations belong to members of the class.
//But since it makes the called method more generic, it is done anyway.
do_speak(textbox_info_.box()->text(),textbox_info_.check() != NULL ? textbox_info_.check()->checked() : false);
}
void menu_handler::do_speak(const std::string& message, bool allies_only)

View File

@ -1,14 +1,10 @@
#include "play_controller.hpp"
#include "config_adapter.hpp"
#include "dialogs.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "preferences.hpp"
#include "replay.hpp"
#include "sound.hpp"
#include "unit_display.hpp"
#include "wassert.hpp"
#define LOG_NG LOG_STREAM(info, engine)
@ -489,15 +485,15 @@ void play_controller::enter_textbox()
return;
}
switch(menu_handler_.get_textbox().mode_) {
switch(menu_handler_.get_textbox().mode()) {
case gui::TEXTBOX_SEARCH:
menu_handler_.do_search(menu_handler_.get_textbox().box_->text());
menu_handler_.do_search(menu_handler_.get_textbox().box()->text());
break;
case gui::TEXTBOX_MESSAGE:
menu_handler_.do_speak();
break;
case gui::TEXTBOX_COMMAND:
menu_handler_.do_command(menu_handler_.get_textbox().box_->text(), player_number_, mouse_handler_);
menu_handler_.do_command(menu_handler_.get_textbox().box()->text(), player_number_, mouse_handler_);
break;
default:
LOG_STREAM(err, display) << "unknown textbox mode\n";

View File

@ -1,28 +1,7 @@
#include "global.hpp"
#include "ai_interface.hpp"
#include "config_adapter.hpp"
#include "cursor.hpp"
#include "display.hpp"
#include "filesystem.hpp"
#include "font.hpp"
#include "game_events.hpp"
#include "gettext.hpp"
#include "halo.hpp"
#include "help.hpp"
#include "intro.hpp"
#include "key.hpp"
#include "log.hpp"
#include "map_create.hpp"
#include "marked-up_text.hpp"
#include "playmp_controller.hpp"
#include "playturn.hpp"
#include "preferences.hpp"
#include "preferences_display.hpp"
#include "replay.hpp"
#include "log.hpp"
#include "sound.hpp"
#include "statistics.hpp"
#include "tooltips.hpp"
#define LOG_NG LOG_STREAM(info, engine)

View File

@ -13,6 +13,8 @@
#ifndef PLAYMP_CONTROLLER_H_INCLUDED
#define PLAYMP_CONTROLLER_H_INCLUDED
#include "global.hpp"
#include "hotkeys.hpp"
#include "playsingle_controller.hpp"

View File

@ -1,25 +1,10 @@
#include "playsingle_controller.hpp"
#include "ai_interface.hpp"
#include "config_adapter.hpp"
#include "cursor.hpp"
#include "display.hpp"
#include "filesystem.hpp"
#include "font.hpp"
#include "game_events.hpp"
#include "gettext.hpp"
#include "halo.hpp"
#include "help.hpp"
#include "intro.hpp"
#include "key.hpp"
#include "log.hpp"
#include "map_create.hpp"
#include "marked-up_text.hpp"
#include "preferences.hpp"
#include "preferences_display.hpp"
#include "replay.hpp"
#include "sound.hpp"
#include "tooltips.hpp"
#define LOG_NG LOG_STREAM(info, engine)

View File

@ -190,15 +190,7 @@ void replay::set_skip(bool skip)
bool replay::is_skipping() const
{
//YogiHH, 03.03.2006
//In multiplayer, skipping is implemented through the skip_ flag.
//Since at_end() is always true in mp replays (process_network_data
//creates a new replayer for every single command), we need a separate
//condition for it
//mp replay skipped or "skip_animation" in replay mode checked
if (skip_) { return true; }
//mp replay not skipped or "skip animation" in replay mode not checked
return at_end() == false && skip_;
return skip_;
}
void replay::save_game(const std::string& label, const config& snapshot,