Whiteboard: transform move/attack...

...to use pathfind::marked_route internally, step 3.
This commit is contained in:
Gabriel Morin 2010-07-22 00:32:08 +00:00
parent 0b40803b1c
commit 3f86bfcc0f
7 changed files with 11 additions and 14 deletions

View File

@ -20,7 +20,7 @@
namespace wb {
std::ostream& operator<<(std::ostream& s, action_const_ptr action)
std::ostream& operator<<(std::ostream& s, action_ptr action)
{
return action->print(s);
}

View File

@ -33,7 +33,7 @@ class action
public:
friend class validate_visitor;
friend class highlight_visitor;
friend std::ostream& operator<<(std::ostream& s, action_const_ptr action);
friend std::ostream& operator<<(std::ostream& s, action_ptr action);
action();
virtual ~action();
@ -69,7 +69,7 @@ public:
virtual bool is_valid() = 0;
};
std::ostream& operator<<(std::ostream& s, wb::action const& action);
std::ostream& operator<<(std::ostream& s, action_ptr action);
} // end namespace wb

View File

@ -29,7 +29,7 @@
namespace wb
{
std::ostream &operator<<(std::ostream &s, attack_const_ptr attack)
std::ostream &operator<<(std::ostream &s, attack_ptr attack)
{
// s << "Attack for unit " << attack->get_unit().name() << " [" << attack->get_unit().underlying_id() << "] "
// << "moving from (" << attack->get_source_hex() << ") to (" << attack->get_dest_hex() << ") and attacking "

View File

@ -33,7 +33,7 @@ class attack: public move
public:
friend class validate_visitor;
friend class highlight_visitor;
friend std::ostream& operator<<(std::ostream& s, attack_const_ptr attack);
friend std::ostream& operator<<(std::ostream& s, attack_ptr attack);
///Future unit map must be valid during construction, so that attack can find its units
attack(const map_location& target_hex, int weapon_choice, const pathfind::marked_route& route,
@ -59,7 +59,7 @@ private:
};
/** Dumps an attack on a stream, for debug purposes. */
std::ostream& operator<<(std::ostream &s, wb::attack const& attack);
std::ostream& operator<<(std::ostream &s, attack_ptr attack);
} // end namespace wb

View File

@ -344,10 +344,9 @@ void manager::save_temp_move()
move_arrow = arrow_ptr(move_arrow_);
fake_unit = fake_unit_ptr(fake_unit_);
on_deselect_hex();
fake_unit->set_disabled_ghosted(false);
viewer_actions()->queue_move(*route_, move_arrow, fake_unit);
on_deselect_hex();
}
}
@ -355,7 +354,6 @@ void manager::save_temp_attack(const map_location& attack_from, const map_locati
{
if (active_ && !executing_actions_)
{
std::vector<map_location> steps;
arrow_ptr move_arrow;
fake_unit_ptr fake_unit;
@ -376,8 +374,6 @@ void manager::save_temp_attack(const map_location& attack_from, const map_locati
source_hex = attack_from;
}
on_deselect_hex();
unit* attacking_unit = find_future_unit(source_hex);
assert(attacking_unit);
@ -391,6 +387,7 @@ void manager::save_temp_attack(const map_location& attack_from, const map_locati
}
resources::screen->invalidate(target_hex);
on_deselect_hex();
}
}

View File

@ -36,7 +36,7 @@
namespace wb {
std::ostream& operator<<(std::ostream &s, move_const_ptr move)
std::ostream& operator<<(std::ostream &s, move_ptr move)
{
return move->print(s);
}

View File

@ -34,7 +34,7 @@ class move : public action, public boost::enable_shared_from_this<move>
public:
friend class validate_visitor;
friend class highlight_visitor;
friend std::ostream& operator<<(std::ostream& s, move_const_ptr move);
friend std::ostream& operator<<(std::ostream& s, move_ptr move);
static const double ALPHA_HIGHLIGHT;
static const double ALPHA_NORMAL;
@ -88,7 +88,7 @@ protected:
};
/** Dumps an move on a stream, for debug purposes. */
std::ostream &operator<<(std::ostream &s, wb::move const& move);
std::ostream &operator<<(std::ostream &s, move_ptr move);
} // end namespace wb