Build the planned unit map even if the action queue is empty,
...since the mapbuilding does additional things such as removing invisible units from the map.
This commit is contained in:
parent
02056b6397
commit
32676ed2a5
4 changed files with 20 additions and 17 deletions
|
@ -967,11 +967,7 @@ void manager::contextual_bump_down_action()
|
|||
bool manager::has_actions() const
|
||||
{
|
||||
assert(!wait_for_side_init_);
|
||||
foreach(team& t, *resources::teams)
|
||||
if (!t.get_side_actions()->empty())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return wb::has_actions();
|
||||
}
|
||||
|
||||
bool manager::unit_has_actions(unit const* unit) const
|
||||
|
@ -1074,17 +1070,10 @@ void manager::set_planned_unit_map()
|
|||
return;
|
||||
}
|
||||
|
||||
if (has_actions())
|
||||
{
|
||||
validate_actions_if_needed();
|
||||
log_scope2("whiteboard", "Building planned unit map");
|
||||
mapbuilder_.reset(new mapbuilder(*resources::units));
|
||||
mapbuilder_->build_map();
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_WB << "Actions queue empty, unit map flag set but skipping map building.\n";
|
||||
}
|
||||
validate_actions_if_needed();
|
||||
log_scope2("whiteboard", "Building planned unit map");
|
||||
mapbuilder_.reset(new mapbuilder(*resources::units));
|
||||
mapbuilder_->build_map();
|
||||
|
||||
planned_unit_map_active_ = true;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,9 @@ void mapbuilder::pre_build()
|
|||
void mapbuilder::build_map()
|
||||
{
|
||||
pre_build();
|
||||
visit_all();
|
||||
if (wb::has_actions()) {
|
||||
visit_all();
|
||||
}
|
||||
}
|
||||
|
||||
///@return whether act is valid
|
||||
|
|
|
@ -147,5 +147,14 @@ void unghost_owner_unit(unit* unit)
|
|||
resources::screen->invalidate(unit->get_location());
|
||||
}
|
||||
|
||||
bool has_actions()
|
||||
{
|
||||
foreach(team& t, *resources::teams)
|
||||
if (!t.get_side_actions()->empty())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} //end namespace wb
|
||||
|
||||
|
|
|
@ -90,6 +90,9 @@ struct variable_finalizer
|
|||
void ghost_owner_unit(unit* unit);
|
||||
void unghost_owner_unit(unit* unit);
|
||||
|
||||
/** Return whether the whiteboard has actions. */
|
||||
bool has_actions();
|
||||
|
||||
} //end namespace wb
|
||||
|
||||
#endif /* WB_UTILITY_HPP_ */
|
||||
|
|
Loading…
Add table
Reference in a new issue