Whiteboard: Fix some flickering. A new crash on exit sneaked in though,

...to be fixed soon(tm).
This commit is contained in:
Gabriel Morin 2010-07-01 01:51:19 +00:00
parent d1233afd80
commit 5d7ca5cff1
2 changed files with 12 additions and 4 deletions

View file

@ -17,9 +17,11 @@
*/
#include "highlight_visitor.hpp"
#include "manager.hpp"
#include "move.hpp"
#include "arrow.hpp"
#include "resources.hpp"
namespace wb
{
@ -35,6 +37,8 @@ highlight_visitor::~highlight_visitor()
void highlight_visitor::visit_move(boost::shared_ptr<move> move)
{
assert (!resources::whiteboard->has_planned_unit_map());
if (highlight_)
{
move->get_arrow()->set_alpha(move::ALPHA_HIGHLIGHT);

View file

@ -109,11 +109,15 @@ void manager::on_mouseover_change(const map_location& hex)
void manager::highlight_hex(const map_location& hex)
{
scoped_planned_unit_map wb_modifiers;
unit_map::iterator highlighted_unit;
bool unit_exists;
{
scoped_planned_unit_map wb_modifiers;
highlighted_unit = resources::units->find(hex);
unit_exists = highlighted_unit.valid();
}
unit_map::iterator highlighted_unit = resources::units->find(hex);
if (highlighted_unit.valid())
if (unit_exists)
{
highlighted_unit_ = &*highlighted_unit;
}