mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 17:52:00 +00:00
Whiteboard: transform move/attack...
...to use pathfind::marked_route internally, step 3.
This commit is contained in:
parent
0b40803b1c
commit
3f86bfcc0f
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace wb {
|
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);
|
return action->print(s);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class action
|
|||||||
public:
|
public:
|
||||||
friend class validate_visitor;
|
friend class validate_visitor;
|
||||||
friend class highlight_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();
|
action();
|
||||||
virtual ~action();
|
virtual ~action();
|
||||||
@ -69,7 +69,7 @@ public:
|
|||||||
virtual bool is_valid() = 0;
|
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
|
} // end namespace wb
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
namespace wb
|
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() << "] "
|
// 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 "
|
// << "moving from (" << attack->get_source_hex() << ") to (" << attack->get_dest_hex() << ") and attacking "
|
||||||
|
@ -33,7 +33,7 @@ class attack: public move
|
|||||||
public:
|
public:
|
||||||
friend class validate_visitor;
|
friend class validate_visitor;
|
||||||
friend class highlight_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
|
///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,
|
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. */
|
/** 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
|
} // end namespace wb
|
||||||
|
|
||||||
|
@ -344,10 +344,9 @@ void manager::save_temp_move()
|
|||||||
move_arrow = arrow_ptr(move_arrow_);
|
move_arrow = arrow_ptr(move_arrow_);
|
||||||
fake_unit = fake_unit_ptr(fake_unit_);
|
fake_unit = fake_unit_ptr(fake_unit_);
|
||||||
|
|
||||||
on_deselect_hex();
|
|
||||||
|
|
||||||
fake_unit->set_disabled_ghosted(false);
|
fake_unit->set_disabled_ghosted(false);
|
||||||
viewer_actions()->queue_move(*route_, move_arrow, fake_unit);
|
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_)
|
if (active_ && !executing_actions_)
|
||||||
{
|
{
|
||||||
std::vector<map_location> steps;
|
|
||||||
arrow_ptr move_arrow;
|
arrow_ptr move_arrow;
|
||||||
fake_unit_ptr fake_unit;
|
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;
|
source_hex = attack_from;
|
||||||
}
|
}
|
||||||
|
|
||||||
on_deselect_hex();
|
|
||||||
|
|
||||||
unit* attacking_unit = find_future_unit(source_hex);
|
unit* attacking_unit = find_future_unit(source_hex);
|
||||||
assert(attacking_unit);
|
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);
|
resources::screen->invalidate(target_hex);
|
||||||
|
on_deselect_hex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
namespace wb {
|
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);
|
return move->print(s);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class move : public action, public boost::enable_shared_from_this<move>
|
|||||||
public:
|
public:
|
||||||
friend class validate_visitor;
|
friend class validate_visitor;
|
||||||
friend class highlight_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_HIGHLIGHT;
|
||||||
static const double ALPHA_NORMAL;
|
static const double ALPHA_NORMAL;
|
||||||
@ -88,7 +88,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Dumps an move on a stream, for debug purposes. */
|
/** 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
|
} // end namespace wb
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user