Author: tschmitz
Date: Tue Aug 2 12:15:01 2011
New Revision: 50557
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50557&view=rev
Log:
Added wb::side_actions::hide().
Modified:
trunk/src/whiteboard/side_actions.cpp
trunk/src/whiteboard/side_actions.hpp
Modified: trunk/src/whiteboard/side_actions.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/side_actions.cpp?rev=50557&r1=50556&r2=50557&view=diff
==============================================================================
--- trunk/src/whiteboard/side_actions.cpp (original)
+++ trunk/src/whiteboard/side_actions.cpp Tue Aug 2 12:15:01 2011
@@ -205,10 +205,31 @@
return exec_result == action::SUCCESS;
}
+void side_actions::hide()
+{
+ if(hidden_)
+ return;
+
+ hidden_ = true;
+
+ foreach(action_ptr act, *this)
+ act->hide();
+}
+void side_actions::show()
+{
+ if(!hidden_)
+ return;
+
+ hidden_ = false;
+
+ foreach(action_ptr act, *this)
+ act->show();
+}
+
side_actions::iterator side_actions::queue_move(const pathfind::marked_route&
route, arrow_ptr arrow, fake_unit_ptr fake_unit)
{
move_ptr new_move;
- new_move.reset(new move(team_index(), false, route, arrow, fake_unit));
+ new_move.reset(new move(team_index(), hidden_, route, arrow,
fake_unit));
return queue_action(new_move);
}
@@ -217,28 +238,28 @@
arrow_ptr arrow, fake_unit_ptr fake_unit)
{
attack_ptr new_attack;
- new_attack.reset(new attack(team_index(), false, target_hex,
weapon_choice, route, arrow, fake_unit));
+ new_attack.reset(new attack(team_index(), hidden_, target_hex,
weapon_choice, route, arrow, fake_unit));
return queue_action(new_attack);
}
side_actions::iterator side_actions::queue_recruit(const std::string&
unit_name, const map_location& recruit_hex)
{
recruit_ptr new_recruit;
- new_recruit.reset(new recruit(team_index(), false, unit_name,
recruit_hex));
+ new_recruit.reset(new recruit(team_index(), hidden_, unit_name,
recruit_hex));
return queue_action(new_recruit);
}
side_actions::iterator side_actions::queue_recall(const unit& unit, const
map_location& recall_hex)
{
recall_ptr new_recall;
- new_recall.reset(new recall(team_index(), false, unit, recall_hex));
+ new_recall.reset(new recall(team_index(), hidden_, unit, recall_hex));
return queue_action(new_recall);
}
side_actions::iterator side_actions::queue_suppose_dead(unit& curr_unit,
map_location const& loc)
{
suppose_dead_ptr new_suppose_dead;
- new_suppose_dead.reset(new
suppose_dead(team_index(),false,curr_unit,loc));
+ new_suppose_dead.reset(new
suppose_dead(team_index(),hidden_,curr_unit,loc));
return queue_action(new_suppose_dead);
}
@@ -599,7 +620,7 @@
action_queue::iterator itor = actions_.begin()+pos;
try {
- itor =
actions_.insert(itor,action::from_config(cmd.child("action"),false));
+ itor =
actions_.insert(itor,action::from_config(cmd.child("action"),hidden_));
} catch(action::ctor_err const&) {
ERR_WB << "side_actions::execute_network_command():
received invalid data!\n";
return;
@@ -624,7 +645,7 @@
itor = safe_erase(itor);
try {
- itor =
actions_.insert(itor,action::from_config(cmd.child("action"),false));
+ itor =
actions_.insert(itor,action::from_config(cmd.child("action"),hidden_));
} catch(action::ctor_err const&) {
ERR_WB << "side_actions::execute_network_command():
received invalid data!\n";
return;
Modified: trunk/src/whiteboard/side_actions.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/side_actions.hpp?rev=50557&r1=50556&r2=50557&view=diff
==============================================================================
--- trunk/src/whiteboard/side_actions.hpp (original)
+++ trunk/src/whiteboard/side_actions.hpp Tue Aug 2 12:15:01 2011
@@ -112,6 +112,11 @@
*/
void clear() { safe_clear(); }
+ /** Sets whether or not the contents should be drawn on the screen. */
+ void hide();
+ void show();
+ bool hidden() const {return hidden_;}
+
/**
* Queues a move to be executed last
* @return The queued move's position
@@ -239,6 +244,8 @@
/// Used to store gold "spent" in planned recruits/recalls when the
future unit map is applied
int gold_spent_;
+
+ bool hidden_;
};
/** Dumps side_actions on a stream, for debug purposes. */
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits