Whiteboard: scoped_planned_unit_map now only removes...

...the planned unit map if it wasn't set when it was created.
This commit is contained in:
Gabriel Morin 2010-07-19 09:04:52 +00:00
parent def4e4a50f
commit 022d028fbc
2 changed files with 4 additions and 2 deletions

View file

@ -498,14 +498,15 @@ unit* manager::selected_unit()
}
scoped_planned_unit_map::scoped_planned_unit_map()
:has_planned_unit_map_(resources::whiteboard->has_planned_unit_map())
{
if (!resources::whiteboard->has_planned_unit_map())
if (!has_planned_unit_map_)
resources::whiteboard->set_planned_unit_map();
}
scoped_planned_unit_map::~scoped_planned_unit_map()
{
if (resources::whiteboard->has_planned_unit_map())
if (!has_planned_unit_map_)
resources::whiteboard->set_real_unit_map();
}

View file

@ -144,6 +144,7 @@ struct scoped_planned_unit_map
{
scoped_planned_unit_map();
~scoped_planned_unit_map();
bool has_planned_unit_map_;
};
/** Ensures that the real unit map is active for the duration of the struct's life,