mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-03 12:42:19 +00:00
Fixed crash when planning a suppose_dead.
This commit is contained in:
parent
1171962774
commit
4645fc831d
@ -245,8 +245,13 @@ void playsingle_controller::whiteboard_bump_down_action()
|
||||
|
||||
void playsingle_controller::whiteboard_suppose_dead()
|
||||
{
|
||||
wb::scoped_planned_unit_map spum;
|
||||
whiteboard_manager_->save_suppose_dead(*menu_handler_.current_unit());
|
||||
unit_map::iterator curr_unit;
|
||||
map_location loc;
|
||||
{ wb::scoped_planned_unit_map raii;
|
||||
curr_unit = menu_handler_.current_unit();
|
||||
loc = curr_unit->get_location();
|
||||
}
|
||||
whiteboard_manager_->save_suppose_dead(*curr_unit,loc);
|
||||
}
|
||||
|
||||
void playsingle_controller::report_victory(
|
||||
|
@ -612,11 +612,11 @@ bool manager::save_recall(const unit& unit, int side_num, const map_location& re
|
||||
return created_planned_recall;
|
||||
}
|
||||
|
||||
void manager::save_suppose_dead(unit& curr_unit)
|
||||
void manager::save_suppose_dead(unit& curr_unit, map_location const& loc)
|
||||
{
|
||||
if(active_ && !executing_actions_ && !resources::controller->is_linger_mode())
|
||||
{
|
||||
viewer_actions()->queue_suppose_dead(curr_unit);
|
||||
viewer_actions()->queue_suppose_dead(curr_unit,loc);
|
||||
on_save_action();
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
bool save_recall(const unit& unit, int side_num, const map_location& recall_hex);
|
||||
|
||||
/// Creates a suppose-dead action for the current side
|
||||
void save_suppose_dead(unit& curr_unit);
|
||||
void save_suppose_dead(unit& curr_unit, map_location const& loc);
|
||||
|
||||
/** Executes first action in the queue for current side */
|
||||
void contextual_execute();
|
||||
|
@ -254,10 +254,10 @@ side_actions::iterator side_actions::queue_recall(const unit& unit, const map_lo
|
||||
return queue_action(new_recall);
|
||||
}
|
||||
|
||||
side_actions::iterator side_actions::queue_suppose_dead(unit& curr_unit)
|
||||
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(),curr_unit));
|
||||
new_suppose_dead.reset(new suppose_dead(team_index(),curr_unit,loc));
|
||||
return queue_action(new_suppose_dead);
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
* Queues a suppose_dead to be executed last
|
||||
* @return The queued suppose_dead's position (an iterator to it)
|
||||
*/
|
||||
iterator queue_suppose_dead(unit& curr_unit);
|
||||
iterator queue_suppose_dead(unit& curr_unit, map_location const& loc);
|
||||
|
||||
/**
|
||||
* Inserts an action at the specified position. The begin() and end() functions might prove useful here.
|
||||
|
@ -60,11 +60,11 @@ namespace wb
|
||||
return s;
|
||||
}
|
||||
|
||||
suppose_dead::suppose_dead(size_t team_index, unit& curr_unit)
|
||||
suppose_dead::suppose_dead(size_t team_index, unit& curr_unit, map_location const& loc)
|
||||
: action(team_index)
|
||||
, unit_(&curr_unit)
|
||||
, unit_id_(curr_unit.id())
|
||||
, loc_(curr_unit.get_location())
|
||||
, loc_(loc)
|
||||
, valid_(true)
|
||||
{
|
||||
this->init();
|
||||
|
@ -37,8 +37,7 @@ namespace wb {
|
||||
friend class highlight_visitor;
|
||||
|
||||
public:
|
||||
///Future unit map must be valid during construction, so that suppose_dead can find its unit
|
||||
suppose_dead(size_t team_index, unit& curr_unit);
|
||||
suppose_dead(size_t team_index, unit& curr_unit, map_location const& loc);
|
||||
explicit suppose_dead(config const&); // For deserialization
|
||||
virtual ~suppose_dead();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user